org.openflow.protocol
Class OFMessage

java.lang.Object
  extended by org.openflow.protocol.OFMessage
Direct Known Subclasses:
OFBarrierReply, OFBarrierRequest, OFEchoRequest, OFError, OFFeaturesReply, OFFeaturesRequest, OFFlowMod, OFFlowRemoved, OFGetConfigRequest, OFGroupMod, OFHello, OFMeterMod, OFPacketIn, OFPacketOut, OFPortMod, OFPortStatus, OFQueueGetConfigReply, OFQueueGetConfigRequest, OFRoleMessage, OFStatisticsMessageBase, OFSwitchConfig, OFTableMod, OFVendor

public class OFMessage
extends java.lang.Object

The base class for all OpenFlow protocol messages. This class contains the equivalent of the ofp_header which is present in all OpenFlow messages.

Author:
David Erickson (daviderickson@cs.stanford.edu) - Feb 3, 2010, Rob Sherwood (rob.sherwood@stanford.edu) - Feb 3, 2010

Field Summary
protected  short length
           
static int MINIMUM_LENGTH
           
static byte OFP_VERSION
           
protected  OFType type
           
protected  byte version
           
protected  int xid
           
 
Constructor Summary
OFMessage()
           
 
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)
           
 short getLength()
          Get the length of this message
 int getLengthU()
          Get the length of this message, unsigned
 OFType getType()
          Get the type of this message
 byte getVersion()
          Get the OpenFlow version of this message
 int getXid()
          Get the transaction id of this message
 int hashCode()
           
 void readFrom(java.nio.ByteBuffer data)
          Read this message off the wire from the specified ByteBuffer
 OFMessage setLength(short length)
          Set the length of this message
 OFMessage setLengthU(int length)
          Set the length of this message, unsigned
 OFMessage setType(OFType type)
          Set the type of this message
 OFMessage setVersion(byte version)
          Set the OpenFlow version of this message
 OFMessage setXid(int xid)
          Set the transaction id of this message
 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 java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

OFP_VERSION

public static byte OFP_VERSION

MINIMUM_LENGTH

public static int MINIMUM_LENGTH

version

protected byte version

type

protected OFType type

length

protected short length

xid

protected int xid
Constructor Detail

OFMessage

public OFMessage()
Method Detail

getLength

public short getLength()
Get the length of this message

Returns:

getLengthU

public int getLengthU()
Get the length of this message, unsigned

Returns:

setLength

public OFMessage setLength(short length)
Set the length of this message

Parameters:
length -

setLengthU

public OFMessage setLengthU(int length)
Set the length of this message, unsigned

Parameters:
length -

getType

public OFType getType()
Get the type of this message

Returns:

setType

public OFMessage setType(OFType type)
Set the type of this message

Parameters:
type -

getVersion

public byte getVersion()
Get the OpenFlow version of this message

Returns:

setVersion

public OFMessage setVersion(byte version)
Set the OpenFlow version of this message

Parameters:
version -

getXid

public int getXid()
Get the transaction id of this message

Returns:

setXid

public OFMessage setXid(int xid)
Set the transaction id of this message

Parameters:
xid -

readFrom

public void readFrom(java.nio.ByteBuffer data)
Read this message off the wire from the specified ByteBuffer

Parameters:
data -

writeTo

public void writeTo(java.nio.ByteBuffer data)
Write this message's binary format to the specified ByteBuffer

Parameters:
data -

computeLength

public void computeLength()
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.


toString

public java.lang.String toString()
Returns a summary of the message

Overrides:
toString in class java.lang.Object
Returns:
"ofmsg=v=$version;t=$type:l=$len:xid=$xid"

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

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