|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.ping.Reply
This class is use to encapsulate an ICMP reply that conforms to the
packet
class. The reply must be of type ICMP Echo Reply and be
the correct length.
When constructed by the create
method the returned reply
encapsulates the sender's address and the received packet as final,
non-mutable values for the instance.
Field Summary | |
private java.net.InetAddress |
m_address
The sender's address. |
private Packet |
m_packet
The received packet. |
Constructor Summary | |
private |
Reply(java.net.InetAddress addr,
Packet pkt)
Constructs a new reply with the passed address and packet as the contents of the reply. |
Method Summary | |
(package private) static Reply |
create(java.net.DatagramPacket packet)
Creates a new instance of the class using the passed datagram as the data source. |
java.net.InetAddress |
getAddress()
Returns the internet address of the host that sent the reply. |
short |
getIdentity()
Returns the identity of the packet. |
Packet |
getPacket()
Returns the ICMP packet for the reply. |
boolean |
isEchoReply()
Returns true if the recovered packet is an echo reply. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final java.net.InetAddress m_address
private final Packet m_packet
Constructor Detail |
private Reply(java.net.InetAddress addr, Packet pkt)
addr
- The address of the ICMP sender.pkt
- The received packet.Method Detail |
public boolean isEchoReply()
public final short getIdentity()
public final java.net.InetAddress getAddress()
public final Packet getPacket()
static Reply create(java.net.DatagramPacket packet)
Creates a new instance of the class using the passed datagram as the data source. The address and ping packet are extracted from the datagram and returned as a new instance of the class. In addition to extracting the packet, the packet's received time is updated to the current time.
If the received datagram is not an echo reply or an incorrect length then an exception is generated to alert the caller.
packet
- The packet with the ICMP datagram.
java.lang.IllegalArgumentException
- Throw if the datagram is not the correct length or type.
java.lang.IndexOutOfBoundsException
- Thrown if the datagram does not contain sufficent data.
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |