public abstract class OpenflowMessage extends AbstractMessage implements Message
length
Modifier and Type | Method and Description |
---|---|
static String |
decodeHeader(byte[] bytes)
A utility method that will attempt to decode the given bytes as an
openflow message header, and return a string representation of the
result.
|
MessageType |
getType()
Returns the message type.
|
ProtocolVersion |
getVersion()
Returns the protocol version of this OpenFlow structure.
|
long |
getXid()
Returns the transaction id of this message.
|
protected static String |
hex(int value)
Returns the given int as a string in hex form.
|
protected static String |
hex(long value)
Returns the given long as a string in hex form.
|
int |
length()
Gets the message length in bytes.
|
String |
toDebugString()
Returns a string representation useful for debugging.
|
String |
toString() |
void |
validate()
Validates this message for completeness and throws an exception
if the message is considered "not complete".
|
public ProtocolVersion getVersion()
Structure
getVersion
in interface Structure
public MessageType getType()
Message
public int length()
Message
length
in interface Message
length
in class AbstractMessage
public long getXid()
Message
public String toDebugString()
toString()
, but
subclasses are free to override this behavior.toDebugString
in interface Structure
public void validate() throws IncompleteMessageException
This default implementation does nothing, i.e. default behavior is that messages are considered complete.
Subclasses should override this method to check that mandatory fields or other internal state is present, throwing an exception if it is not.
IncompleteMessageException
- if the message is not completepublic static String decodeHeader(byte[] bytes)
bytes
- the bytes to decodeNullPointerException
- if bytes is nullIllegalArgumentException
- if the array is too shortprotected static String hex(long value)
value
- the valueprotected static String hex(int value)
value
- the valueCopyright © 2015. All Rights Reserved.