summaryrefslogtreecommitdiffstats
path: root/plugins/snat-plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/snat-plugin')
-rw-r--r--plugins/snat-plugin/Makefile.am7
-rw-r--r--plugins/snat-plugin/snat/snat.c17
2 files changed, 21 insertions, 3 deletions
diff --git a/plugins/snat-plugin/Makefile.am b/plugins/snat-plugin/Makefile.am
index 9f41193a708..0a0fff86486 100644
--- a/plugins/snat-plugin/Makefile.am
+++ b/plugins/snat-plugin/Makefile.am
@@ -39,8 +39,8 @@ SUFFIXES = .api.h .api
%.py: %.api
$(info Creating Python binding for $@)
- $(CC) $(CPPFLAGS) -E -P -C -x c $< \
- | vppapigen --input - --python - \
+ $(CC) $(CPPFLAGS) -E -P -C -x c $< \
+ | vppapigen --input - --python - \
| pyvppapigen.py --input - > $@
pyapidir = ${prefix}/vpp_papi_plugins
@@ -59,7 +59,8 @@ install-data-hook:
@(cd $(vpppluginsdir) && $(RM) $(vppplugins_LTLIBRARIES))
@(cd $(vppapitestpluginsdir) && $(RM) $(vppapitestplugins_LTLIBRARIES))
-
+apidir = $(prefix)/snat
+api_DATA = snat/snat.api
#
# Java code generation
diff --git a/plugins/snat-plugin/snat/snat.c b/plugins/snat-plugin/snat/snat.c
index 66c03817ca0..2956e24f054 100644
--- a/plugins/snat-plugin/snat/snat.c
+++ b/plugins/snat-plugin/snat/snat.c
@@ -955,6 +955,19 @@ snat_plugin_api_hookup (vlib_main_t *vm)
return 0;
}
+#define vl_msg_name_crc_list
+#include <snat/snat_all_api_h.h>
+#undef vl_msg_name_crc_list
+
+static void
+setup_message_id_table (snat_main_t * sm, api_main_t * am)
+{
+#define _(id,n,crc) \
+ vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + sm->msg_id_base);
+ foreach_vl_msg_name_crc_snat;
+#undef _
+}
+
static void plugin_custom_dump_configure (snat_main_t * sm)
{
#define _(n,f) sm->api_main->msg_print_handlers \
@@ -985,6 +998,10 @@ static clib_error_t * snat_init (vlib_main_t * vm)
sm->api_main = &api_main;
error = snat_plugin_api_hookup (vm);
+
+ /* Add our API messages to the global name_crc hash table */
+ setup_message_id_table (sm, &api_main);
+
plugin_custom_dump_configure (sm);
vec_free(name);