aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibapi/api_shared.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-05-20 16:01:22 +0200
committerOle Tr�an <otroan@employees.org>2022-09-26 08:14:29 +0000
commitfe45f8f5afbf34d68cf992cc32b12432a82cdb38 (patch)
treeae8126e78d184022ef97007e64ac1f3350537a40 /src/vlibapi/api_shared.c
parentb70497124840fb6d9e8e5cf7239a41cb2bc7013c (diff)
api: replace print functions wth format
Type: improvement Change-Id: I7f7050c19453a69a7fb6c5e62f8f57db847d9144 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlibapi/api_shared.c')
-rw-r--r--src/vlibapi/api_shared.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index 73ef3ce54d8..0a983488bec 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -531,10 +531,7 @@ msg_handler_internal (api_main_t *am, void *the_msg, uword msg_len,
if (am->msg_print_flag)
{
fformat (stdout, "[%d]: %s\n", id, m->name);
- if (m->print_handler)
- m->print_handler (the_msg, stdout);
- else
- fformat (stdout, " [no registered print fn]\n");
+ fformat (stdout, "%U", format_vl_api_msg_text, am, id, the_msg);
}
uword calc_size = 0;
@@ -769,8 +766,7 @@ vl_msg_api_config (vl_msg_api_msg_config_t * c)
m->handler = c->handler;
m->cleanup_handler = c->cleanup;
m->endian_handler = c->endian;
- m->print_handler = c->print;
- m->print_json_handler = c->print_json;
+ m->format_fn = c->format_fn;
m->tojson_handler = c->tojson;
m->fromjson_handler = c->fromjson;
m->calc_size_func = c->calc_size;
@@ -793,10 +789,9 @@ vl_msg_api_config (vl_msg_api_msg_config_t * c)
* preserve the old API for a while
*/
void
-vl_msg_api_set_handlers (int id, char *name, void *handler, void *cleanup,
- void *endian, void *print, int size, int traced,
- void *print_json, void *tojson, void *fromjson,
- void *calc_size)
+vl_msg_api_set_handlers (int id, char *name, void *handler, void *endian,
+ format_function_t *format, int size, int traced,
+ void *tojson, void *fromjson, void *calc_size)
{
vl_msg_api_msg_config_t cfg;
vl_msg_api_msg_config_t *c = &cfg;
@@ -806,9 +801,8 @@ vl_msg_api_set_handlers (int id, char *name, void *handler, void *cleanup,
c->id = id;
c->name = name;
c->handler = handler;
- c->cleanup = cleanup;
c->endian = endian;
- c->print = print;
+ c->format_fn = format;
c->traced = traced;
c->replay = 1;
c->message_bounce = 0;
@@ -816,7 +810,6 @@ vl_msg_api_set_handlers (int id, char *name, void *handler, void *cleanup,
c->is_autoendian = 0;
c->tojson = tojson;
c->fromjson = fromjson;
- c->print_json = print_json;
c->calc_size = calc_size;
vl_msg_api_config (c);
}
@@ -884,12 +877,6 @@ vl_msg_api_trace_get (api_main_t * am, vl_api_trace_which_t which)
}
}
-void
-vl_noop_handler (void *mp)
-{
-}
-
-
static u8 post_mortem_dump_enabled;
void