loci: support special length member in OF 1.4 queue_desc
diff --git a/c_gen/c_type_maps.py b/c_gen/c_type_maps.py
index 17f63ca..36ad5f6 100644
--- a/c_gen/c_type_maps.py
+++ b/c_gen/c_type_maps.py
@@ -73,6 +73,9 @@
extern void of_queue_stats_entry_wire_length_get(of_object_t *obj, int *bytes);
extern void of_queue_stats_entry_wire_length_set(of_object_t *obj, int bytes);
+extern void of_queue_desc_wire_length_get(of_object_t *obj, int *bytes);
+extern void of_queue_desc_wire_length_set(of_object_t *obj, int bytes);
+
""")
diff --git a/c_gen/codegen.py b/c_gen/codegen.py
index dba3d53..f480453 100644
--- a/c_gen/codegen.py
+++ b/c_gen/codegen.py
@@ -201,6 +201,7 @@
special_length_classes = set([
'of_packet_queue', 'of_meter_stats', 'of_port_desc',
'of_port_stats_entry', 'of_queue_stats_entry',
+ 'of_queue_desc',
])
def build_class_metadata():
diff --git a/c_gen/templates/of_type_maps.c b/c_gen/templates/of_type_maps.c
index 8847515..3fcf024 100644
--- a/c_gen/templates/of_type_maps.c
+++ b/c_gen/templates/of_type_maps.c
@@ -443,3 +443,35 @@
LOCI_ASSERT(obj->length == OF_OBJECT_FIXED_LENGTH(obj));
}
}
+
+/**
+ * Get the wire length for a queue_desc object
+ * @param obj The object being referenced
+ * @param bytes Pointer to location to store length
+ */
+void
+of_queue_desc_wire_length_get(of_object_t *obj, int *bytes)
+{
+ of_wire_buffer_t *wbuf = OF_OBJECT_TO_WBUF(obj);
+ uint16_t u16;
+
+ LOCI_ASSERT(wbuf != NULL);
+
+ of_wire_buffer_u16_get(wbuf, OF_OBJECT_ABSOLUTE_OFFSET(obj, 8), &u16);
+ *bytes = u16;
+}
+
+/**
+ * Set the wire length for a queue_desc object
+ * @param obj The object being referenced
+ * @param bytes The length of the object
+ */
+
+void
+of_queue_desc_wire_length_set(of_object_t *obj, int bytes)
+{
+ of_wire_buffer_t *wbuf = OF_OBJECT_TO_WBUF(obj);
+ LOCI_ASSERT(wbuf != NULL);
+
+ of_wire_buffer_u16_set(wbuf, OF_OBJECT_ABSOLUTE_OFFSET(obj, 8), bytes);
+}