aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/examples/sample-plugin/sample/sample.c27
-rw-r--r--src/examples/sample-plugin/sample/sample.h4
-rw-r--r--src/vlib-api.am2
3 files changed, 10 insertions, 23 deletions
diff --git a/src/examples/sample-plugin/sample/sample.c b/src/examples/sample-plugin/sample/sample.c
index 603cb2d0..7588dbc0 100644
--- a/src/examples/sample-plugin/sample/sample.c
+++ b/src/examples/sample-plugin/sample/sample.c
@@ -79,26 +79,11 @@ do { \
#define foreach_sample_plugin_api_msg \
_(SAMPLE_MACSWAP_ENABLE_DISABLE, sample_macswap_enable_disable)
-/*
- * This routine exists to convince the vlib plugin framework that
- * we haven't accidentally copied a random .dll into the plugin directory.
- *
- * Also collects global variable pointers passed from the vpp engine
- */
-
-clib_error_t *
-vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h,
- int from_early_init)
-{
- sample_main_t * sm = &sample_main;
- clib_error_t * error = 0;
-
- sm->vlib_main = vm;
- sm->vnet_main = h->vnet_main;
- sm->ethernet_main = h->ethernet_main;
-
- return error;
-}
+/* *INDENT-OFF* */
+VLIB_PLUGIN_REGISTER () = {
+ .version = SAMPLE_PLUGIN_BUILD_VER,
+};
+/* *INDENT-ON* */
/* Action function shared between message handler and debug CLI */
@@ -229,6 +214,8 @@ static clib_error_t * sample_init (vlib_main_t * vm)
clib_error_t * error = 0;
u8 * name;
+ sm->vnet_main = vnet_get_main ();
+
name = format (0, "sample_%08x%c", api_version, 0);
/* Ask for a correctly-sized block of API message decode slots */
diff --git a/src/examples/sample-plugin/sample/sample.h b/src/examples/sample-plugin/sample/sample.h
index 6137ffff..c9778f74 100644
--- a/src/examples/sample-plugin/sample/sample.h
+++ b/src/examples/sample-plugin/sample/sample.h
@@ -28,13 +28,13 @@ typedef struct {
u16 msg_id_base;
/* convenience */
- vlib_main_t * vlib_main;
vnet_main_t * vnet_main;
- ethernet_main_t * ethernet_main;
} sample_main_t;
sample_main_t sample_main;
extern vlib_node_registration_t sample_node;
+#define SAMPLE_PLUGIN_BUILD_VER "1.0"
+
#endif /* __included_sample_h__ */
diff --git a/src/vlib-api.am b/src/vlib-api.am
index 6312f93d..c05929b1 100644
--- a/src/vlib-api.am
+++ b/src/vlib-api.am
@@ -34,7 +34,7 @@ libvlibapi_la_SOURCES = \
vlibapi/api_shared.c \
vlibapi/node_serialize.c
-nobase_include_HEADERS += vlibapi/api.h vlibapi/api_helper_macros.h
+nobase_include_HEADERS += vlibapi/api.h vlibapi/api_helper_macros.h vlibapi/vat_helper_macros.h
libvlibmemoryclient_la_DEPENDENCIES = libvppinfra.la libsvm.la libvlib.la libvlibmemory.la libvlibapi.la
libvlibmemoryclient_la_LIBADD = $(libvlibmemoryclient_la_DEPENDENCIES) -lpthread