public class OFMatch extends Object implements Cloneable, Serializable
Constructor and Description |
---|
OFMatch()
By default, create a OFMatch that matches everything (mostly because it's
the least amount of work to make a valid OFMatch)
|
Modifier and Type | Method and Description |
---|---|
OFMatch |
clone()
Implement clonable interface
|
static String |
debugWildCards(int wildcards)
debug a set of wildcards
|
boolean |
equals(Object obj) |
void |
fromString(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
|
short |
getInputPort()
Get in_port
|
int |
getNetworkDestination()
Get nw_dst
|
int |
getNetworkDestinationMaskLen()
Parse this match's wildcard fields and return the number of significant
bits in the IP destination field.
|
byte |
getNetworkProtocol()
Get nw_proto
|
int |
getNetworkSource()
Get nw_src
|
int |
getNetworkSourceMaskLen()
Parse this match's wildcard fields and return the number of significant
bits in the IP destination field.
|
byte |
getNetworkTypeOfService()
Get nw_tos OFMatch stores the ToS bits as top 6-bits, so right shift by 2
bits before returning the value
|
short |
getTransportDestination()
Get tp_dst
|
short |
getTransportSource()
Get tp_src
|
Wildcards |
getWildcardObj()
Get wildcards
|
int |
getWildcards()
Get wildcards
|
int |
hashCode() |
protected static String |
ipToString(int ip) |
OFMatch |
loadFromPacket(byte[] packetData,
short inputPort)
Initializes this OFMatch structure with the corresponding data from the
specified packet.
|
void |
readFrom(org.jboss.netty.buffer.ChannelBuffer data)
Read this message off the wire from the specified ByteBuffer
|
OFMatch |
setDataLayerDestination(byte[] dataLayerDestination)
Set dl_dst
|
OFMatch |
setDataLayerDestination(String mac)
Set dl_dst, but first translate to byte[] using HexString
|
OFMatch |
setDataLayerSource(byte[] dataLayerSource)
Set dl_src
|
OFMatch |
setDataLayerSource(String mac)
Set dl_src, but first translate to byte[] using HexString
|
OFMatch |
setDataLayerType(short dataLayerType)
Set dl_type
|
OFMatch |
setDataLayerVirtualLan(short dataLayerVirtualLan)
Set dl_vlan
|
OFMatch |
setDataLayerVirtualLanPriorityCodePoint(byte pcp)
Set dl_vlan_pcp
|
OFMatch |
setInputPort(short inputPort)
Set in_port
|
OFMatch |
setNetworkDestination(int networkDestination)
Set nw_dst
|
OFMatch |
setNetworkProtocol(byte networkProtocol)
Set nw_proto
|
OFMatch |
setNetworkSource(int networkSource)
Set nw_src
|
OFMatch |
setNetworkTypeOfService(byte networkTypeOfService)
Set nw_tos OFMatch stores the ToS bits as top 6-bits, so left shift by 2
bits before storing the value
|
OFMatch |
setTransportDestination(short transportDestination)
Set tp_dst
|
OFMatch |
setTransportSource(short transportSource)
Set tp_src
|
OFMatch |
setWildcards(int wildcards)
Set wildcards
|
OFMatch |
setWildcards(Wildcards wildcards)
set the wildcard using the Wildcards convenience object
|
String |
toString()
Output a dpctl-styled string, i.e., only list the elements that are not
wildcarded A match-everything OFMatch outputs "OFMatch[]"
|
String |
toStringUnmasked()
Return a string including all match fields, regardless whether they are
wildcarded or not.
|
void |
writeTo(org.jboss.netty.buffer.ChannelBuffer data)
Write this message's binary format to the specified ByteBuffer
|
public static int MINIMUM_LENGTH
public static final int OFPFW_ALL
public static final int OFPFW_IN_PORT
public static final int OFPFW_DL_VLAN
public static final int OFPFW_DL_SRC
public static final int OFPFW_DL_DST
public static final int OFPFW_DL_TYPE
public static final int OFPFW_NW_PROTO
public static final int OFPFW_TP_SRC
public static final int OFPFW_TP_DST
public static final int OFPFW_NW_SRC_SHIFT
public static final int OFPFW_NW_SRC_BITS
public static final int OFPFW_NW_SRC_MASK
public static final int OFPFW_NW_SRC_ALL
public static final int OFPFW_NW_DST_SHIFT
public static final int OFPFW_NW_DST_BITS
public static final int OFPFW_NW_DST_MASK
public static final int OFPFW_NW_DST_ALL
public static final int OFPFW_DL_VLAN_PCP
public static final int OFPFW_NW_TOS
public static final int OFPFW_ALL_SANITIZED
public static final String STR_IN_PORT
public static final String STR_DL_DST
public static final String STR_DL_SRC
public static final String STR_DL_TYPE
public static final String STR_DL_VLAN
public static final String STR_DL_VLAN_PCP
public static final String STR_NW_DST
public static final String STR_NW_SRC
public static final String STR_NW_PROTO
public static final String STR_NW_TOS
public static final String STR_TP_DST
public static final String STR_TP_SRC
protected int wildcards
protected short inputPort
protected byte[] dataLayerSource
protected byte[] dataLayerDestination
protected short dataLayerVirtualLan
protected byte dataLayerVirtualLanPriorityCodePoint
protected short dataLayerType
protected byte networkTypeOfService
protected byte networkProtocol
protected int networkSource
protected int networkDestination
protected short transportSource
protected short transportDestination
public OFMatch()
public byte[] getDataLayerDestination()
public OFMatch setDataLayerDestination(byte[] dataLayerDestination)
dataLayerDestination
- public OFMatch setDataLayerDestination(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(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 dataLayerVirtualLan)
dataLayerVirtualLan
- public byte getDataLayerVirtualLanPriorityCodePoint()
public OFMatch setDataLayerVirtualLanPriorityCodePoint(byte pcp)
pcp
- public short getInputPort()
public OFMatch setInputPort(short inputPort)
inputPort
- public int getNetworkDestination()
public OFMatch setNetworkDestination(int networkDestination)
networkDestination
- public int getNetworkDestinationMaskLen()
public int getNetworkSourceMaskLen()
public byte getNetworkProtocol()
public OFMatch setNetworkProtocol(byte networkProtocol)
networkProtocol
- public int getNetworkSource()
public OFMatch setNetworkSource(int networkSource)
networkSource
- public byte getNetworkTypeOfService()
public OFMatch setNetworkTypeOfService(byte networkTypeOfService)
networkTypeOfService
- : 6-bit DSCP value (0-63)public short getTransportDestination()
public OFMatch setTransportDestination(short transportDestination)
transportDestination
- public short getTransportSource()
public OFMatch setTransportSource(short transportSource)
transportSource
- public int getWildcards()
public Wildcards getWildcardObj()
public OFMatch setWildcards(int wildcards)
wildcards
- public OFMatch setWildcards(Wildcards wildcards)
public OFMatch loadFromPacket(byte[] packetData, short inputPort)
packetData
- The packet's datainputPort
- the port the packet arrived onpublic void readFrom(org.jboss.netty.buffer.ChannelBuffer data)
data
- public void writeTo(org.jboss.netty.buffer.ChannelBuffer data)
data
- public String toString()
public String toStringUnmasked()
public static String debugWildCards(int wildcards)
public void fromString(String match) throws 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"IllegalArgumentException
- on unexpected key or valueprotected static String ipToString(int ip)
Copyright © 2015. All rights reserved.