loci: switch message parsing to of_header_wire_object_id_get
diff --git a/c_gen/templates/of_object.c b/c_gen/templates/of_object.c
index 8fd0aab..69bd8d3 100644
--- a/c_gen/templates/of_object.c
+++ b/c_gen/templates/of_object.c
@@ -159,23 +159,20 @@
return NULL;
}
- object_id = of_message_to_object_id(msg, len);
- LOCI_ASSERT(object_id != OF_OBJECT_INVALID);
-
if ((obj = of_object_new(-1)) == NULL) {
return NULL;
}
- of_object_init_map[object_id](obj, version, 0, 0);
-
if (of_object_buffer_bind(obj, OF_MESSAGE_TO_BUFFER(msg), len,
OF_MESSAGE_FREE_FUNCTION) < 0) {
FREE(obj);
return NULL;
}
- obj->length = len;
obj->version = version;
+ of_header_wire_object_id_get(obj, &object_id);
+ of_object_init_map[object_id](obj, version, len, 0);
+
return obj;
}
@@ -213,17 +210,15 @@
return NULL;
}
- object_id = of_message_to_object_id(msg, len);
- /* Already validated */
- LOCI_ASSERT(object_id != OF_OBJECT_INVALID);
-
- of_object_init_map[object_id](obj, version, len, 0);
-
+ obj->version = version;
obj->wire_object.wbuf = wbuf;
wbuf->buf = msg;
wbuf->alloc_bytes = len;
wbuf->current_bytes = len;
+ of_header_wire_object_id_get(obj, &object_id);
+ of_object_init_map[object_id](obj, version, len, 0);
+
return obj;
}