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 SummaryFields Modifier and Type Field Description protected shortchecksumprotected intdestinationPortstatic intDHCP_CLIENT_PORTstatic intDHCP_SERVER_PORTstatic intDHCP_V6_CLIENT_PORTstatic intDHCP_V6_SERVER_PORTprotected shortlengthstatic java.util.Map<java.lang.Integer,Deserializer<? extends IPacket>>PORT_DESERIALIZER_MAPstatic intRIP_PORTstatic intRIPNG_PORTprotected intsourcePortstatic intVXLAN_UDP_PORT- 
Fields inherited from class org.onlab.packet.BasePacketparent, payload
 
- 
 - 
Constructor SummaryConstructors Constructor Description UDP()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Deserializer<UDP>deserializer()Deserializer function for UDP packets.booleanequals(java.lang.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)java.lang.StringtoString()- 
Methods inherited from class org.onlab.packet.BasePacketclone, getParent, getPayload, setParent, setPayload
 
- 
 
- 
- 
- 
Field Detail- 
PORT_DESERIALIZER_MAPpublic static final java.util.Map<java.lang.Integer,Deserializer<? extends IPacket>> PORT_DESERIALIZER_MAP 
 - 
DHCP_SERVER_PORTpublic static final int DHCP_SERVER_PORT - See Also:
- Constant Field Values
 
 - 
DHCP_CLIENT_PORTpublic static final int DHCP_CLIENT_PORT - See Also:
- Constant Field Values
 
 - 
DHCP_V6_SERVER_PORTpublic static final int DHCP_V6_SERVER_PORT - See Also:
- Constant Field Values
 
 - 
DHCP_V6_CLIENT_PORTpublic static final int DHCP_V6_CLIENT_PORT - See Also:
- Constant Field Values
 
 - 
VXLAN_UDP_PORTpublic static final int VXLAN_UDP_PORT - See Also:
- Constant Field Values
 
 - 
RIP_PORTpublic static final int RIP_PORT - See Also:
- Constant Field Values
 
 - 
RIPNG_PORTpublic static final int RIPNG_PORT - See Also:
- Constant Field Values
 
 - 
sourcePortprotected int sourcePort 
 - 
destinationPortprotected int destinationPort 
 - 
lengthprotected short length 
 - 
checksumprotected short checksum 
 
- 
 - 
Method Detail- 
getSourcePortpublic int getSourcePort() - Returns:
- the sourcePort
 
 - 
setSourcePortpublic UDP setSourcePort(int sourcePort) - Parameters:
- sourcePort- the sourcePort to set (16 bits unsigned integer)
- Returns:
- this
 
 - 
getDestinationPortpublic int getDestinationPort() - Returns:
- the destinationPort
 
 - 
setDestinationPortpublic UDP setDestinationPort(int destinationPort) - Parameters:
- destinationPort- the destinationPort to set (16 bits unsigned integer)
- Returns:
- this
 
 - 
getLengthpublic short getLength() - Returns:
- the length
 
 - 
getChecksumpublic short getChecksum() - Returns:
- the checksum
 
 - 
setChecksumpublic UDP setChecksum(short checksum) - Parameters:
- checksum- the checksum to set
- Returns:
- this
 
 - 
resetChecksumpublic void resetChecksum() Description copied from interface:IPacketReset any checksum as needed, and call resetChecksum on all parents.- Specified by:
- resetChecksumin interface- IPacket
- Overrides:
- resetChecksumin class- BasePacket
 
 - 
serializepublic 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
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- BasePacket
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- BasePacket
 
 - 
deserializerpublic static Deserializer<UDP> deserializer() Deserializer function for UDP packets.- Returns:
- deserializer function
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-