net.clackrouter.packets
Class VNSICMPPacket

java.lang.Object
  extended by net.clackrouter.protocol.data.VNSData
      extended by net.clackrouter.packets.VNSPacket
          extended by net.clackrouter.packets.VNSICMPPacket

public final class VNSICMPPacket
extends VNSPacket

Encapsulates Internet Control Message Protocol packet. Defined in RFC 792.


Field Summary
static byte PARAM_PROBLEM_CHECKSUM
           
static byte PARAM_PROBLEM_ID
           
static byte PARAM_PROBLEM_PROTOCOL
           
static byte PARAM_PROBLEM_TOS
           
static byte PARAM_PROBLEM_TOTAL_LEN
           
static byte PARAM_PROBLEM_TTL
           
static byte PARAM_PROBLEM_VER_AND_IHL
           
 
Fields inherited from class net.clackrouter.packets.VNSPacket
m_inputInterfaceName, m_length, m_level2Type, m_local_packet, m_nextHopIPAddr, m_nextHopMacAddr, m_outputInterfaceName, m_packetByteBuffer, mParentHeader
 
Constructor Summary
protected VNSICMPPacket()
           
  VNSICMPPacket(java.nio.ByteBuffer packetBuffer)
          Constructs an IMCP packet from the supplied byte buffer.
 
Method Summary
 short calculateChecksum()
          Calculates the checksum of this ICMP packet.
 void constructByteBufferEcho(byte type, int identifier, int seq_num)
           
 VNSICMPCode getCode()
           
 byte[] getData()
          Returns any data from this ICMP packet
 VNSICMPType getType()
          Returns the type of the ICMP packet.
static java.awt.Point parseEcho(VNSICMPPacket icmp_packet)
           
 java.lang.String toString()
          Represents the ICMP packet in a readable format, by field.
static VNSICMPPacket wrapEcho(byte type, int identifier, int seq_num)
           
static VNSICMPPacket wrapEchoReply(VNSICMPPacket echo_request)
           
static VNSICMPPacket wrapParamProblem(VNSICMPCode code, IPPacket expired_packet, byte paramProblem)
           
static VNSICMPPacket wrapTimeExceeded(VNSICMPCode code, IPPacket expired_packet)
           
static VNSICMPPacket wrapUnreach(VNSICMPCode code, IPPacket bad_port_packet)
           
 
Methods inherited from class net.clackrouter.packets.VNSPacket
addToPath, get16bit, get32bit, getByteBuffer, getInputInterfaceName, getLength, getLevel2Type, getNextHopIPAddress, getNextHopMacAddress, getOutputInterfaceName, getParentHeader, getStringBuffer, isPacket, needsSourceAddress, setByteBuffer, setInputInterfaceName, setLevel2Type, setNeedsSourceAddress, setNextHopIPAddress, setNextHopMacAddress, setOutputInterfaceName, setParentHeader
 
Methods inherited from class net.clackrouter.protocol.data.VNSData
isBanner, isClose, isHWInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAM_PROBLEM_VER_AND_IHL

public static final byte PARAM_PROBLEM_VER_AND_IHL
See Also:
Constant Field Values

PARAM_PROBLEM_TOS

public static final byte PARAM_PROBLEM_TOS
See Also:
Constant Field Values

PARAM_PROBLEM_TOTAL_LEN

public static final byte PARAM_PROBLEM_TOTAL_LEN
See Also:
Constant Field Values

PARAM_PROBLEM_ID

public static final byte PARAM_PROBLEM_ID
See Also:
Constant Field Values

PARAM_PROBLEM_TTL

public static final byte PARAM_PROBLEM_TTL
See Also:
Constant Field Values

PARAM_PROBLEM_PROTOCOL

public static final byte PARAM_PROBLEM_PROTOCOL
See Also:
Constant Field Values

PARAM_PROBLEM_CHECKSUM

public static final byte PARAM_PROBLEM_CHECKSUM
See Also:
Constant Field Values
Constructor Detail

VNSICMPPacket

public VNSICMPPacket(java.nio.ByteBuffer packetBuffer)
Constructs an IMCP packet from the supplied byte buffer.

Parameters:
packetBuffer - Byte buffer containing an ICMP packet

VNSICMPPacket

protected VNSICMPPacket()
Method Detail

wrapUnreach

public static VNSICMPPacket wrapUnreach(VNSICMPCode code,
                                        IPPacket bad_port_packet)
                                 throws VNSUnknownICMPCodeException
Throws:
VNSUnknownICMPCodeException

wrapTimeExceeded

public static VNSICMPPacket wrapTimeExceeded(VNSICMPCode code,
                                             IPPacket expired_packet)
                                      throws VNSUnknownICMPCodeException
Throws:
VNSUnknownICMPCodeException

wrapParamProblem

public static VNSICMPPacket wrapParamProblem(VNSICMPCode code,
                                             IPPacket expired_packet,
                                             byte paramProblem)
                                      throws VNSUnknownICMPCodeException
Throws:
VNSUnknownICMPCodeException

wrapEchoReply

public static VNSICMPPacket wrapEchoReply(VNSICMPPacket echo_request)

parseEcho

public static java.awt.Point parseEcho(VNSICMPPacket icmp_packet)

wrapEcho

public static VNSICMPPacket wrapEcho(byte type,
                                     int identifier,
                                     int seq_num)

constructByteBufferEcho

public void constructByteBufferEcho(byte type,
                                    int identifier,
                                    int seq_num)

calculateChecksum

public short calculateChecksum()
Calculates the checksum of this ICMP packet. The checksum field is the 16 bit one's complement of the one's complement sum of all 16 bit words in the header. For purposes of computing the checksum, the value of the checksum field is zero.

Returns:
Checksum

getType

public VNSICMPType getType()
Returns the type of the ICMP packet.

Returns:
Type of the ICMP packet

getData

public byte[] getData()
Returns any data from this ICMP packet


getCode

public VNSICMPCode getCode()

toString

public java.lang.String toString()
Represents the ICMP packet in a readable format, by field.

Overrides:
toString in class VNSPacket
Returns:
Interface information in a readable format, by field