loci: move per-class declarations to loci_classes.h
The goal is to free loci.h of dynamically generated code and turn it into a
static template.
Needed to move some declarations out of loci.h and into of_object.h, where they
really belonged anyway.
diff --git a/c_gen/templates/of_object.h b/c_gen/templates/of_object.h
index ff4c9c5..fee95e1 100644
--- a/c_gen/templates/of_object.h
+++ b/c_gen/templates/of_object.h
@@ -46,6 +46,7 @@
#include <loci/of_match.h>
#include <loci/loci_base.h>
#include <loci/of_message.h>
+#include <loci/of_wire_buf.h>
#if defined(OF_OBJECT_TRACKING)
#include <BigList/biglist.h>
@@ -57,6 +58,24 @@
*/
#define OF_OBJECT_METADATA_BYTES 32
+/*
+ * Generic accessors:
+ *
+ * Many objects have a length represented in the wire buffer
+ * wire_length_get and wire_length_set access these values directly on the
+ * wire.
+ *
+ * Many objects have a length represented in the wire buffer
+ * wire_length_get and wire_length_set access these values directly on the
+ * wire.
+ *
+ * FIXME: TBD if wire_length_set and wire_type_set are required.
+ */
+typedef void (*of_wire_length_get_f)(of_object_t *obj, int *bytes);
+typedef void (*of_wire_length_set_f)(of_object_t *obj, int bytes);
+typedef void (*of_wire_type_get_f)(of_object_t *obj, of_object_id_t *id);
+typedef void (*of_wire_type_set_f)(of_object_t *obj);
+
/****************************************************************
* General list operations: first, next, append_setup, append_advance
****************************************************************/
@@ -173,4 +192,44 @@
int of_object_can_grow(of_object_t *obj, int new_len);
+struct of_object_s {
+ /* The control block for the underlying data buffer */
+ of_wire_object_t wire_object;
+ /* The LOCI type enum value of the object */
+ of_object_id_t object_id;
+
+ /*
+ * Objects need to track their "parent" so that updates to the
+ * object that affect its length can be pushed to the parent.
+ * Treat as private.
+ */
+ of_object_t *parent;
+
+ /*
+ * Not all objects have length and version on the wire so we keep
+ * them here. NOTE: Infrastructure manages length and version.
+ * Treat length as private and version as read only.
+ */
+ int length;
+ of_version_t version;
+
+ /*
+ * Many objects have a length and/or type represented in the wire buffer
+ * These accessors get and set those value when present. Treat as private.
+ */
+ of_wire_length_get_f wire_length_get;
+ of_wire_length_set_f wire_length_set;
+ of_wire_type_get_f wire_type_get;
+ of_wire_type_set_f wire_type_set;
+
+ of_object_track_info_t track_info;
+
+ /*
+ * Metadata available for applications. Ensure 8-byte alignment, but
+ * that buffer is at least as large as requested. This data is not used
+ * or inspected by LOCI.
+ */
+ uint64_t metadata[(OF_OBJECT_METADATA_BYTES + 7) / 8];
+};
+
#endif /* _OF_OBJECT_H_ */