add bsn_tcp_flags extension
This extension adds an OXM to support matching on TCP flags.
diff --git a/c_gen/match.py b/c_gen/match.py
index 59653a0..a7da751 100644
--- a/c_gen/match.py
+++ b/c_gen/match.py
@@ -540,6 +540,15 @@
takes_mask_in_spec=True,
order=1010,
),
+
+ bsn_tcp_flags = dict(
+ name="bsn_tcp_flags",
+ m_type="uint16_t",
+ print_type="PRIx16",
+ conditions="",
+ takes_mask_in_spec=True,
+ order=1010,
+ ),
)
match_keys_sorted = of_match_members.keys()
diff --git a/c_gen/templates/loci_show.h b/c_gen/templates/loci_show.h
index 909df71..c10b08f 100644
--- a/c_gen/templates/loci_show.h
+++ b/c_gen/templates/loci_show.h
@@ -409,5 +409,6 @@
#define LOCI_SHOW_u32_flags(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
#define LOCI_SHOW_desc_str_image_checksum(write, cookie, val) LOCI_SHOW_desc_str(writer, cookie, val)
#define LOCI_SHOW_desc_str_startup_config_checksum(write, cookie, val) LOCI_SHOW_desc_str(writer, cookie, val)
+#define LOCI_SHOW_u16_bsn_tcp_flags(write, cookie, val) LOCI_SHOW_x16(writer, cookie, val)
#endif /* _LOCI_SHOW_H_ */
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index 707a425..a872903 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -306,6 +306,8 @@
funnel="FunnelUtils.putList($name, sink)")
u8obj = JType('U8', 'U8') \
.op(read='U8.of(bb.readByte())', write='bb.writeByte($name.getRaw())', default="U8.ZERO")
+u16obj = JType('U16', 'U16') \
+ .op(read='U16.of(bb.readByte())', write='bb.writeByte($name.getRaw())', default="U16.ZERO")
u32obj = JType('U32', 'U32') \
.op(read='U32.of(bb.readInt())', write='bb.writeInt($name.getRaw())', default="U32.ZERO")
u64 = JType('U64', 'long') \
@@ -642,6 +644,9 @@
'of_oxm_bsn_udf7' : { 'value' : udf },
'of_oxm_bsn_udf7_masked' : { 'value' : udf, 'value_mask' : udf },
+ 'of_oxm_bsn_tcp_flags' : { 'value' : u16obj },
+ 'of_oxm_bsn_tcp_flags_masked' : { 'value' : u16obj, 'value_mask' : u16obj },
+
'of_table_stats_entry': { 'wildcards': table_stats_wildcards },
'of_match_v1': { 'vlan_vid' : vlan_vid_match, 'vlan_pcp': vlan_pcp,
'eth_type': eth_type, 'ip_dscp': ip_dscp, 'ip_proto': ip_proto,
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
index aebcbb2..6753933 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
@@ -20,6 +20,7 @@
import org.projectfloodlight.openflow.types.OFValueType;
import org.projectfloodlight.openflow.types.OFVlanVidMatch;
import org.projectfloodlight.openflow.types.TransportPort;
+import org.projectfloodlight.openflow.types.U16;
import org.projectfloodlight.openflow.types.U32;
import org.projectfloodlight.openflow.types.U8;
import org.projectfloodlight.openflow.types.UDF;
@@ -224,6 +225,9 @@
public final static MatchField<UDF> BSN_UDF7 =
new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF7);
+ public final static MatchField<U16> BSN_TCP_FLAGS =
+ new MatchField<U16>("bsn_tcp_flags", MatchFields.BSN_TCP_FLAGS);
+
public String getName() {
return name;
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java
index d1e2ee9..b64b424 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java
@@ -54,4 +54,5 @@
BSN_UDF5,
BSN_UDF6,
BSN_UDF7,
+ BSN_TCP_FLAGS,
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U16.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U16.java
index 6c4ac11..2466ffc 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U16.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U16.java
@@ -29,6 +29,10 @@
private final static short ZERO_VAL = 0;
public final static U16 ZERO = new U16(ZERO_VAL);
+ private static final short NO_MASK_VAL = (short)0xFFff;
+ public final static U16 NO_MASK = new U16(NO_MASK_VAL);
+ public static final U16 FULL_MASK = ZERO;
+
public static int f(final short i) {
return i & 0xffff;
}
diff --git a/openflow_input/bsn_tcp_flags b/openflow_input/bsn_tcp_flags
new file mode 100644
index 0000000..e8ef2e9
--- /dev/null
+++ b/openflow_input/bsn_tcp_flags
@@ -0,0 +1,59 @@
+// Copyright 2014, Big Switch Networks, Inc.
+//
+// LoxiGen is licensed under the Eclipse Public License,
+// version 1.0 (EPL), with the following special exception:
+//
+// LOXI Exception
+//
+// As a special exception to the terms of the EPL, you may
+// distribute libraries generated by LoxiGen (LoxiGen Libraries)
+// under the terms of your choice, provided that copyright and
+// licensing notices generated by LoxiGen are not altered or removed
+// from the LoxiGen Libraries and the notice provided below is (i)
+// included in the LoxiGen Libraries, if distributed in source code
+// form and (ii) included in any documentation for the LoxiGen
+// Libraries, if distributed in binary form.
+//
+// Notice: "Copyright 2013, Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler."
+//
+// You may not use this file except in compliance with the EPL or
+// LOXI Exception. You may obtain a copy of the EPL at:
+//
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an "AS
+// IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. See the EPL for the specific language
+// governing permissions and limitations under the EPL.
+
+#version 3
+#version 4
+
+/*
+ * TCP flags
+ */
+
+enum ofp_bsn_tcp_flag(wire_type=uint16_t, bitmask=True) {
+ OFP_BSN_TCP_FLAG_FIN = 0x001,
+ OFP_BSN_TCP_FLAG_SYN = 0x002,
+ OFP_BSN_TCP_FLAG_RST = 0x004,
+ OFP_BSN_TCP_FLAG_PSH = 0x008,
+ OFP_BSN_TCP_FLAG_ACK = 0x010,
+ OFP_BSN_TCP_FLAG_URG = 0x020,
+ OFP_BSN_TCP_FLAG_ECE = 0x040,
+ OFP_BSN_TCP_FLAG_CWR = 0x080,
+ OFP_BSN_TCP_FLAG_NS = 0x100,
+};
+
+struct of_oxm_bsn_tcp_flags : of_oxm {
+ uint32_t type_len == 0x00032002;
+ uint16_t value;
+};
+
+struct of_oxm_bsn_tcp_flags_masked : of_oxm {
+ uint32_t type_len == 0x00032104;
+ uint16_t value;
+ uint16_t value_mask;
+};