|
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.SnmpContextv3Basis | +--uk.co.westhawk.snmp.stack.SnmpContextv3
This class contains the SNMP v3 context that is needed by every PDU to send a SNMP v3 request. Most of the work is done by SnmpContextv3Basis, like doing discovery.
Now that the stack can send traps and receive requests, it needs to be able to act as an authoritative SNMP engine. This is done via the interface UsmAgent. The DefaultUsmAgent is not guaranteed to work; agents (or rather authoritative engines) should provide a better implementation.
This class adds a UsmBeingDiscoveredBean as listener. This bean handles any incoming discovery PDU. Only when acting as authoritative engine should there be any discovery PDU.
SnmpContextv3Face
,
SnmpContextv3Pool
,
TimeWindow
,
DefaultUsmAgent
,
UsmAgent
,
SnmpContextv3Basis.setUsmAgent(UsmAgent)
,
UsmDiscoveryBean
Field Summary |
Fields inherited from class uk.co.westhawk.snmp.stack.SnmpContextv3Basis |
authenticationProtocol, contextEngineId, contextName, useAuthentication, usePrivacy, userAuthenticationPassword, userAuthKeyMD5, userAuthKeySHA1, userName, userPrivacyPassword, userPrivKeyMD5, userPrivKeySHA1, usmAgent |
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.SnmpContextv3Face |
Default_ContextName, Default_UserName, MD5_PROTOCOL, ProtocolNames, SHA1_PROTOCOL, SNMPv1_Security_Model, SNMPv2c_Security_Model, USM_Security_Model, version_id |
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 | |
SnmpContextv3(java.lang.String host,
int port)
Constructor. |
|
SnmpContextv3(java.lang.String host,
int port,
java.lang.String typeSocketA)
Constructor. |
|
SnmpContextv3(java.lang.String host,
int port,
java.lang.String bindAddress,
java.lang.String typeSocketA)
Constructor. |
Method Summary | |
void |
addRequestPduListener(RequestPduListener l,
ListeningContextPool lcontext)
Makes sure the UsmBeingDiscoveredBean is added as RequestPduListener, so that discovery requests are handled. |
java.lang.Object |
clone()
Returns a clone of this SnmpContextv3. |
Pdu |
processIncomingPdu(byte[] message)
Processes an incoming PDU, that is not a Discovery PDU. |
Pdu |
processPotentialRequest(uk.co.westhawk.snmp.stack.AsnDecoderv3 rpdu,
uk.co.westhawk.snmp.stack.AsnSequence asnTopSeq,
byte[] message)
Processes an incoming PDU, to see if it is a Request. |
Pdu |
processPotentialTrap(uk.co.westhawk.snmp.stack.AsnDecoderv3 rpdu,
uk.co.westhawk.snmp.stack.AsnSequence asnTopSeq,
byte[] message)
Processes an incoming PDU, to see if it is a Trap. |
void |
removeRequestPduListener(RequestPduListener l,
ListeningContextPool lcontext)
Removes the UsmBeingDiscoveredBean as listener. |
Methods inherited from class uk.co.westhawk.snmp.stack.AbstractSnmpContext |
activate, addRequestPduListener, addRequestPduListener, addTrapListener, addTrapListener, addTrapListener, destroy, freeTransmitters, getBindAddress, getDebugString, getHost, getHostAddress, getMaxRecvSize, getPort, getReceivedFromHostAddress, getSendToHostAddress, getTypeSocket, isDestroyed, rawPduReceived, 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.SnmpContextBasisFace |
addRequestPduListener, addRequestPduListener, addTrapListener, addTrapListener, addTrapListener, destroy, getBindAddress, getHost, getPort, getReceivedFromHostAddress, getSendToHostAddress, getTypeSocket, isDestroyed, removeRequestPduListener, removeRequestPduListener, removeTrapListener, removeTrapListener, removeTrapListener, sendPacket |
Constructor Detail |
public SnmpContextv3(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 SnmpContextv3(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 SnmpContextv3(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 void addRequestPduListener(RequestPduListener l, ListeningContextPool lcontext) throws java.io.IOException
Don't use the TCP_SOCKET when listening for request PDUs. It doesn't provide functionality to send a response back.
addRequestPduListener
in interface SnmpContextBasisFace
addRequestPduListener
in class SnmpContextv3Basis
l
- The request PDU listenerlcontext
- The listening context
java.io.IOException
removeRequestPduListener(RequestPduListener, ListeningContextPool)
,
UsmBeingDiscoveredBean
,
SnmpContextv3Basis.setUsmAgent(UsmAgent)
public void removeRequestPduListener(RequestPduListener l, ListeningContextPool lcontext) throws java.io.IOException
removeRequestPduListener
in interface SnmpContextBasisFace
removeRequestPduListener
in class AbstractSnmpContext
l
- The request PDU listenerlcontext
- The listening context
java.io.IOException
addRequestPduListener(RequestPduListener, ListeningContextPool)
public Pdu processIncomingPdu(byte[] message) throws DecodingException, java.io.IOException
This method calls first processPotentialTrap and then processPotentialRequest. The reason this code is split up is because in one case the stack acts as authoritative engine and as non authoritative engine in the other..
processIncomingPdu
in interface SnmpContextBasisFace
processIncomingPdu
in class AbstractSnmpContext
DecodingException
java.io.IOException
AbstractSnmpContext.rawPduReceived(uk.co.westhawk.snmp.event.RawPduEvent)
,
processPotentialTrap(uk.co.westhawk.snmp.stack.AsnDecoderv3, uk.co.westhawk.snmp.stack.AsnSequence, byte[])
,
processPotentialRequest(uk.co.westhawk.snmp.stack.AsnDecoderv3, uk.co.westhawk.snmp.stack.AsnSequence, byte[])
public Pdu processPotentialTrap(uk.co.westhawk.snmp.stack.AsnDecoderv3 rpdu, uk.co.westhawk.snmp.stack.AsnSequence asnTopSeq, byte[] message) throws DecodingException, java.io.IOException
DecodingException
java.io.IOException
processIncomingPdu(byte[])
,
processPotentialRequest(uk.co.westhawk.snmp.stack.AsnDecoderv3, uk.co.westhawk.snmp.stack.AsnSequence, byte[])
public Pdu processPotentialRequest(uk.co.westhawk.snmp.stack.AsnDecoderv3 rpdu, uk.co.westhawk.snmp.stack.AsnSequence asnTopSeq, byte[] message) throws DecodingException, java.io.IOException
DecodingException
java.io.IOException
processIncomingPdu(byte[])
,
processPotentialTrap(uk.co.westhawk.snmp.stack.AsnDecoderv3, uk.co.westhawk.snmp.stack.AsnSequence, byte[])
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface SnmpContextBasisFace
clone
in class AbstractSnmpContext
java.lang.CloneNotSupportedException
- Thrown when the constructor
generates an IOException
|
SNMP Stack 5_1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |