net.floodlightcontroller.packet
Class ICMP

java.lang.Object
  extended by net.floodlightcontroller.packet.BasePacket
      extended by net.floodlightcontroller.packet.ICMP
All Implemented Interfaces:
IPacket

public class ICMP
extends BasePacket

Implements ICMP packet format

Author:
shudong.zhou@bigswitch.com

Field Summary
protected  short checksum
           
static byte CODE_PORT_UNREACHABLE
           
static byte DESTINATION_UNREACHABLE
           
static byte ECHO_REPLY
           
static byte ECHO_REQUEST
           
protected  byte icmpCode
           
protected  byte icmpType
           
static java.util.Map<java.lang.Byte,java.lang.Short> paddingMap
           
static byte TIME_EXCEEDED
           
 
Fields inherited from class net.floodlightcontroller.packet.BasePacket
log, parent, payload
 
Constructor Summary
ICMP()
           
 
Method Summary
 IPacket deserialize(byte[] data, int offset, int length)
          Deserializes this packet layer and all possible payloads
 boolean equals(java.lang.Object obj)
           
 short getChecksum()
           
 byte getIcmpCode()
           
 byte getIcmpType()
           
 int hashCode()
           
 byte[] serialize()
          Serializes the packet.
 ICMP setChecksum(short checksum)
           
 ICMP setIcmpCode(byte icmpCode)
           
 ICMP setIcmpType(byte icmpType)
           
 
Methods inherited from class net.floodlightcontroller.packet.BasePacket
clone, getParent, getPayload, resetChecksum, setParent, setPayload
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

icmpType

protected byte icmpType

icmpCode

protected byte icmpCode

checksum

protected short checksum

paddingMap

public static final java.util.Map<java.lang.Byte,java.lang.Short> paddingMap

ECHO_REPLY

public static final byte ECHO_REPLY
See Also:
Constant Field Values

ECHO_REQUEST

public static final byte ECHO_REQUEST
See Also:
Constant Field Values

TIME_EXCEEDED

public static final byte TIME_EXCEEDED
See Also:
Constant Field Values

DESTINATION_UNREACHABLE

public static final byte DESTINATION_UNREACHABLE
See Also:
Constant Field Values

CODE_PORT_UNREACHABLE

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

ICMP

public ICMP()
Method Detail

getIcmpType

public byte getIcmpType()
Returns:
the icmpType

setIcmpType

public ICMP setIcmpType(byte icmpType)
Parameters:
icmpType - to set

getIcmpCode

public byte getIcmpCode()
Returns:
the icmp code

setIcmpCode

public ICMP setIcmpCode(byte icmpCode)
Parameters:
icmpCode - code to set

getChecksum

public short getChecksum()
Returns:
the checksum

setChecksum

public ICMP setChecksum(short checksum)
Parameters:
checksum - the checksum to set

serialize

public byte[] serialize()
Serializes the packet. Will compute and set the following fields if they are set to specific values at the time serialize is called: -checksum : 0 -length : 0

Returns:
a byte[] containing this packet and payloads

hashCode

public int hashCode()
Overrides:
hashCode in class BasePacket

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class BasePacket

deserialize

public IPacket deserialize(byte[] data,
                           int offset,
                           int length)
                    throws PacketParsingException
Description copied from interface: IPacket
Deserializes this packet layer and all possible payloads

offset - offset to start deserializing from
length - length of the data to deserialize
Returns:
the deserialized data
Throws:
PacketParsingException