|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opennms.protocols.icmpd.MessageHeader | +--org.opennms.protocols.icmpd.DataRecvMessage
The message class for receiving ICMP infomation from the icmp daemon. The basic message begins with an eight byte header. The header consist of a type, code, sequence number, length, and reserved field. The remain fields are specific to the received message.
+--------+--------+----------------+ | Type | Code | Sequence # | +--------+--------+----------------+ | Length | IP Hdr Len | +-----------------+----------------+ | IP HEADER | | | +----------------------------------+ | ICMP MESSAGE LENGTH | +----------------------------------+ | ICMP DATA | | | +----------------------------------+
Field Summary | |
static byte |
CODE
The class code |
private byte[] |
m_icmp
|
private int |
m_icmpLen
|
private byte[] |
m_ipHeader
|
static byte |
TYPE
The class type. |
Fields inherited from class org.opennms.protocols.icmpd.MessageHeader |
m_code, m_length, m_reserved, m_sequence, m_type, sm_seq, TYPE_CONTROL, TYPE_DATA |
Constructor Summary | |
|
DataRecvMessage()
Constructs a default message with a blank IP header and no data. |
|
DataRecvMessage(byte[] header,
byte[] icmp)
Constructs a new received message with the specified header and icmp data. |
(package private) |
DataRecvMessage(MessageHeader hdr,
InputStream istream)
Constructs a new data recevied object with the specified header and reads the remaining information from the input stream. |
Method Summary | |
private void |
calculateLength()
calcuates the length of the packet based on the encapsulate data. |
byte[] |
getICMPData()
Returns the array of bytes that is the ICMP message. |
int |
getICMPLength()
Returns the length of valid data in the ICMP byte array. |
byte[] |
getIPHeader()
Returns the array of information that is the IP header. |
int |
getIPHeaderLength()
Returns the true length of the IP header |
void |
setICMPData(byte[] buf)
Sets the current ICMP data encapsulated within the object equal to the passed data. |
void |
setIPHeader(byte[] buf)
Sets the IP Header data. |
(package private) void |
write(OutputStream ostream)
Writes the object to the output stream in a format that can be read by the ICMP daemon. |
Methods inherited from class org.opennms.protocols.icmpd.MessageHeader |
align4, getCode, getLength, getSequence, getType, makeInt, makeShort, nextSequenceId, read, setSequence |
Methods inherited from class java.lang.Object |
|
Field Detail |
private byte[] m_ipHeader
private byte[] m_icmp
private int m_icmpLen
public static final byte TYPE
public static final byte CODE
Constructor Detail |
public DataRecvMessage()
DataRecvMessage(MessageHeader hdr, InputStream istream) throws IOException
hdr
- The header to use in this messageistream
- The input stream to get the rest of data.IOException
- Thrown if an error occurs reading from
the stream.IllegalArgumentException
- Thrown if the type or code
in the passed header are not correct.public DataRecvMessage(byte[] header, byte[] icmp)
header
- The IP header dataicmp
- The ICMP dataMethod Detail |
public int getIPHeaderLength()
public byte[] getIPHeader()
getIPHeaderLength()
public void setIPHeader(byte[] buf)
buf
- The IP Header data.public int getICMPLength()
getICMPData()
public byte[] getICMPData()
getICMPLength()
public void setICMPData(byte[] buf)
buf
- The icmp message.private void calculateLength()
void write(OutputStream ostream) throws IOException
write
in class MessageHeader
ostream
- The output streamIOException
- Thrown if an error occurs with the
output stream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |