org.openflow.protocol
Class OFPacketOut

java.lang.Object
  extended by org.openflow.protocol.OFMessage
      extended by org.openflow.protocol.OFPacketOut
All Implemented Interfaces:
OFActionFactoryAware

public class OFPacketOut
extends OFMessage
implements OFActionFactoryAware

Represents an ofp_packet_out message

Author:
David Erickson (daviderickson@cs.stanford.edu) - Mar 12, 2010

Field Summary
protected  OFActionFactory actionFactory
           
protected  java.util.List<OFAction> actions
           
protected  short actionsLength
           
static int BUFFER_ID_NONE
           
protected  int bufferId
           
protected  int inPort
           
static int MINIMUM_LENGTH
           
protected  byte[] packetData
           
 
Fields inherited from class org.openflow.protocol.OFMessage
length, OFP_VERSION, type, version, xid
 
Constructor Summary
OFPacketOut()
           
OFPacketOut(byte[] packetData, java.util.List<OFAction> actions, int bufferId)
          Creates a OFPacketOut object with the packet's data, actions, and bufferId
 
Method Summary
 void computeLength()
          This method is called during the writeTo method for serialization and is expected to set the length of the message.
 boolean equals(java.lang.Object obj)
           
 java.util.List<OFAction> getActions()
          Returns the actions contained in this message
 short getActionsLength()
          Get actions_len
 int getActionsLengthU()
          Get actions_len, unsigned
 int getBufferId()
          Get buffer_id
 int getInPort()
          Get in_port
 byte[] getPacketData()
          Returns the packet data
 int hashCode()
           
 void readFrom(java.nio.ByteBuffer data)
          Read this message off the wire from the specified ByteBuffer
 void setActionFactory(OFActionFactory actionFactory)
          Sets the OFActionFactory
 OFPacketOut setActions(java.util.List<OFAction> actions)
          Sets the list of actions on this message
 OFPacketOut setActionsLength(short actionsLength)
          Set actions_len
 OFPacketOut setBufferId(int bufferId)
          Set buffer_id
 OFPacketOut setInPort(int i)
          Set in_port
 OFPacketOut setInPort(OFPort inPort)
          Set in_port.
 OFPacketOut setPacketData(byte[] packetData)
          Sets the packet data
 java.lang.String toString()
          Returns a summary of the message
 void writeTo(java.nio.ByteBuffer data)
          Write this message's binary format to the specified ByteBuffer
 
Methods inherited from class org.openflow.protocol.OFMessage
getLength, getLengthU, getType, getVersion, getXid, setLength, setLengthU, setType, setVersion, setXid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MINIMUM_LENGTH

public static int MINIMUM_LENGTH

BUFFER_ID_NONE

public static int BUFFER_ID_NONE

actionFactory

protected OFActionFactory actionFactory

bufferId

protected int bufferId

inPort

protected int inPort

actionsLength

protected short actionsLength

actions

protected java.util.List<OFAction> actions

packetData

protected byte[] packetData
Constructor Detail

OFPacketOut

public OFPacketOut()

OFPacketOut

public OFPacketOut(byte[] packetData,
                   java.util.List<OFAction> actions,
                   int bufferId)
Creates a OFPacketOut object with the packet's data, actions, and bufferId

Parameters:
packetData - the packet data
actions - actions to apply to the packet
bufferId - the buffer id
Method Detail

getBufferId

public int getBufferId()
Get buffer_id

Returns:

setBufferId

public OFPacketOut setBufferId(int bufferId)
Set buffer_id

Parameters:
bufferId -

getPacketData

public byte[] getPacketData()
Returns the packet data

Returns:

setPacketData

public OFPacketOut setPacketData(byte[] packetData)
Sets the packet data

Parameters:
packetData -

getInPort

public int getInPort()
Get in_port

Returns:

setInPort

public OFPacketOut setInPort(int i)
Set in_port

Parameters:
i -

setInPort

public OFPacketOut setInPort(OFPort inPort)
Set in_port. Convenience method using OFPort enum.

Parameters:
inPort -

getActionsLength

public short getActionsLength()
Get actions_len

Returns:

getActionsLengthU

public int getActionsLengthU()
Get actions_len, unsigned

Returns:

setActionsLength

public OFPacketOut setActionsLength(short actionsLength)
Set actions_len

Parameters:
actionsLength -

getActions

public java.util.List<OFAction> getActions()
Returns the actions contained in this message

Returns:
a list of ordered OFAction objects

setActions

public OFPacketOut setActions(java.util.List<OFAction> actions)
Sets the list of actions on this message

Parameters:
actions - a list of ordered OFAction objects

setActionFactory

public void setActionFactory(OFActionFactory actionFactory)
Description copied from interface: OFActionFactoryAware
Sets the OFActionFactory

Specified by:
setActionFactory in interface OFActionFactoryAware

readFrom

public void readFrom(java.nio.ByteBuffer data)
Description copied from class: OFMessage
Read this message off the wire from the specified ByteBuffer

Overrides:
readFrom in class OFMessage

writeTo

public void writeTo(java.nio.ByteBuffer data)
Description copied from class: OFMessage
Write this message's binary format to the specified ByteBuffer

Overrides:
writeTo in class OFMessage

hashCode

public int hashCode()
Overrides:
hashCode in class OFMessage

equals

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

toString

public java.lang.String toString()
Description copied from class: OFMessage
Returns a summary of the message

Overrides:
toString in class OFMessage
Returns:
"ofmsg=v=$version;t=$type:l=$len:xid=$xid"

computeLength

public void computeLength()
Description copied from class: OFMessage
This method is called during the writeTo method for serialization and is expected to set the length of the message. If your class manually sets the length you should override this to do nothing.

Overrides:
computeLength in class OFMessage