loci: add a function to parse messages without allocating memory
This will be used by the Indigo connection manager to parse messages directly
from the read buffer, saving three allocations and a memcpy.
diff --git a/c_gen/templates/of_object.h b/c_gen/templates/of_object.h
index 0e761fd..3172ad1 100644
--- a/c_gen/templates/of_object.h
+++ b/c_gen/templates/of_object.h
@@ -122,6 +122,11 @@
extern of_object_t *of_object_new_from_message(of_message_t msg, int len);
+typedef struct of_object_storage_s of_object_storage_t;
+
+of_object_t *of_object_new_from_message_preallocated(
+ of_object_storage_t *storage, uint8_t *buf, int len);
+
/* Delete an OpenFlow object without reference to its type */
extern void of_object_delete(of_object_t *obj);
@@ -169,4 +174,9 @@
uint64_t metadata[(OF_OBJECT_METADATA_BYTES + 7) / 8];
};
+struct of_object_storage_s {
+ of_object_t obj;
+ of_wire_buffer_t wbuf;
+};
+
#endif /* _OF_OBJECT_H_ */