|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.savarese.vserv.tcpip.IPPacket org.savarese.vserv.tcpip.ICMPPacket
ICMPPacket extends IPPacket
to handle ICMP packets. The ICMP
packet structure is described in
RFC 792.
Field Summary | |
static int |
OFFSET_CODE
Offset into the ICMP packet of the code header value. |
static int |
OFFSET_ICMP_CHECKSUM
Offset into the ICMP packet of the ICMP checksum. |
static int |
OFFSET_IDENTIFIER
Offset into the ICMP packet of the identifier header value. |
static int |
OFFSET_SEQUENCE
Offset into the ICMP packet of the sequence number header value. |
static int |
OFFSET_TYPE
Offset into the ICMP packet of the type header value. |
static int |
TYPE_ECHO_REPLY
The ICMP type number for an echo reply. |
static int |
TYPE_ECHO_REQUEST
The ICMP type number for an echo request. |
Fields inherited from class org.savarese.vserv.tcpip.IPPacket |
_data_, LENGTH_DESTINATION_ADDRESS, LENGTH_SOURCE_ADDRESS, OFFSET_DESTINATION_ADDRESS, OFFSET_FLAGS, OFFSET_IDENTIFICATION, OFFSET_IP_CHECKSUM, OFFSET_PROTOCOL, OFFSET_SOURCE_ADDRESS, OFFSET_TOTAL_LENGTH, OFFSET_TTL, OFFSET_TYPE_OF_SERVICE, PROTOCOL_ICMP, PROTOCOL_IP, PROTOCOL_TCP, PROTOCOL_UDP |
Constructor Summary | |
ICMPPacket(ICMPPacket packet)
Creates a new ICMP packet that is a copy of a given packet. |
|
ICMPPacket(int size)
Creates a new ICMP packet of a given size. |
Method Summary | |
int |
computeICMPChecksum()
Same as computeICMPChecksum(true); |
int |
computeICMPChecksum(boolean update)
Computes the ICMP checksum, optionally updating the ICMP checksum header. |
void |
copyData(ICMPPacket packet)
Copies the contents of an ICMPPacket. |
int |
getCode()
|
int |
getCombinedHeaderByteLength()
|
int |
getICMPChecksum()
|
int |
getICMPDataByteLength()
|
abstract int |
getICMPHeaderByteLength()
|
int |
getICMPPacketByteLength()
|
int |
getType()
|
void |
setCode(int code)
Sets the ICMP code header field. |
void |
setData(byte[] data)
Sets the raw packet byte array. |
void |
setICMPDataByteLength(int length)
Sets the length of the ICMP data payload. |
void |
setIPHeaderLength(int length)
Sets the IP header length field. |
void |
setType(int type)
Sets the ICMP type header field. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int OFFSET_TYPE
public static final int OFFSET_CODE
public static final int OFFSET_ICMP_CHECKSUM
public static final int OFFSET_IDENTIFIER
public static final int OFFSET_SEQUENCE
public static final int TYPE_ECHO_REQUEST
public static final int TYPE_ECHO_REPLY
Constructor Detail |
public ICMPPacket(int size)
size
- The number of bytes in the packet.public ICMPPacket(ICMPPacket packet)
packet
- The packet to replicate.Method Detail |
public abstract int getICMPHeaderByteLength()
public void setIPHeaderLength(int length)
IPPacket
setIPHeaderLength
in class IPPacket
length
- The length of the IP header in 32-bit words.public final int getCombinedHeaderByteLength()
public final void setICMPDataByteLength(int length)
length
- The length of the ICMP data payload in bytes.public final int getICMPDataByteLength()
public final int getICMPPacketByteLength()
public final void copyData(ICMPPacket packet)
packet
- The TCPPacket to copy.public void setData(byte[] data)
IPPacket
setData
in class IPPacket
data
- The raw packet byte array to wrap.public final void setType(int type)
type
- The new type.public final int getType()
public final void setCode(int code)
code
- The new type.public final int getCode()
public final int getICMPChecksum()
public final int computeICMPChecksum(boolean update)
update
- Specifies whether or not to update the ICMP checksum
header after computing the checksum. A value of true indicates
the header should be updated, a value of false indicates it
should not be updated.
public final int computeICMPChecksum()
computeICMPChecksum(true);
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |