net.sourceforge.jpcap.net
Class ICMPPacket

java.lang.Object
  extended bynet.sourceforge.jpcap.net.Packet
      extended bynet.sourceforge.jpcap.net.EthernetPacket
          extended bynet.sourceforge.jpcap.net.IPPacket
              extended bynet.sourceforge.jpcap.net.ICMPPacket
All Implemented Interfaces:
EthernetFields, ICMPFields, IPFields, java.io.Serializable

public class ICMPPacket
extends IPPacket
implements ICMPFields, java.io.Serializable

An ICMP packet.

Extends an IP packet, adding an ICMP header and ICMP data payload.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class net.sourceforge.jpcap.net.IPPacket
IPPacket.TestProbe
 
Field Summary
 
Fields inherited from class net.sourceforge.jpcap.net.IPPacket
_ipOffset
 
Fields inherited from class net.sourceforge.jpcap.net.EthernetPacket
_bytes, _ethOffset
 
Fields inherited from interface net.sourceforge.jpcap.net.ICMPFields
ICMP_CODE_LEN, ICMP_CODE_POS, ICMP_CSUM_LEN, ICMP_CSUM_POS, ICMP_HEADER_LEN, ICMP_SUBC_LEN, ICMP_SUBC_POS
 
Fields inherited from interface net.sourceforge.jpcap.net.IPFields
IP_CODE_LEN, IP_CODE_POS, IP_CSUM_LEN, IP_CSUM_POS, IP_DST_POS, IP_FRAG_LEN, IP_FRAG_POS, IP_HEADER_LEN, IP_ID_LEN, IP_ID_POS, IP_LEN_LEN, IP_LEN_POS, IP_SRC_POS, IP_TOS_LEN, IP_TOS_POS, IP_TTL_LEN, IP_TTL_POS, IP_VER_LEN, IP_VER_POS
 
Fields inherited from interface net.sourceforge.jpcap.net.EthernetFields
ETH_CODE_LEN, ETH_CODE_POS, ETH_DST_POS, ETH_HEADER_LEN, ETH_SRC_POS
 
Constructor Summary
ICMPPacket(int lLen, byte[] bytes)
           
 
Method Summary
 int getChecksum()
          Fetch the ICMP header checksum.
 java.lang.String getColor()
          Fetch ascii escape sequence of the color associated with this packet type.
 byte[] getData()
          Fetch the ICMP data as a byte array.
 byte[] getHeader()
          Fetch the ICMP header as a byte array.
 int getICMPChecksum()
          Fetch the ICMP header checksum.
 byte[] getICMPData()
          Fetch the ICMP data as a byte array.
 byte[] getICMPHeader()
          Fetch the ICMP header a byte array.
 int getMessageCode()
          Fetch the ICMP message type, including subcode.
 int getMessageMajorCode()
          Fetch the ICMP message type code.
 int getMessageMinorCode()
          Fetch the ICMP message subcode.
 int getMessageType()
          For backward compatibility.
 java.lang.String toColoredString(boolean colored)
          Generate string with contents describing this ICMP packet.
 java.lang.String toString()
          Convert this ICMP packet to a readable string.
 
Methods inherited from class net.sourceforge.jpcap.net.IPPacket
computeReceiverChecksum, computeReceiverIPChecksum, computeSenderChecksum, computeSenderIPChecksum, getDestinationAddress, getDestinationAddressAsLong, getDestinationAddressBytes, getFragmentFlags, getFragmentOffset, getHeaderLength, getId, getIPChecksum, getIPData, getIPHeader, getIpHeaderLength, getIPHeaderLength, getIPProtocol, getLength, getProtocol, getSourceAddress, getSourceAddressAsLong, getSourceAddressBytes, getTimeToLive, getTypeOfService, getVersion, isValidChecksum, isValidIPChecksum, onesCompSum, toColoredVerboseString
 
Methods inherited from class net.sourceforge.jpcap.net.EthernetPacket
getDestinationHwAddress, getEthernetData, getEthernetHeader, getEthernetHeaderLength, getEthernetProtocol, getSourceHwAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ICMPPacket

public ICMPPacket(int lLen,
                  byte[] bytes)
Method Detail

getICMPHeader

public byte[] getICMPHeader()
Fetch the ICMP header a byte array.


getHeader

public byte[] getHeader()
Fetch the ICMP header as a byte array.

Overrides:
getHeader in class IPPacket

getICMPData

public byte[] getICMPData()
Fetch the ICMP data as a byte array.


getData

public byte[] getData()
Fetch the ICMP data as a byte array.

Overrides:
getData in class IPPacket

getMessageCode

public int getMessageCode()
Fetch the ICMP message type, including subcode. Return value can be used with ICMPMessage.getDescription().

Returns:
a 2-byte value containing the message type in the high byte and the message type subcode in the low byte.

getMessageMajorCode

public int getMessageMajorCode()
Fetch the ICMP message type code. Formerly .getMessageType().


getMessageType

public int getMessageType()
For backward compatibility. @deprecated use getMessageMajorCode().


getMessageMinorCode

public int getMessageMinorCode()
Fetch the ICMP message subcode.


getChecksum

public int getChecksum()
Fetch the ICMP header checksum.

Overrides:
getChecksum in class IPPacket

getICMPChecksum

public int getICMPChecksum()
Fetch the ICMP header checksum.


toString

public java.lang.String toString()
Convert this ICMP packet to a readable string.

Overrides:
toString in class IPPacket

toColoredString

public java.lang.String toColoredString(boolean colored)
Generate string with contents describing this ICMP packet.

Overrides:
toColoredString in class IPPacket
Parameters:
colored - whether or not the string should contain ansi color escape sequences.

getColor

public java.lang.String getColor()
Fetch ascii escape sequence of the color associated with this packet type.

Overrides:
getColor in class IPPacket