public final class ICMPEchoPacket extends ICMPHeader
CODE_BAD_IP_HEADER, CODE_COMMUNICATIONS_ADMIN_PROHIBITIED, CODE_DESTINATION_HOST_ADMIN_PROHIBITED, CODE_DESTINATION_HOST_UNKNOWN, CODE_DESTINATION_NETWORK_ADMIN_PROHIBITED, CODE_DESTINATION_NETWORK_UNKNOWN, CODE_FRAGMENTATION_NEEDED, CODE_HOST_PRECEDENCE_VIOLATION, CODE_HOST_UNREACHABLE, CODE_HOST_UNREACHABLE_FOR_TOS, CODE_NETWORK_UNREACHABLE, CODE_NETWORK_UNREACHABLE_FOR_TOS, CODE_PORT_UNREACHABLE, CODE_PRECEDENCE_CUTOFF_IN_EFFECT, CODE_PROTOCOL_UNREACHABLE, CODE_REDIRECT_FOR_HOST, CODE_REDIRECT_FOR_NETWORK, CODE_REDIRECT_FOR_TYPE_OF_SERVICE_AND_HOST, CODE_REDIRECT_FOR_TYPE_OF_SERVICE_AND_NETWORK, CODE_REQUIRED_OPTION_MISSING, CODE_SOURCE_HOST_ISOLATED, CODE_SOURCE_ROUTE_FAILED, CODE_TTL_EQ_ZERO_IN_REASSEMBLY, CODE_TTL_EQ_ZERO_IN_TRANSIT, TYPE_ADDRESS_MASK_REPLY, TYPE_ADDRESS_MASK_REQUEST, TYPE_DESTINATION_UNREACHABLE, TYPE_ECHO_REPLY, TYPE_ECHO_REQUEST, TYPE_INFORMATION_REPLY, TYPE_INFORMATION_REQUEST, TYPE_PARAMETER_PROBLEM, TYPE_REDIRECT, TYPE_ROUTER_ADVERTISEMENT, TYPE_ROUTER_SOLICITATION, TYPE_SOURCE_QUENCH, TYPE_TIME_EXCEEDED, TYPE_TIMESTAMP_REPLY, TYPE_TIMESTAMP_REQUEST| Constructor and Description | 
|---|
| ICMPEchoPacket(byte[] buf)Creates a new discovery ping packet from the passed buffer. | 
| ICMPEchoPacket(long tid)Creates a new discovery ping packet that can be sent to a remote protocol
 stack. | 
| ICMPEchoPacket(long tid,
              int packetsize)Creates a new discovery ping packet that can be sent to a remote protocol
 stack. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | computeChecksum()Computes and stores the current checksum based upon the data currently
 contained in the object. | 
| int | getDataSize()Returns the size of the integer headers in packet | 
| int | getMinimumNetworkSize()Returns the size of the integer headers in the packet plus the required 'OpenNMS!' string. | 
| static int | getNetworkSize()Deprecated.  | 
| int | getPacketSize() | 
| long | getPingRTT()Gets the ping Round Trip Time | 
| long | getReceivedTime()Gets the currently set received time. | 
| long | getSentTime()Returns the time the packet was sent. | 
| long | getTID()Returns the currently set Thread ID | 
| int | loadFromBuffer(byte[] buf,
              int offset)Loads the data from the passed buffer into the current object. | 
| void | setPingRTT(long time)Sets the ping Round Trip Time | 
| long | setReceivedTime()Sets the recieved time for the packet. | 
| void | setReceivedTime(long time)Sets the received time to the passed value. | 
| long | setSentTime()Sets the sent time to the current time. | 
| void | setSentTime(long time)Sets the sent time to the passed value. | 
| void | setTID(long tid)Sets the current Thread Id | 
| int | storeToBuffer(byte[] buf,
             int offset)Writes the objects data out to the specified buffer at the starting
 offset. | 
| byte[] | toBytes()Converts the object into an array of bytes which is suitable for
 transmission to remote hosts. | 
byteToInt, byteToShort, computeChecksum, getChecksum, getCode, getHeaderSize, getIdentity, getSequenceId, getType, isEchoReply, isEchoRequest, nextSequenceId, setChecksum, setCode, setIdentity, setNextSequenceId, setSequenceId, setTypepublic ICMPEchoPacket(long tid)
tid - The thread id for the packet.System.currentTimeMillis()public ICMPEchoPacket(long tid,
                      int packetsize)
tid - The thread id for the packet.packetsize - The pad size in bytesSystem.currentTimeMillis()public ICMPEchoPacket(byte[] buf)
buf - The buffer containing a refected ping packet.public final long getSentTime()
public final long setSentTime()
System.currentTimeMillis()public final void setSentTime(long time)
time - The new sent time.public final long getReceivedTime()
public final long setReceivedTime()
System.currentTimeMillis()public final void setReceivedTime(long time)
time - The new received time.public final void setPingRTT(long time)
public final long getPingRTT()
public int getDataSize()
public int getMinimumNetworkSize()
@Deprecated public static final int getNetworkSize()
public int getPacketSize()
public final void computeChecksum()
computeChecksum in class ICMPHeaderpublic final long getTID()
public final void setTID(long tid)
public final int loadFromBuffer(byte[] buf,
                                int offset)
loadFromBuffer in class ICMPHeaderbuf - The buffer to load fromoffset - The offset to begin loading fromIndexOutOfBoundsException - Thrown if there is not enough data contained in the buffer
                to sufficent set the state of the objectpublic final int storeToBuffer(byte[] buf,
                               int offset)
storeToBuffer in class ICMPHeaderbuf - The storage buffer.offset - The location to start in buf.IndexOutOfBoundsException - Thrown if the buffer does not have enough storage space.public final byte[] toBytes()
toBytes in class ICMPHeaderCopyright © 2002–2023 The OpenNMS Group, Inc.. All rights reserved.