public final class TimestampReply 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 |
---|
TimestampReply()
Creates a new ICMP Timestamp Reply object.
|
TimestampReply(byte[] buf,
int offset)
Creates a new ICMP timestamp reply from the spcified data at the specific
offset.
|
Modifier and Type | Method and Description |
---|---|
void |
computeChecksum()
Computes the ones compliment 16-bit checksum for the ICMP message.
|
int |
getOriginateTS()
Retreives the current timestamp of the reqeust object.
|
int |
getReceiveTS()
Retreives the current received timestamp of the reqeust object.
|
int |
getTransmitTS()
Retreives the current transmit timestamp of the reply object.
|
int |
loadFromBuffer(byte[] buf,
int offset)
Reads the ICMP Address Mask Reqeust from the specified buffer and sets
the internal fields equal to the data.
|
void |
setOriginateTS()
Sets the originate timestamp to the current date in millisecond
resolution.
|
void |
setOriginateTS(int ts)
Sets the originate timestamp to the passed value.
|
void |
setReceiveTS()
Sets the receive timestamp to the current date in millisecond resolution.
|
void |
setReceiveTS(int ts)
Sets the receive timestamp to the passed value.
|
void |
setTransmitTS()
Sets the transmit timestamp to the current date in millisecond
resolution.
|
void |
setTransmitTS(int ts)
Sets the tranmit timestamp to the passed value.
|
int |
storeToBuffer(byte[] buf,
int offset)
Writes the ICMP address mask reply out to the specified buffer at the
starting offset.
|
byte[] |
toBytes()
Converts the object to an array of bytes.
|
byteToInt, byteToShort, computeChecksum, getChecksum, getCode, getHeaderSize, getIdentity, getNetworkSize, getSequenceId, getType, isEchoReply, isEchoRequest, nextSequenceId, setChecksum, setCode, setIdentity, setNextSequenceId, setSequenceId, setType
public TimestampReply()
public TimestampReply(byte[] buf, int offset)
buf
- The buffer containing the data.offset
- The start of the icmp data.IndexOutOfBoundsException
- Thrown if there is not sufficent data in the buffer.IllegalArgumentException
- Thrown if the ICMP type is not an Timestamp Reply.public final void computeChecksum()
computeChecksum
in class ICMPHeader
public final int storeToBuffer(byte[] buf, int offset)
storeToBuffer
in class ICMPHeader
buf
- The storage buffer.offset
- The location to start in buf.IndexOutOfBoundsException
- Thrown if the buffer does not have enough storage space.public final int loadFromBuffer(byte[] buf, int offset)
loadFromBuffer
in class ICMPHeader
buf
- The buffer to read the data from.offset
- The offset to start reading data.IndexOutOfBoundsException
- Thrown if there is not sufficent data in the buffer.IllegalArgumentException
- Thrown if the ICMP type is not an Timestamp Reply.public final void setOriginateTS()
Date.getTime()
public final void setOriginateTS(int ts)
ts
- The timestamp in millisecondspublic final int getOriginateTS()
public final void setReceiveTS()
Date.getTime()
public final void setReceiveTS(int ts)
ts
- The timestamp in millisecondspublic final int getReceiveTS()
public final void setTransmitTS()
Date.getTime()
public final void setTransmitTS(int ts)
ts
- The timestamp in millisecondspublic final int getTransmitTS()
public final byte[] toBytes()
toBytes
in class ICMPHeader
Copyright © 2002–2023 The OpenNMS Group, Inc.. All rights reserved.