org.openflow.vendor.nicira
Class OFRoleVendorData

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

public class OFRoleVendorData
extends OFNiciraVendorData

Class that represents the vendor data in the role request extension implemented by Open vSwitch to support high availability.

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

Field Summary
static int NX_ROLE_MASTER
          Role value indicating that the controller is in the MASTER role.
static int NX_ROLE_OTHER
          Role value indicating that the controller is in the OTHER role.
static int NX_ROLE_SLAVE
          Role value indicating that the controller is in the SLAVE role.
protected  int role
           
 
Fields inherited from class org.openflow.vendor.nicira.OFNiciraVendorData
dataType, NX_VENDOR_ID
 
Constructor Summary
OFRoleVendorData()
          Construct an uninitialized OFRoleVendorData
OFRoleVendorData(int dataType)
          Construct an OFRoleVendorData with the specified data type (i.e.
OFRoleVendorData(int dataType, int role)
          Construct an OFRoleVendorData with the specified data type (i.e.
 
Method Summary
 int getLength()
          Get the length of the vendor data.
 int getRole()
           
 void readFrom(java.nio.ByteBuffer data, int length)
          Read the role vendor data from the ByteBuffer
 void setRole(int role)
           
 void writeTo(java.nio.ByteBuffer data)
          Write the role vendor data to the ByteBuffer
 
Methods inherited from class org.openflow.vendor.nicira.OFNiciraVendorData
getDataType, setDataType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NX_ROLE_OTHER

public static final int NX_ROLE_OTHER
Role value indicating that the controller is in the OTHER role.

See Also:
Constant Field Values

NX_ROLE_MASTER

public static final int NX_ROLE_MASTER
Role value indicating that the controller is in the MASTER role.

See Also:
Constant Field Values

NX_ROLE_SLAVE

public static final int NX_ROLE_SLAVE
Role value indicating that the controller is in the SLAVE role.

See Also:
Constant Field Values

role

protected int role
Constructor Detail

OFRoleVendorData

public OFRoleVendorData()
Construct an uninitialized OFRoleVendorData


OFRoleVendorData

public OFRoleVendorData(int dataType)
Construct an OFRoleVendorData with the specified data type (i.e. either request or reply) and an unspecified role.

Parameters:
dataType -

OFRoleVendorData

public OFRoleVendorData(int dataType,
                        int role)
Construct an OFRoleVendorData with the specified data type (i.e. either request or reply) and role (i.e. one of of master, slave, or other).

Parameters:
dataType - either role request or role reply data type
Method Detail

getRole

public int getRole()
Returns:
the role value of the role vendor data

setRole

public void setRole(int role)
Parameters:
role - the role value of the role vendor data

getLength

public int getLength()
Description copied from class: OFNiciraVendorData
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
Overrides:
getLength in class OFNiciraVendorData
Returns:
the total length of the role vendor data

readFrom

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

Specified by:
readFrom in interface OFVendorData
Overrides:
readFrom in class OFNiciraVendorData
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 role vendor data to the ByteBuffer

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