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 shortchecksumprotected intdestinationPortstatic intDHCP_CLIENT_PORTstatic intDHCP_SERVER_PORTstatic intDHCP_V6_CLIENT_PORTstatic intDHCP_V6_SERVER_PORTprotected shortlengthstatic Map<Integer,Deserializer<? extends IPacket>>PORT_DESERIALIZER_MAPstatic intRIP_PORTstatic intRIPNG_PORTprotected intsourcePortstatic intVXLAN_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.booleanequals(Object obj)shortgetChecksum()intgetDestinationPort()shortgetLength()intgetSourcePort()inthashCode()voidresetChecksum()Reset any checksum as needed, and call resetChecksum on all parents.byte[]serialize()Serializes the packet.UDPsetChecksum(short checksum)UDPsetDestinationPort(int destinationPort)UDPsetSourcePort(int sourcePort)StringtoString()- 
Methods inherited from class org.onlab.packet.BasePacket
clone, getParent, getPayload, setParent, setPayload 
 - 
 
 - 
 
- 
- 
Field Detail
- 
PORT_DESERIALIZER_MAP
public static final Map<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:IPacketReset any checksum as needed, and call resetChecksum on all parents.- Specified by:
 resetChecksumin interfaceIPacket- Overrides:
 resetChecksumin 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:
 hashCodein classBasePacket
 
- 
equals
public boolean equals(Object obj)
- Overrides:
 equalsin classBasePacket
 
- 
deserializer
public static Deserializer<UDP> deserializer()
Deserializer function for UDP packets.- Returns:
 - deserializer function
 
 
 - 
 
 -