X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlibapi%2Fapi_shared.c;h=4d11b519cf2b87407de7e6114f9472d9c1a9b694;hb=6545716c073c88ad86458620c6dbc59ba1cd00bb;hp=27898c3b9520f0744b7a7f5eeb3bae1ce6c96bbd;hpb=75a17ecddc9dc579a3aecfc5b53cbb60e993965f;p=vpp.git diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c index 27898c3b952..4d11b519cf2 100644 --- a/src/vlibapi/api_shared.c +++ b/src/vlibapi/api_shared.c @@ -665,7 +665,22 @@ vl_msg_api_config (vl_msg_api_msg_config_t * c) { api_main_t *am = &api_main; - ASSERT (c->id > 0); + /* + * This happens during the java core tests if the message + * dictionary is missing newly added xxx_reply_t messages. + * Should never happen, but since I shot myself in the foot once + * this way, I thought I'd make it easy to debug if I ever do + * it again... (;-)... + */ + if (c->id == 0) + { + if (c->name) + clib_warning ("Trying to register %s with a NULL msg id!", c->name); + else + clib_warning ("Trying to register a NULL msg with a NULL msg id!"); + clib_warning ("Did you forget to call setup_message_id_table?"); + return; + } #define _(a) vec_validate (am->a, c->id); foreach_msg_api_vector; @@ -915,6 +930,15 @@ vl_msg_api_add_msg_name_crc (api_main_t * am, const char *string, u32 id) hash_set_mem (am->msg_index_by_name_and_crc, string, id); } +void +vl_msg_api_add_version (api_main_t * am, const char *string, + u32 major, u32 minor, u32 patch) +{ + api_version_t version = {.major = major,.minor = minor,.patch = patch }; + ASSERT (strlen (string) < 64); + strncpy (version.name, string, 64 - 1); + vec_add1 (am->api_version_list, version); +} /* * fd.io coding-style-patch-verification: ON