aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-11-28 18:55:09 -0500
committerDamjan Marion <dmarion.lists@gmail.com>2017-11-29 10:04:05 +0000
commit0a32b60cf0ac8362360f0cf0a50ec27103c79f28 (patch)
treeac42b857b57e93c38787e75d13e26f0c2eac477b /src
parent3d786efcb087533320e89f80077127fc507cfd99 (diff)
Configure vat-plugin-path and vat-plugin-name-filter
To facilitate in-tree plugin API testing, via the "binary-api..." debug CLI command. Change-Id: If7ee88a6a0dbc8e8f4555cb41e259db24e378a64 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src')
-rw-r--r--src/vlib/unix/plugin.c20
-rw-r--r--src/vlib/unix/plugin.h5
-rw-r--r--src/vpp/api/plugin.c13
-rw-r--r--src/vpp/api/plugin.h16
4 files changed, 47 insertions, 7 deletions
diff --git a/src/vlib/unix/plugin.c b/src/vlib/unix/plugin.c
index c2741aaa074..058afcfcae0 100644
--- a/src/vlib/unix/plugin.c
+++ b/src/vlib/unix/plugin.c
@@ -361,6 +361,20 @@ vlib_plugin_early_init (vlib_main_t * vm)
return vlib_load_new_plugins (pm, 1 /* from_early_init */ );
}
+u8 *
+vlib_get_vat_plugin_path (void)
+{
+ plugin_main_t *pm = &vlib_plugin_main;
+ return (pm->vat_plugin_path);
+}
+
+u8 *
+vlib_get_vat_plugin_name_filter (void)
+{
+ plugin_main_t *pm = &vlib_plugin_main;
+ return (pm->vat_plugin_name_filter);
+}
+
static clib_error_t *
vlib_plugins_show_cmd_fn (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
@@ -497,6 +511,12 @@ done:
u8 *s = 0;
if (unformat (input, "path %s", &s))
pm->plugin_path = s;
+ else if (unformat (input, "name-filter %s", &s))
+ pm->plugin_name_filter = s;
+ else if (unformat (input, "vat-path %s", &s))
+ pm->vat_plugin_path = s;
+ else if (unformat (input, "vat-name-filter %s", &s))
+ pm->vat_plugin_name_filter = s;
else if (unformat (input, "plugin %s %U", &s,
unformat_vlib_cli_sub_input, &sub_input))
{
diff --git a/src/vlib/unix/plugin.h b/src/vlib/unix/plugin.h
index 52da7436e61..aad1ca30b3c 100644
--- a/src/vlib/unix/plugin.h
+++ b/src/vlib/unix/plugin.h
@@ -92,9 +92,11 @@ typedef struct
plugin_info_t *plugin_info;
uword *plugin_by_name_hash;
- /* path and name filter */
+ /* paths and name filters */
u8 *plugin_path;
u8 *plugin_name_filter;
+ u8 *vat_plugin_path;
+ u8 *vat_plugin_name_filter;
/* plugin configs and hash by name */
plugin_config_t *configs;
@@ -110,6 +112,7 @@ clib_error_t *vlib_plugin_config (vlib_main_t * vm, unformat_input_t * input);
int vlib_plugin_early_init (vlib_main_t * vm);
int vlib_load_new_plugins (plugin_main_t * pm, int from_early_init);
void *vlib_get_plugin_symbol (char *plugin_name, char *symbol_name);
+u8 *vlib_get_vat_plugin_path (void);
#define VLIB_PLUGIN_REGISTER() \
vlib_plugin_registration_t vlib_plugin_registration \
diff --git a/src/vpp/api/plugin.c b/src/vpp/api/plugin.c
index c1cc928c217..e8b134173d8 100644
--- a/src/vpp/api/plugin.c
+++ b/src/vpp/api/plugin.c
@@ -180,9 +180,22 @@ int
vat_plugin_init (vat_main_t * vam)
{
plugin_main_t *pm = &vat_plugin_main;
+ u8 *vlib_get_vat_plugin_path (void);
+ u8 *vlib_get_vat_plugin_name_filter (void);
+ u8 *plugin_path;
+ u8 *plugin_name_filter;
+ plugin_path = vlib_get_vat_plugin_path ();
+ plugin_name_filter = vlib_get_vat_plugin_name_filter ();
+
+ if (plugin_path)
+ vat_plugin_path = (char *) plugin_path;
+
+ if (plugin_name_filter)
+ vat_plugin_name_filter = (char *) plugin_name_filter;
pm->plugin_path = format (0, "%s%c", vat_plugin_path, 0);
+
if (vat_plugin_name_filter)
pm->plugin_name_filter = format (0, "%s%c", vat_plugin_name_filter, 0);
diff --git a/src/vpp/api/plugin.h b/src/vpp/api/plugin.h
index c69186287aa..e4f0c646d3b 100644
--- a/src/vpp/api/plugin.h
+++ b/src/vpp/api/plugin.h
@@ -1,4 +1,6 @@
/*
+ * plugin.h: plugin handling
+ *
* Copyright (c) 2015 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -12,9 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * plugin.h: plugin handling
- */
#ifndef __included_plugin_h__
#define __included_plugin_h__
@@ -36,13 +35,18 @@ typedef struct
plugin_info_t *plugin_info;
uword *plugin_by_name_hash;
- /* path and name filter */
+ /* paths and name filters */
u8 *plugin_path;
u8 *plugin_name_filter;
+ u8 *vat_plugin_path;
+ u8 *vat_plugin_name_filter;
- /* convenience */
- vat_main_t *vat_main;
+ /* plugin configs and hash by name */
+ plugin_config_t *configs;
+ uword *config_index_by_name;
+ /* usual */
+ vlib_main_t *vlib_main;
} plugin_main_t;
extern plugin_main_t vat_plugin_main;