net.floodlightcontroller.packet
Class TCP

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

public class TCP
extends BasePacket

Author:
shudong.zhou@bigswitch.com

Field Summary
protected  int acknowledge
           
protected  short checksum
           
protected  byte dataOffset
           
protected  short destinationPort
           
protected  short flags
           
protected  byte[] options
           
protected  int sequence
           
protected  short sourcePort
           
protected  short urgentPointer
           
protected  short windowSize
           
 
Fields inherited from class net.floodlightcontroller.packet.BasePacket
log, parent, payload
 
Constructor Summary
TCP()
           
 
Method Summary
 IPacket deserialize(byte[] data, int offset, int length)
          Deserializes this packet layer and all possible payloads
 boolean equals(java.lang.Object obj)
           
 int getAcknowledge()
           
 short getChecksum()
           
 byte getDataOffset()
           
 short getDestinationPort()
           
 short getFlags()
           
 byte[] getOptions()
           
 int getSequence()
           
 short getSourcePort()
           
 short getTcpChecksum()
           
 short getUrgentPointer(short urgentPointer)
           
 short getWindowSize()
           
 int hashCode()
           
 void resetChecksum()
          Reset any checksums as needed, and call resetChecksum on all parents
 byte[] serialize()
          Serializes the packet.
 TCP setAcknowledge(int ack)
           
 TCP setChecksum(short checksum)
           
 TCP setDataOffset(byte offset)
           
 TCP setDestinationPort(short destinationPort)
           
 TCP setFlags(short flags)
           
 TCP setOptions(byte[] options)
           
 TCP setSequence(int seq)
           
 TCP setSourcePort(short sourcePort)
           
 TCP setTcpChecksum(short checksum)
           
 TCP setUrgentPointer(short urgentPointer)
           
 TCP setWindowSize(short windowSize)
           
 
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

sourcePort

protected short sourcePort

destinationPort

protected short destinationPort

sequence

protected int sequence

acknowledge

protected int acknowledge

dataOffset

protected byte dataOffset

flags

protected short flags

windowSize

protected short windowSize

checksum

protected short checksum

urgentPointer

protected short urgentPointer

options

protected byte[] options
Constructor Detail

TCP

public TCP()
Method Detail

getSourcePort

public short getSourcePort()
Returns:
the sourcePort

setSourcePort

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

getDestinationPort

public short getDestinationPort()
Returns:
the destinationPort

setDestinationPort

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

getChecksum

public short getChecksum()
Returns:
the checksum

getSequence

public int getSequence()

setSequence

public TCP setSequence(int seq)

getAcknowledge

public int getAcknowledge()

setAcknowledge

public TCP setAcknowledge(int ack)

getDataOffset

public byte getDataOffset()

setDataOffset

public TCP setDataOffset(byte offset)

getFlags

public short getFlags()

setFlags

public TCP setFlags(short flags)

getWindowSize

public short getWindowSize()

setWindowSize

public TCP setWindowSize(short windowSize)

getTcpChecksum

public short getTcpChecksum()

setTcpChecksum

public TCP setTcpChecksum(short checksum)

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

getUrgentPointer

public short getUrgentPointer(short urgentPointer)

setUrgentPointer

public TCP setUrgentPointer(short urgentPointer)

getOptions

public byte[] getOptions()

setOptions

public TCP setOptions(byte[] options)

setChecksum

public TCP setChecksum(short checksum)
Parameters:
checksum - the checksum to set

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