Package org.onlab.packet
Class UDP
- java.lang.Object
-
- org.onlab.packet.BasePacket
-
- org.onlab.packet.UDP
-
- All Implemented Interfaces:
IPacket
public class UDP extends BasePacket
Representation of a UDP packet.
-
-
Field Summary
Fields Modifier and Type Field Description protected short
checksum
protected int
destinationPort
static int
DHCP_CLIENT_PORT
static int
DHCP_SERVER_PORT
static int
DHCP_V6_CLIENT_PORT
static int
DHCP_V6_SERVER_PORT
protected short
length
static java.util.Map<java.lang.Integer,Deserializer<? extends IPacket>>
PORT_DESERIALIZER_MAP
static int
RIP_PORT
static int
RIPNG_PORT
protected int
sourcePort
static int
VXLAN_UDP_PORT
-
Fields inherited from class org.onlab.packet.BasePacket
parent, payload
-
-
Constructor Summary
Constructors Constructor Description UDP()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Deserializer<UDP>
deserializer()
Deserializer function for UDP packets.boolean
equals(java.lang.Object obj)
short
getChecksum()
int
getDestinationPort()
short
getLength()
int
getSourcePort()
int
hashCode()
void
resetChecksum()
Reset any checksum as needed, and call resetChecksum on all parents.byte[]
serialize()
Serializes the packet.UDP
setChecksum(short checksum)
UDP
setDestinationPort(int destinationPort)
UDP
setSourcePort(int sourcePort)
java.lang.String
toString()
-
Methods inherited from class org.onlab.packet.BasePacket
clone, getParent, getPayload, setParent, setPayload
-
-
-
-
Field Detail
-
PORT_DESERIALIZER_MAP
public static final java.util.Map<java.lang.Integer,Deserializer<? extends IPacket>> PORT_DESERIALIZER_MAP
-
DHCP_SERVER_PORT
public static final int DHCP_SERVER_PORT
- See Also:
- Constant Field Values
-
DHCP_CLIENT_PORT
public static final int DHCP_CLIENT_PORT
- See Also:
- Constant Field Values
-
DHCP_V6_SERVER_PORT
public static final int DHCP_V6_SERVER_PORT
- See Also:
- Constant Field Values
-
DHCP_V6_CLIENT_PORT
public static final int DHCP_V6_CLIENT_PORT
- See Also:
- Constant Field Values
-
VXLAN_UDP_PORT
public static final int VXLAN_UDP_PORT
- See Also:
- Constant Field Values
-
RIP_PORT
public static final int RIP_PORT
- See Also:
- Constant Field Values
-
RIPNG_PORT
public static final int RIPNG_PORT
- See Also:
- Constant Field Values
-
sourcePort
protected int sourcePort
-
destinationPort
protected int destinationPort
-
length
protected short length
-
checksum
protected short checksum
-
-
Method Detail
-
getSourcePort
public int getSourcePort()
- Returns:
- the sourcePort
-
setSourcePort
public UDP setSourcePort(int sourcePort)
- Parameters:
sourcePort
- the sourcePort to set (16 bits unsigned integer)- Returns:
- this
-
getDestinationPort
public int getDestinationPort()
- Returns:
- the destinationPort
-
setDestinationPort
public UDP setDestinationPort(int destinationPort)
- Parameters:
destinationPort
- the destinationPort to set (16 bits unsigned integer)- Returns:
- this
-
getLength
public short getLength()
- Returns:
- the length
-
getChecksum
public short getChecksum()
- Returns:
- the checksum
-
setChecksum
public UDP setChecksum(short checksum)
- Parameters:
checksum
- the checksum to set- Returns:
- this
-
resetChecksum
public void resetChecksum()
Description copied from interface:IPacket
Reset any checksum as needed, and call resetChecksum on all parents.- Specified by:
resetChecksum
in interfaceIPacket
- Overrides:
resetChecksum
in classBasePacket
-
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(java.lang.Object obj)
- Overrides:
equals
in classBasePacket
-
deserializer
public static Deserializer<UDP> deserializer()
Deserializer function for UDP packets.- Returns:
- deserializer function
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-