net.clackrouter.packets
Class VNSICMPPacket
java.lang.Object
net.clackrouter.protocol.data.VNSData
net.clackrouter.packets.VNSPacket
net.clackrouter.packets.VNSICMPPacket
public final class VNSICMPPacket
- extends VNSPacket
Encapsulates Internet Control Message Protocol packet. Defined in RFC 792.
Constructor Summary |
protected |
VNSICMPPacket()
|
|
VNSICMPPacket(java.nio.ByteBuffer packetBuffer)
Constructs an IMCP packet from the supplied byte buffer. |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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
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()
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