summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-10-07 16:22:00 +0200
committerNeale Ranns <nranns@cisco.com>2019-10-09 07:52:51 +0000
commitb126ebcf421830e739e74a532e35351f1a5fe2c1 (patch)
tree2077672d4cf080ef26bd3114ac971fe684ce5fb0 /src/tools
parent1ff3c15b3c7607c9b590ad44d18dea5eb1cb8c4e (diff)
api: autogenerate event handler functions for *_test.c
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: If75f63244f37ae3312832ca015f738c51ee7da1f Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/vppapigen/vppapigen_c.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/vppapigen/vppapigen_c.py b/src/tools/vppapigen/vppapigen_c.py
index bab255c58a2..e85a8980592 100644
--- a/src/tools/vppapigen/vppapigen_c.py
+++ b/src/tools/vppapigen/vppapigen_c.py
@@ -673,6 +673,15 @@ def generate_c_test_plugin_boilerplate(services, defines, file_crc, module, stre
write(' }\n')
write('}\n')
+ for e in s.events:
+ if define_hash[e].manual_print:
+ continue
+ write('static void\n')
+ write('vl_api_{n}_t_handler (vl_api_{n}_t * mp) {{\n'.format(n=e))
+ write(' vl_print(0, "{n} event called:");\n'.format(n=e))
+ write(' vl_api_{n}_t_print(mp, 0);\n'.format(n=e))
+ write('}\n')
+
write('static void\n')
write('setup_message_id_table (vat_main_t * vam, u16 msg_id_base) {\n')
for s in services:
@@ -688,6 +697,14 @@ def generate_c_test_plugin_boilerplate(services, defines, file_crc, module, stre
except:
pass
+ # Events
+ for e in s.events:
+ write(' vl_msg_api_set_handlers(VL_API_{ID} + msg_id_base, "{n}",\n'
+ ' vl_api_{n}_t_handler, vl_noop_handler,\n'
+ ' vl_api_{n}_t_endian, vl_api_{n}_t_print,\n'
+ ' sizeof(vl_api_{n}_t), 1);\n'
+ .format(n=e, ID=e.upper()))
+
write('}\n')
write('clib_error_t * vat_plugin_register (vat_main_t *vam)\n')