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 shortchecksumstatic byteCODE_ECHO_REPLYstatic byteCODE_ECHO_REQEUSTstatic shortICMP_HEADER_LENGTHprotected byteicmpCodeprotected byteicmpTypestatic byteTYPE_ECHO_REPLYstatic byteTYPE_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 EthernetbuildIcmpReply(Ethernet ethRequest)Builds an ICMP reply using the supplied ICMP request.static Deserializer<ICMP>deserializer()Deserializer function for ICMP packets.booleanequals(java.lang.Object obj)shortgetChecksum()bytegetIcmpCode()bytegetIcmpType()inthashCode()byte[]serialize()Serializes the packet.ICMPsetChecksum(short checksum)ICMPsetIcmpCode(byte icmpCode)ICMPsetIcmpType(byte icmpType)java.lang.StringtoString()-
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:
hashCodein classBasePacket
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classBasePacket
-
deserializer
public static Deserializer<ICMP> deserializer()
Deserializer function for ICMP packets.- Returns:
- deserializer function
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-