|
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.protocols.icmp.ICMPHeader
org.opennms.netmgt.ping.Packet
The ping packet for discovery
Field Summary | |
private byte[] |
m_pad
Padding used to make the packet conform to the defacto unix ping program (56 bytes). |
private long |
m_recv
Timestamp of when packet was received. |
private long |
m_rtt
The ping rtt (microseconds) |
private long |
m_sent
Timestamp when packet was sent |
private long |
m_tid
The thread id of the sender. |
private static byte[] |
NAMED_PAD
Unique named padding that is placed in front of the incremental padding. |
private static int |
PAD_SIZE
This is the amount of padding required to make the ICMP echo request 56 bytes in length. |
Constructor Summary | |
private |
Packet()
Private constructor to disallow default construction of an object. |
|
Packet(byte[] buf)
Creates a new discovery ping packet from the passed buffer. |
|
Packet(long tid)
Creates a new discovery ping packet that can be sent to a remote protocol stack. |
Method Summary | |
private static long |
byteToLong(byte b)
Converts a byte to a long and wraps the value to avoid sign extension. |
void |
computeChecksum()
Computes and stores the current checksum based upon the data currently contained in the object. |
static int |
getNetworkSize()
Returns the network size for this packet. |
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. |
Methods inherited from class org.opennms.protocols.icmp.ICMPHeader |
byteToInt, byteToShort, computeChecksum, getChecksum, getCode, getIdentity, getSequenceId, getType, isEchoReply, isEchoRequest, nextSequenceId, setChecksum, setCode, setIdentity, setNextSequenceId, setSequenceId, setType |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final byte[] NAMED_PAD
private long m_sent
private long m_recv
private long m_tid
private byte[] m_pad
private long m_rtt
private static final int PAD_SIZE
Constructor Detail |
private Packet()
java.lang.UnsupportedOperationException
- Always thrown.public Packet(long tid)
tid
- The thread id for the packet.System.currentTimeMillis()
public Packet(byte[] buf)
buf
- The buffer containing a refected ping packet.Method Detail |
private static long byteToLong(byte b)
b
- The byte to convert.
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 static final int getNetworkSize()
public final void computeChecksum()
computeChecksum
in class ICMPHeader
public final long getTID()
public final void setTID(long tid)
public final int loadFromBuffer(byte[] buf, int offset)
loadFromBuffer
in class ICMPHeader
buf
- The buffer to load fromoffset
- The offset to begin loading from
java.lang.IndexOutOfBoundsException
- 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 ICMPHeader
buf
- The storage buffer.offset
- The location to start in buf.
java.lang.IndexOutOfBoundsException
- Thrown if the buffer does not have enough storage space.public final byte[] toBytes()
toBytes
in class ICMPHeader
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |