add of_str64_t string type
We need a 64-byte string for the debug_counter extension. Since adding a new
string type is so much work, the new type is named generically so that any
extension can use it.
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index 10668b7..81f5a1a 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -700,6 +700,7 @@
typedef char of_table_name_t[OF_MAX_TABLE_NAME_LEN];
typedef char of_desc_str_t[OF_DESC_STR_LEN];
typedef char of_serial_num_t[OF_SERIAL_NUM_LEN];
+typedef char of_str64_t[64];
typedef struct of_bitmap_128_s {
uint64_t hi;
diff --git a/c_gen/c_test_gen.py b/c_gen/c_test_gen.py
index 316a2b3..01f1c5d 100644
--- a/c_gen/c_test_gen.py
+++ b/c_gen/c_test_gen.py
@@ -92,6 +92,7 @@
of_table_name_t="table_name",
of_desc_str_t="desc_str",
of_serial_num_t="ser_num",
+ of_str64_t="str64",
of_mac_addr_t="mac_addr",
of_ipv6_t="ipv6",
# Non-scalars; more TBD
@@ -115,7 +116,8 @@
"of_match_bmap_t", "of_ipv4_t"]
string_types = [ "of_port_name_t", "of_table_name_t",
"of_desc_str_t", "of_serial_num_t", "of_mac_addr_t",
- "of_ipv6_t", "of_bitmap_128_t", "of_checksum_128_t"]
+ "of_ipv6_t", "of_bitmap_128_t", "of_checksum_128_t",
+ "of_str64_t"]
scalar_types = integer_types[:]
scalar_types.extend(string_types)
diff --git a/c_gen/of_g_legacy.py b/c_gen/of_g_legacy.py
index 1fadba0..3311282 100644
--- a/c_gen/of_g_legacy.py
+++ b/c_gen/of_g_legacy.py
@@ -192,6 +192,7 @@
short_name="desc_str"),
of_serial_num_t = dict(bytes=ofp_constants["OF_SERIAL_NUM_LEN"],
short_name="ser_num"),
+ of_str64_t = dict(bytes=64, short_name="str64"),
of_match_v1_t = dict(bytes=40, to_w="match_v1_hton",
from_w="match_v1_ntoh",
short_name="match_v1"),
@@ -213,7 +214,8 @@
"of_port_no_t", "of_fm_cmd_t", "of_wc_bmap_t",
"of_match_bmap_t", "of_port_name_t", "of_table_name_t",
"of_desc_str_t", "of_serial_num_t", "of_mac_addr_t",
- "of_ipv6_t", "of_ipv4_t", "of_bitmap_128_t", "of_checksum_128_t"]
+ "of_ipv6_t", "of_ipv4_t", "of_bitmap_128_t", "of_checksum_128_t",
+ "of_str64_t"]
##
# LOXI identifiers
diff --git a/c_gen/templates/loci_dump.h b/c_gen/templates/loci_dump.h
index 9cc719c..1344565 100644
--- a/c_gen/templates/loci_dump.h
+++ b/c_gen/templates/loci_dump.h
@@ -90,6 +90,7 @@
#define LOCI_DUMP_tab_name(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
#define LOCI_DUMP_desc_str(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
#define LOCI_DUMP_ser_num(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
+#define LOCI_DUMP_str64(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
int loci_dump_match(loci_writer_f writer, void* cookie, of_match_t *match);
#define LOCI_DUMP_match(writer, cookie, val) loci_dump_match(writer, cookie, &val)
diff --git a/c_gen/templates/loci_show.h b/c_gen/templates/loci_show.h
index 5384837..4389f4c 100644
--- a/c_gen/templates/loci_show.h
+++ b/c_gen/templates/loci_show.h
@@ -158,6 +158,7 @@
#define LOCI_SHOW_tab_name(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
#define LOCI_SHOW_desc_str(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
#define LOCI_SHOW_ser_num(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
+#define LOCI_SHOW_str64(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
int loci_show_match(loci_writer_f writer, void *cookie, of_match_t *match);
#define LOCI_SHOW_match(writer, cookie, val) loci_show_match(writer, cookie, &val)
diff --git a/c_gen/templates/of_wire_buf.h b/c_gen/templates/of_wire_buf.h
index 4736ac0..0723454 100644
--- a/c_gen/templates/of_wire_buf.h
+++ b/c_gen/templates/of_wire_buf.h
@@ -853,6 +853,30 @@
_wbuf_octets_set(buf, offset, (uint8_t *)sernum, OF_SERIAL_NUM_LEN)
/**
+ * Get a str64 string from a wire buffer
+ * @param wbuf The pointer to the wire buffer structure
+ * @param offset Offset in the wire buffer
+ * @param s The string
+ *
+ * Uses the octets function.
+ */
+
+#define of_wire_buffer_str64_get(buf, offset, s) \
+ _wbuf_octets_get(buf, offset, (uint8_t *)s, 64)
+
+/**
+ * Set a str64 string in a wire buffer
+ * @param wbuf The pointer to the wire buffer structure
+ * @param offset Offset in the wire buffer
+ * @param s Where to store the str64
+ *
+ * Uses the octets function.
+ */
+
+#define of_wire_buffer_str64_set(buf, offset, s) \
+ _wbuf_octets_set(buf, offset, (uint8_t *)s, 64)
+
+/**
* Get an ipv6 address from a wire buffer
* @param wbuf The pointer to the wire buffer structure
* @param offset Offset in the wire buffer
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index 6188771..be8251b 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -349,6 +349,7 @@
desc_str = gen_fixed_length_string_jtype(256)
serial_num = gen_fixed_length_string_jtype(32)
table_name = gen_fixed_length_string_jtype(32)
+str64 = gen_fixed_length_string_jtype(64)
ipv4 = JType("IPv4Address") \
.op(read="IPv4Address.read4Bytes(bb)", \
write="$name.write4Bytes(bb)",
@@ -526,6 +527,7 @@
'of_serial_num_t': serial_num,
'of_port_name_t': port_name,
'of_table_name_t': table_name,
+ 'of_str64_t': str64,
'of_ipv4_t': ipv4,
'of_ipv6_t': ipv6,
'of_wc_bmap_t': flow_wildcards,
diff --git a/loxi_ir/ir_offset.py b/loxi_ir/ir_offset.py
index e705fcc..2e6d004 100644
--- a/loxi_ir/ir_offset.py
+++ b/loxi_ir/ir_offset.py
@@ -95,6 +95,7 @@
of_table_name_t = (ofp_constants["OF_MAX_TABLE_NAME_LEN"], True),
of_desc_str_t = (ofp_constants["OF_DESC_STR_LEN"], True),
of_serial_num_t = (ofp_constants["OF_SERIAL_NUM_LEN"], True),
+ of_str64_t = (64, True),
of_match_v1_t = (40, True),
of_match_v2_t = (88, True),
of_match_v3_t = (8, False),
diff --git a/py_gen/oftype.py b/py_gen/oftype.py
index 3b56308..ddde14a 100644
--- a/py_gen/oftype.py
+++ b/py_gen/oftype.py
@@ -126,6 +126,7 @@
'of_table_name_t': 32,
'of_serial_num_t': 32,
'of_desc_str_t': 256,
+ 'of_str64_t': 64,
}
for (cls, length) in fixed_length_strings.items():
diff --git a/wireshark_gen/field_info.py b/wireshark_gen/field_info.py
index 996accf..b2e9a82 100644
--- a/wireshark_gen/field_info.py
+++ b/wireshark_gen/field_info.py
@@ -39,6 +39,7 @@
"of_table_name_t": "stringz",
"of_desc_str_t": "stringz",
"of_serial_num_t": "stringz",
+ "of_str64_t": "stringz",
"of_octets_t": "bytes",
"of_port_no_t": "uint32",
"of_port_desc_t": "stringz",
@@ -67,6 +68,7 @@
"of_table_name_t": "NONE",
"of_desc_str_t": "NONE",
"of_serial_num_t": "NONE",
+ "of_str64_t": "NONE",
"of_octets_t": "NONE",
"of_port_no_t": "DEC",
"of_port_desc_t": "NONE",