|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openflow.protocol.OFMatch
public class OFMatch
Represents an ofp_match structure
Nested Class Summary | |
---|---|
static class |
OFMatch.OFMatchClass
|
Field Summary | |
---|---|
static short |
ETH_TYPE_ARP
|
static short |
ETH_TYPE_IPV4
|
static short |
ETH_TYPE_IPV6
|
static short |
ETH_TYPE_LLDP
|
static short |
ETH_TYPE_MPLS_MULTICAST
|
static short |
ETH_TYPE_MPLS_UNICAST
|
static short |
ETH_TYPE_VLAN
|
static byte |
IP_PROTO_ICMP
|
static byte |
IP_PROTO_SCTP
|
static byte |
IP_PROTO_TCP
|
static byte |
IP_PROTO_UDP
|
protected short |
length
|
protected java.util.List<OFMatchField> |
matchFields
|
protected short |
matchLength
|
static int |
MINIMUM_LENGTH
|
protected org.openflow.protocol.OFMatch.OFMatchType |
type
|
Constructor Summary | |
---|---|
OFMatch()
By default, create a OFMatch that matches everything (mostly because it's the least amount of work to make a valid OFMatch) |
Method Summary | |
---|---|
OFMatch |
clone()
|
boolean |
equals(java.lang.Object obj)
|
boolean |
fieldExists(OFOXMFieldType matchType)
Check if a particular match field exists |
static OFMatch |
fromString(java.lang.String match)
Set this OFMatch's parameters based on a comma-separated key=value pair dpctl-style string, e.g., from the output of OFMatch.toString() |
byte[] |
getDataLayerDestination()
Get dl_dst |
byte[] |
getDataLayerSource()
Get dl_src |
short |
getDataLayerType()
Get dl_type |
short |
getDataLayerVirtualLan()
Get dl_vlan |
byte |
getDataLayerVirtualLanPriorityCodePoint()
Get dl_vlan_pcp |
int |
getInPort()
Get in_port |
short |
getLength()
Get the length of this message |
int |
getLengthU()
Get the length of this message, unsigned |
java.lang.Object |
getMatchFieldMask(OFOXMFieldType matchType)
Get mask of particular field |
java.util.List<OFMatchField> |
getMatchFields()
Returns read-only copies of the matchfields contained in this OFMatch |
java.lang.Object |
getMatchFieldValue(OFOXMFieldType matchType)
Get value of particular field |
short |
getMatchLength()
|
int |
getNetworkDestination()
Get nw_dst |
int |
getNetworkDestinationMask()
Get nw_dst mask |
byte |
getNetworkProtocol()
Get nw_proto |
int |
getNetworkSource()
Get nw_src |
int |
getNetworkSourceMask()
Get nw_src mask |
byte |
getNetworkTypeOfService()
Get nw_tos OFMatch stores the ToS bits as 6-bits in the lower significant bits |
short |
getTransportDestination()
Get tp_dst |
short |
getTransportSource()
Get tp_src |
org.openflow.protocol.OFMatch.OFMatchType |
getType()
|
int |
hashCode()
|
static OFMatch |
load(byte[] packetData,
int inPort)
Load and return a new OFMatch based on supplied packetData, see #loadFromPacket(byte[], short) for details. |
OFMatch |
loadFromPacket(byte[] packetData,
int inPort)
Initializes this OFMatch structure with the corresponding data from the specified packet. |
void |
readFrom(java.nio.ByteBuffer data)
|
OFMatch |
setDataLayerDestination(byte[] dataLayerDestination)
Set dl_dst |
OFMatch |
setDataLayerDestination(java.lang.String mac)
Set dl_dst, but first translate to byte[] using HexString |
OFMatch |
setDataLayerSource(byte[] dataLayerSource)
Set dl_src |
OFMatch |
setDataLayerSource(java.lang.String mac)
Set dl_src, but first translate to byte[] using HexString |
OFMatch |
setDataLayerType(short dataLayerType)
Set dl_type |
OFMatch |
setDataLayerVirtualLan(short vlan)
Set dl_vlan |
OFMatch |
setDataLayerVirtualLanPriorityCodePoint(byte pcp)
Set dl_vlan_pcp |
void |
setField(OFMatchField newMatchField)
Sets match field. |
void |
setField(OFOXMFieldType matchFieldType,
java.lang.Object matchFieldValue)
|
void |
setField(OFOXMFieldType matchFieldType,
java.lang.Object matchFieldValue,
java.lang.Object matchFieldMask)
|
OFMatch |
setInPort(int inPort)
Set in_port in match |
OFMatch |
setMatchFields(java.util.List<OFMatchField> matchFields)
Sets the list of matchfields this OFMatch contains |
OFMatch |
setNetworkDestination(int networkDestination)
Set nw_dst |
OFMatch |
setNetworkDestination(short dataLayerType,
int networkDestination)
Set nw_dst |
OFMatch |
setNetworkDestinationMask(int networkDestination,
int networkMask)
Set nw_dst and nw_dst_mask |
OFMatch |
setNetworkDestinationMask(short dataLayerType,
int networkDestination,
int networkMask)
Set nw_dst and nw_dst_mask |
OFMatch |
setNetworkProtocol(byte networkProtocol)
Set nw_proto |
OFMatch |
setNetworkSource(int networkSource)
Set nw_src |
OFMatch |
setNetworkSource(short dataLayerType,
int networkSource)
Set nw_src |
OFMatch |
setNetworkSourceMask(int networkSource,
int networkMask)
Set nw_src and nw_src_mask |
OFMatch |
setNetworkSourceMask(short dataLayerType,
int networkSource,
int networkMask)
Set nw_src and nw_src_mask |
OFMatch |
setNetworkTypeOfService(byte networkTypeOfService)
Set nw_tos OFMatch stores the DSCP and ECN separately |
OFMatch |
setNonWildcards(java.util.Set<OFOXMFieldType> nonWildcardedFieldTypes)
Utility function to wildcard all fields except those specified in the set |
OFMatch |
setTransportDestination(byte networkProtocol,
short transportDestination)
Set tp_dst |
OFMatch |
setTransportDestination(short transportDestination)
Set tp_dst |
OFMatch |
setTransportSource(byte networkProtocol,
short transportSource)
Set tp_src |
OFMatch |
setTransportSource(short transportSource)
Set tp_src |
java.lang.String |
toString()
|
void |
writeTo(java.nio.ByteBuffer data)
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int MINIMUM_LENGTH
public static final short ETH_TYPE_IPV4
public static final short ETH_TYPE_IPV6
public static final short ETH_TYPE_ARP
public static final short ETH_TYPE_VLAN
public static final short ETH_TYPE_LLDP
public static final short ETH_TYPE_MPLS_UNICAST
public static final short ETH_TYPE_MPLS_MULTICAST
public static final byte IP_PROTO_ICMP
public static final byte IP_PROTO_TCP
public static final byte IP_PROTO_UDP
public static final byte IP_PROTO_SCTP
protected org.openflow.protocol.OFMatch.OFMatchType type
protected short length
protected short matchLength
protected java.util.List<OFMatchField> matchFields
Constructor Detail |
---|
public OFMatch()
Method Detail |
---|
public java.lang.Object getMatchFieldValue(OFOXMFieldType matchType)
public java.lang.Object getMatchFieldMask(OFOXMFieldType matchType)
public boolean fieldExists(OFOXMFieldType matchType)
public int getInPort()
public OFMatch setInPort(int inPort)
in_port
- public byte[] getDataLayerDestination()
public OFMatch setDataLayerDestination(byte[] dataLayerDestination)
dataLayerDestination
- public OFMatch setDataLayerDestination(java.lang.String mac)
mac
- A colon separated string of 6 pairs of octets, e..g.,
"00:17:42:EF:CD:8D"public byte[] getDataLayerSource()
public OFMatch setDataLayerSource(byte[] dataLayerSource)
dataLayerSource
- public OFMatch setDataLayerSource(java.lang.String mac)
mac
- A colon separated string of 6 pairs of octets, e..g.,
"00:17:42:EF:CD:8D"public short getDataLayerType()
public OFMatch setDataLayerType(short dataLayerType)
dataLayerType
- public short getDataLayerVirtualLan()
public OFMatch setDataLayerVirtualLan(short vlan)
dataLayerVirtualLan
- VLAN ID without the VLAN present bit setpublic byte getDataLayerVirtualLanPriorityCodePoint()
public OFMatch setDataLayerVirtualLanPriorityCodePoint(byte pcp)
pcp
- public byte getNetworkProtocol()
public OFMatch setNetworkProtocol(byte networkProtocol)
networkProtocol
- public byte getNetworkTypeOfService()
public OFMatch setNetworkTypeOfService(byte networkTypeOfService)
networkTypeOfService
- TOS value with 6-bit DSCP value (0-63)
in higher significant bits and ECN in the lower 2 bitspublic int getNetworkDestination()
public int getNetworkDestinationMask()
public OFMatch setNetworkDestination(int networkDestination)
networkDestination
- destination IP addresspublic OFMatch setNetworkDestination(short dataLayerType, int networkDestination)
dataLayerType
- ether typenetworkDestination
- destination IP addresspublic OFMatch setNetworkDestinationMask(int networkDestination, int networkMask)
networkDestination
- destination IP addressnetworkMask
- network maskpublic OFMatch setNetworkDestinationMask(short dataLayerType, int networkDestination, int networkMask)
dataLayerType
- ether typenetworkDestination
- destination IP addressnetworkMask
- network maskpublic int getNetworkSource()
public int getNetworkSourceMask()
public OFMatch setNetworkSource(int networkSource)
networkSource
- source IP addresspublic OFMatch setNetworkSource(short dataLayerType, int networkSource)
dataLayerType
- ether typenetworkSource
- source IP addresspublic OFMatch setNetworkSourceMask(int networkSource, int networkMask)
networkSource
- source IP addressnetworkMask
- network maskpublic OFMatch setNetworkSourceMask(short dataLayerType, int networkSource, int networkMask)
dataLayerType
- ether typenetworkSource
- source IP addressnetworkMask
- network maskpublic short getTransportDestination()
public OFMatch setTransportDestination(short transportDestination)
transportDestination
- TCP destination port numberpublic OFMatch setTransportDestination(byte networkProtocol, short transportDestination)
networkProtocol
- IP protocoltransportDestination
- Destination Transport port numberpublic short getTransportSource()
public OFMatch setTransportSource(short transportSource)
transportSource
- TCP source port numberpublic OFMatch setTransportSource(byte networkProtocol, short transportSource)
networkProtocol
- IP protocoltransportSource
- Source Transport port numberpublic org.openflow.protocol.OFMatch.OFMatchType getType()
public short getLength()
public int getLengthU()
public short getMatchLength()
public void setField(OFMatchField newMatchField)
matchField
- Check for uniqueness of field and add matchFieldpublic void setField(OFOXMFieldType matchFieldType, java.lang.Object matchFieldValue)
public void setField(OFOXMFieldType matchFieldType, java.lang.Object matchFieldValue, java.lang.Object matchFieldMask)
public java.util.List<OFMatchField> getMatchFields()
public OFMatch setMatchFields(java.util.List<OFMatchField> matchFields)
matchFields
- a list of ordered OFMatchField objectspublic OFMatch setNonWildcards(java.util.Set<OFOXMFieldType> nonWildcardedFieldTypes)
nonWildcardedFieldTypes
- set of match field types preserved,
if null all fields are wildcardedpublic void readFrom(java.nio.ByteBuffer data)
public void writeTo(java.nio.ByteBuffer data)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public OFMatch clone()
clone
in class java.lang.Object
public static OFMatch load(byte[] packetData, int inPort)
#loadFromPacket(byte[], short)
for details.
packetData
- inputPort
-
public OFMatch loadFromPacket(byte[] packetData, int inPort)
packetData
- The packet's datainputPort
- the port the packet arrived onpublic java.lang.String toString()
toString
in class java.lang.Object
public static OFMatch fromString(java.lang.String match) throws java.lang.IllegalArgumentException
Supported keys/values include
KEY(s) | VALUE |
"in_port","input_port" | integer |
"dl_src","eth_src", "dl_dst","eth_dst" | hex-string |
"dl_type", "dl_vlan", "dl_vlan_pcp" | integer |
"nw_src", "nw_dst", "ip_src", "ip_dst" | CIDR-style netmask |
"tp_src","tp_dst" | integer (max 64k) |
The CIDR-style netmasks assume 32 netmask if none given, so: "128.8.128.118/32" is the same as "128.8.128.118"
match
- a key=value comma separated string, e.g.
"in_port=5,ip_dst=192.168.0.0/16,tp_src=80"
java.lang.IllegalArgumentException
- on unexpected key or value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |