|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opennms.protocols.snmp.SnmpPortal
Abstracts the communication related details from the SnmpSession and SnmpTrapSession.
SnmpSession
,
SnmpTrapSession
,
DatagramSocket
Inner Class Summary | |
private class |
SnmpPortal.Receiver
Defines the inner class that monitors the datagram socket and receives all the PDU responses. |
Field Summary | |
private DatagramSocket |
m_comm
The datagram socket used to send and receive SNMP messages. |
private AsnEncoder |
m_encoder
ASN.1 encoder used to decode the SNMP messages. |
private SnmpPacketHandler |
m_handler
The packet handler that is used to process received SNMP packets and invalid datagrams. |
private boolean |
m_isClosing
When set the portal object's close method has been invoked. |
private Thread |
m_recvThread
the receiver thread that runs the inner class Receiver. |
Constructor Summary | |
private |
SnmpPortal()
Private constructor used to disallow the default constructor. |
(package private) |
SnmpPortal(SnmpPacketHandler handler,
AsnEncoder encoder,
int port)
The SnmpPortal constructor. |
Method Summary | |
(package private) void |
close()
Used to close the session. |
(package private) AsnEncoder |
getAsnEncoder()
Gets the AsnEncoder for the session. |
(package private) SnmpPacketHandler |
getPacketHandler()
Gets the default SnmpPacketHandler for the session. |
(package private) void |
handlePkt(DatagramPacket pkt)
Recovers a SnmpPduPacket or SnmpPduTrap from the passed datagram and calls the appropriate method in the handler. |
(package private) void |
send(SnmpPeer peer,
byte[] buf)
Transmits the passed buffer to the respective peer agent. |
(package private) void |
send(SnmpPeer peer,
byte[] buf,
int length)
Transmits the passed buffer to the respective peer agent. |
(package private) void |
setAsnEncoder(AsnEncoder encoder)
Sets the default encoder. |
(package private) void |
setPacketHandler(SnmpPacketHandler hdl)
Sets the default SnmpPacketHandler. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private SnmpPacketHandler m_handler
private DatagramSocket m_comm
private Thread m_recvThread
private AsnEncoder m_encoder
private boolean m_isClosing
Constructor Detail |
private SnmpPortal() throws UnsupportedOperationException
UnsupportedOperationException
- Always thrown!SnmpPortal(SnmpPacketHandler handler, AsnEncoder encoder, int port) throws SocketException
handler
- The SNMP packet handler.encoder
- The ASN.1 codec object.port
- The port to send and receive datagram from.SocketException
- Thrown if an error occurs setting
up the communication channel.IllegalArgumentException
- Thrown if any of the parameters
are null or invalid.Method Detail |
void handlePkt(DatagramPacket pkt) throws SnmpPduEncodingException, AsnDecodingException
pkt
- The datagram packet to be decodedSnmpPduEncodingException
- Thrown if a pdu or session level error occursAsnDecodingException
- Thrown if the AsnEncoder encounters an errorSnmpPduTrap
,
SnmpPduPacket
,
SnmpPduRequest
,
SnmpPduBulk
,
SnmpParameters
,
AsnEncoder
void send(SnmpPeer peer, byte[] buf, int length) throws IOException
peer
- The SNMP peer destinationbuf
- The buffer to transmit.length
- The valid length of the bufferjava.lang.IOException
- For more details see
java.net.DatagramSocket.DatagramSocket
void send(SnmpPeer peer, byte[] buf) throws IOException
peer
- The SNMP peer destinationbuf
- The buffer to transmit.java.lang.IOException
- For more details see
java.net.DatagramSocket.DatagramSocket
void setPacketHandler(SnmpPacketHandler hdl)
hdl
- The new handlerSnmpPacketHandler getPacketHandler()
void setAsnEncoder(AsnEncoder encoder)
encoder
- The new encoderAsnEncoder getAsnEncoder()
void close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |