Package org.onlab.packet
Class ICMP
- java.lang.Object
-
- org.onlab.packet.BasePacket
-
- org.onlab.packet.ICMP
-
- All Implemented Interfaces:
IPacket
public class ICMP extends BasePacket
Implements ICMP packet format.
-
-
Field Summary
Fields Modifier and Type Field Description protected short
checksum
static byte
CODE_ECHO_REPLY
static byte
CODE_ECHO_REQEUST
static short
ICMP_HEADER_LENGTH
protected byte
icmpCode
protected byte
icmpType
static byte
TYPE_ECHO_REPLY
static byte
TYPE_ECHO_REQUEST
-
Fields inherited from class org.onlab.packet.BasePacket
parent, payload
-
-
Constructor Summary
Constructors Constructor Description ICMP()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Ethernet
buildIcmpReply(Ethernet ethRequest)
Builds an ICMP reply using the supplied ICMP request.static Deserializer<ICMP>
deserializer()
Deserializer function for ICMP packets.boolean
equals(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)
String
toString()
-
Methods inherited from class org.onlab.packet.BasePacket
clone, getParent, getPayload, resetChecksum, setParent, setPayload
-
-
-
-
Field Detail
-
icmpType
protected byte icmpType
-
icmpCode
protected byte icmpCode
-
checksum
protected short checksum
-
TYPE_ECHO_REQUEST
public static final byte TYPE_ECHO_REQUEST
- See Also:
- Constant Field Values
-
TYPE_ECHO_REPLY
public static final byte TYPE_ECHO_REPLY
- See Also:
- Constant Field Values
-
CODE_ECHO_REPLY
public static final byte CODE_ECHO_REPLY
- See Also:
- Constant Field Values
-
CODE_ECHO_REQEUST
public static final byte CODE_ECHO_REQEUST
- See Also:
- Constant Field Values
-
ICMP_HEADER_LENGTH
public static final short ICMP_HEADER_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getIcmpType
public byte getIcmpType()
- Returns:
- the icmpType
-
setIcmpType
public ICMP setIcmpType(byte icmpType)
- Parameters:
icmpType
- to set- Returns:
- this
-
getIcmpCode
public byte getIcmpCode()
- Returns:
- the icmp code
-
setIcmpCode
public ICMP setIcmpCode(byte icmpCode)
- Parameters:
icmpCode
- code to set- Returns:
- this
-
getChecksum
public short getChecksum()
- Returns:
- the checksum
-
setChecksum
public ICMP setChecksum(short checksum)
- Parameters:
checksum
- the checksum to set- Returns:
- this
-
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 classBasePacket
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classBasePacket
-
deserializer
public static Deserializer<ICMP> deserializer()
Deserializer function for ICMP packets.- Returns:
- deserializer function
-
-