diff --git a/ovni.c b/ovni.c index 3b766ee..f6b262c 100644 --- a/ovni.c +++ b/ovni.c @@ -176,7 +176,10 @@ proc_set_version(void) die("json_value_get_object failed\n"); if(json_object_set_number(meta, "version", OVNI_METADATA_VERSION) != 0) - die("json_object_set_number for app_id failed\n"); + die("json_object_set_number for version failed\n"); + + if(json_object_set_string(meta, "model_version", OVNI_MODEL_VERSION) != 0) + die("json_object_set_string for model_version failed\n"); } diff --git a/ovni.h b/ovni.h index bcd8e85..b48d62a 100644 --- a/ovni.h +++ b/ovni.h @@ -50,6 +50,7 @@ typedef struct json_value_t JSON_Value; #define OVNI_STREAM_MAGIC "ovni" #define OVNI_STREAM_VERSION 1 +#define OVNI_MODEL_VERSION "O1 V1 T1 M1 D1 K1" /* ----------------------- common ------------------------ */ diff --git a/trace.c b/trace.c index 39e8101..491c8e9 100644 --- a/trace.c +++ b/trace.c @@ -146,6 +146,23 @@ check_metadata_version(struct ovni_eproc *proc) proc->pid, version, OVNI_METADATA_VERSION); } + + JSON_Value *mversion_val = json_object_get_value(meta, "model_version"); + if(mversion_val == NULL) + { + die("process %d is missing attribute \"model_version\" in metadata\n", + proc->pid); + } + + const char *mversion = json_string(mversion_val); + + if(strcmp(mversion, OVNI_MODEL_VERSION) != 0) + { + die("pid %d: metadata model version mismatch '%s' (expected '%s')\n", + proc->pid, mversion, + OVNI_MODEL_VERSION); + + } } static int