|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opennms.protocols.icmp.ICMPHeader | +--org.opennms.bb.dp.discovery.components.DiscPingPacket
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_sent
Timestamp when packet was sent |
private long |
m_tid
The thread id of the sender. |
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 |
DiscPingPacket()
Private constructor to disallow default construction of an object. |
|
DiscPingPacket(byte[] buf)
Creates a new discovery ping packet from the passed buffer. |
|
DiscPingPacket(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 |
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. |
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 |
|
Field Detail |
private long m_sent
private long m_recv
private long m_tid
private byte[] m_pad
private static final int PAD_SIZE
Constructor Detail |
private DiscPingPacket()
UnsupportedOperationException
- Always thrown.public DiscPingPacket(long tid)
tid
- The thread id for the packet.Date.getTime()
public DiscPingPacket(byte[] buf)
buf
- The buffer containing a refected ping packet.Method Detail |
private static long byteToLong(byte b)
b
- The byte to convert.public long getSentTime()
public long setSentTime()
Date.getTime()
public void setSentTime(long time)
time
- The new sent time.public long getReceivedTime()
public long setReceivedTime()
java.util.Data#getTime
public void setReceivedTime(long time)
time
- The new received time.public static int getNetworkSize()
org.opennms.protocols.icmp.ICMPHeader
public void computeChecksum()
computeChecksum
in class ICMPHeader
public long getTID()
public void setTID(long tid)
public int loadFromBuffer(byte[] buf, int offset)
loadFromBuffer
in class ICMPHeader
buf
- The buffer to load fromoffset
- The offset to begin loading fromInsufficientDataException
- Thrown if there is not enough data contained in the buffer to
sufficent set the state of the objectpublic int storeToBuffer(byte[] buf, int offset)
storeToBuffer
in class ICMPHeader
buf
- The storage buffer.offst
- The location to start in buf.ArrayIndexOutOfBoundsException
- Thrown if the buffer
does not have enough storage space.public byte[] toBytes()
toBytes
in class ICMPHeader
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |