net.floodlightcontroller.packet
Class UDP

java.lang.Object
  extended by net.floodlightcontroller.packet.BasePacket
      extended by net.floodlightcontroller.packet.UDP
All Implemented Interfaces:
IPacket

public class UDP
extends BasePacket

Author:
David Erickson (daviderickson@cs.stanford.edu)

Field Summary
protected  short checksum
           
static java.util.Map<java.lang.Short,java.lang.Class<? extends IPacket>> decodeMap
           
protected  short destinationPort
           
static short DHCP_CLIENT_PORT
           
static short DHCP_SERVER_PORT
           
protected  short length
           
protected  short sourcePort
           
 
Fields inherited from class net.floodlightcontroller.packet.BasePacket
log, parent, payload
 
Constructor Summary
UDP()
           
 
Method Summary
 IPacket deserialize(byte[] data, int offset, int length)
          Deserializes this packet layer and all possible payloads
 boolean equals(java.lang.Object obj)
           
 short getChecksum()
           
 short getDestinationPort()
           
 short getLength()
           
 short getSourcePort()
           
 int hashCode()
           
 void resetChecksum()
          Reset any checksums as needed, and call resetChecksum on all parents
 byte[] serialize()
          Serializes the packet.
 UDP setChecksum(short checksum)
           
 UDP setDestinationPort(short destinationPort)
           
 UDP setSourcePort(short sourcePort)
           
 
Methods inherited from class net.floodlightcontroller.packet.BasePacket
clone, getParent, getPayload, setParent, setPayload
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decodeMap

public static java.util.Map<java.lang.Short,java.lang.Class<? extends IPacket>> decodeMap

DHCP_SERVER_PORT

public static short DHCP_SERVER_PORT

DHCP_CLIENT_PORT

public static short DHCP_CLIENT_PORT

sourcePort

protected short sourcePort

destinationPort

protected short destinationPort

length

protected short length

checksum

protected short checksum
Constructor Detail

UDP

public UDP()
Method Detail

getSourcePort

public short getSourcePort()
Returns:
the sourcePort

setSourcePort

public UDP setSourcePort(short sourcePort)
Parameters:
sourcePort - the sourcePort to set

getDestinationPort

public short getDestinationPort()
Returns:
the destinationPort

setDestinationPort

public UDP setDestinationPort(short destinationPort)
Parameters:
destinationPort - the destinationPort to set

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

resetChecksum

public void resetChecksum()
Description copied from interface: IPacket
Reset any checksums as needed, and call resetChecksum on all parents

Specified by:
resetChecksum in interface IPacket
Overrides:
resetChecksum in class BasePacket

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 class BasePacket

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class BasePacket

deserialize

public IPacket deserialize(byte[] data,
                           int offset,
                           int length)
                    throws PacketParsingException
Description copied from interface: IPacket
Deserializes this packet layer and all possible payloads

offset - offset to start deserializing from
length - length of the data to deserialize
Returns:
the deserialized data
Throws:
PacketParsingException