org.openflow.vendor.nicira
Class OFNiciraVendorData

java.lang.Object
  extended by org.openflow.vendor.nicira.OFNiciraVendorData
All Implemented Interfaces:
OFVendorData
Direct Known Subclasses:
OFRoleVendorData

public class OFNiciraVendorData
extends java.lang.Object
implements OFVendorData

Base class for vendor data corresponding to a Nicira vendor extension. Nicira vendor data always starts with a 4-byte integer data type value.

Author:
Rob Vaterlaus (rob.vaterlaus@bigswitch.com)

Field Summary
protected  int dataType
          The value of the integer data type at the beginning of the vendor data
static int NX_VENDOR_ID
           
 
Constructor Summary
OFNiciraVendorData()
          Construct empty (i.e.
OFNiciraVendorData(int dataType)
          Contruct Nicira vendor data with the specified data type
 
Method Summary
 int getDataType()
          Get the data type value at the beginning of the vendor data
 int getLength()
          Get the length of the vendor data.
 void readFrom(java.nio.ByteBuffer data, int length)
          Read the vendor data from the ByteBuffer
 void setDataType(int dataType)
          Set the data type value
 void writeTo(java.nio.ByteBuffer data)
          Write the vendor data to the ByteBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NX_VENDOR_ID

public static final int NX_VENDOR_ID
See Also:
Constant Field Values

dataType

protected int dataType
The value of the integer data type at the beginning of the vendor data

Constructor Detail

OFNiciraVendorData

public OFNiciraVendorData()
Construct empty (i.e. unspecified data type) Nicira vendor data.


OFNiciraVendorData

public OFNiciraVendorData(int dataType)
Contruct Nicira vendor data with the specified data type

Parameters:
dataType - the data type value at the beginning of the vendor data.
Method Detail

getDataType

public int getDataType()
Get the data type value at the beginning of the vendor data

Returns:
the integer data type value

setDataType

public void setDataType(int dataType)
Set the data type value

Parameters:
dataType - the integer data type value at the beginning of the vendor data.

getLength

public int getLength()
Get the length of the vendor data. This implementation will normally be the superclass for another class that will override this to return the overall vendor data length. This implementation just returns the length of the part that includes the 4-byte integer data type value at the beginning of the vendor data.

Specified by:
getLength in interface OFVendorData
Returns:
length of the data

readFrom

public void readFrom(java.nio.ByteBuffer data,
                     int length)
Read the vendor data from the ByteBuffer

Specified by:
readFrom in interface OFVendorData
Parameters:
data - the channel buffer from which we're deserializing
length - the length to the end of the enclosing message

writeTo

public void writeTo(java.nio.ByteBuffer data)
Write the vendor data to the ByteBuffer

Specified by:
writeTo in interface OFVendorData
Parameters:
data - the channel buffer to which we're serializing