summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS5
-rw-r--r--src/plugins/ct6/CMakeLists.txt4
-rw-r--r--src/plugins/ct6/ct6.api11
-rw-r--r--src/plugins/ct6/ct6.c74
-rw-r--r--src/plugins/ct6/ct6_all_api_h.h19
-rw-r--r--src/plugins/ct6/ct6_msg_enum.h31
-rw-r--r--src/plugins/ct6/ct6_test.c89
7 files changed, 14 insertions, 219 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index b31ee737f37..c77ff745020 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -538,6 +538,11 @@ I: l2e
M: Neale Ranns <nranns@cisco.com>
F: src/plugins/l2e/
+IPv6 Connection Tracker
+I: ct6
+M: Dave Barach <dave@barachs.net>
+F: src/plugins/ct6
+
THE REST
I: misc
C: Contact vpp-dev Mailing List <vpp-dev@fd.io>
diff --git a/src/plugins/ct6/CMakeLists.txt b/src/plugins/ct6/CMakeLists.txt
index 069b33ad2d0..74f6c60c634 100644
--- a/src/plugins/ct6/CMakeLists.txt
+++ b/src/plugins/ct6/CMakeLists.txt
@@ -26,10 +26,6 @@ add_vpp_plugin(ct6
API_FILES
ct6.api
- INSTALL_HEADERS
- ct6_all_api_h.h
- ct6_msg_enum.h
-
API_TEST_SOURCES
ct6_test.c
)
diff --git a/src/plugins/ct6/ct6.api b/src/plugins/ct6/ct6.api
index 67af42fd9fe..10a28251a20 100644
--- a/src/plugins/ct6/ct6.api
+++ b/src/plugins/ct6/ct6.api
@@ -1,7 +1,7 @@
/* Define a simple enable-disable binary API to control the feature */
-define ct6_enable_disable {
+autoreply define ct6_enable_disable {
/* Client identifier, set from api_main.my_client_index */
u32 client_index;
@@ -16,12 +16,5 @@ define ct6_enable_disable {
/* Interface handle */
u32 sw_if_index;
-};
-
-define ct6_enable_disable_reply {
- /* From the request */
- u32 context;
-
- /* Return value, zero means all OK */
- i32 retval;
+ option vat_help = "<intfc> [disable]";
};
diff --git a/src/plugins/ct6/ct6.c b/src/plugins/ct6/ct6.c
index 3dfa09f1875..15fa44a5d45 100644
--- a/src/plugins/ct6/ct6.c
+++ b/src/plugins/ct6/ct6.c
@@ -24,39 +24,14 @@
#include <vpp/app/version.h>
/* define message IDs */
-#include <ct6/ct6_msg_enum.h>
-
-/* define message structures */
-#define vl_typedefs
-#include <ct6/ct6_all_api_h.h>
-#undef vl_typedefs
-
-/* define generated endian-swappers */
-#define vl_endianfun
-#include <ct6/ct6_all_api_h.h>
-#undef vl_endianfun
-
-/* instantiate all the print functions we know about */
-#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
-#define vl_printfun
-#include <ct6/ct6_all_api_h.h>
-#undef vl_printfun
-
-/* Get the API version number */
-#define vl_api_version(n,v) static u32 api_version=(v);
-#include <ct6/ct6_all_api_h.h>
-#undef vl_api_version
+#include <ct6/ct6.api_enum.h>
+#include <ct6/ct6.api_types.h>
#define REPLY_MSG_ID_BASE cmp->msg_id_base
#include <vlibapi/api_helper_macros.h>
ct6_main_t ct6_main;
-/* List of message types that this plugin understands */
-
-#define foreach_ct6_plugin_api_msg \
-_(CT6_ENABLE_DISABLE, ct6_enable_disable)
-
/* Action function shared between message handler and debug CLI */
static void
@@ -209,59 +184,18 @@ static void vl_api_ct6_enable_disable_t_handler
REPLY_MACRO (VL_API_CT6_ENABLE_DISABLE_REPLY);
}
-/* Set up the API message handling tables */
-static clib_error_t *
-ct6_plugin_api_hookup (vlib_main_t * vm)
-{
- ct6_main_t *cmp = &ct6_main;
-#define _(N,n) \
- vl_msg_api_set_handlers((VL_API_##N + cmp->msg_id_base), \
- #n, \
- vl_api_##n##_t_handler, \
- vl_noop_handler, \
- vl_api_##n##_t_endian, \
- vl_api_##n##_t_print, \
- sizeof(vl_api_##n##_t), 1);
- foreach_ct6_plugin_api_msg;
-#undef _
-
- return 0;
-}
-
-#define vl_msg_name_crc_list
-#include <ct6/ct6_all_api_h.h>
-#undef vl_msg_name_crc_list
-
-static void
-setup_message_id_table (ct6_main_t * cmp, api_main_t * am)
-{
-#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + cmp->msg_id_base);
- foreach_vl_msg_name_crc_ct6;
-#undef _
-}
-
+#include <ct6/ct6.api.c>
static clib_error_t *
ct6_init (vlib_main_t * vm)
{
ct6_main_t *cmp = &ct6_main;
clib_error_t *error = 0;
- u8 *name;
cmp->vlib_main = vm;
cmp->vnet_main = vnet_get_main ();
- name = format (0, "ct6_%08x%c", api_version, 0);
-
/* Ask for a correctly-sized block of API message decode slots */
- cmp->msg_id_base = vl_msg_api_get_msg_ids
- ((char *) name, VL_MSG_FIRST_AVAILABLE);
-
- error = ct6_plugin_api_hookup (vm);
-
- /* Add our API messages to the global name_crc hash table */
- setup_message_id_table (cmp, &api_main);
-
- vec_free (name);
+ cmp->msg_id_base = setup_message_id_table ();
/*
* Set default parameters...
diff --git a/src/plugins/ct6/ct6_all_api_h.h b/src/plugins/ct6/ct6_all_api_h.h
deleted file mode 100644
index 3642216cefa..00000000000
--- a/src/plugins/ct6/ct6_all_api_h.h
+++ /dev/null
@@ -1,19 +0,0 @@
-
-/*
- * ct6_all_api_h.h - skeleton vpp engine plug-in api #include file
- *
- * Copyright (c) <current-year> <your-organization>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* Include the generated file, see BUILT_SOURCES in Makefile.am */
-#include <ct6/ct6.api.h>
diff --git a/src/plugins/ct6/ct6_msg_enum.h b/src/plugins/ct6/ct6_msg_enum.h
deleted file mode 100644
index 05b1751550d..00000000000
--- a/src/plugins/ct6/ct6_msg_enum.h
+++ /dev/null
@@ -1,31 +0,0 @@
-
-/*
- * ct6_msg_enum.h - skeleton vpp engine plug-in message enumeration
- *
- * Copyright (c) <current-year> <your-organization>
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef included_ct6_msg_enum_h
-#define included_ct6_msg_enum_h
-
-#include <vppinfra/byte_order.h>
-
-#define vl_msg_id(n,h) n,
-typedef enum {
-#include <ct6/ct6_all_api_h.h>
- /* We'll want to know how many messages IDs we need... */
- VL_MSG_FIRST_AVAILABLE,
-} vl_msg_id_t;
-#undef vl_msg_id
-
-#endif /* included_ct6_msg_enum_h */
diff --git a/src/plugins/ct6/ct6_test.c b/src/plugins/ct6/ct6_test.c
index 2f985a60970..78663ef6251 100644
--- a/src/plugins/ct6/ct6_test.c
+++ b/src/plugins/ct6/ct6_test.c
@@ -22,30 +22,8 @@
uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
/* Declare message IDs */
-#include <ct6/ct6_msg_enum.h>
-
-/* define message structures */
-#define vl_typedefs
-#include <ct6/ct6_all_api_h.h>
-#undef vl_typedefs
-
-/* declare message handlers for each api */
-
-#define vl_endianfun /* define message structures */
-#include <ct6/ct6_all_api_h.h>
-#undef vl_endianfun
-
-/* instantiate all the print functions we know about */
-#define vl_print(handle, ...)
-#define vl_printfun
-#include <ct6/ct6_all_api_h.h>
-#undef vl_printfun
-
-/* Get the API version number. */
-#define vl_api_version(n,v) static u32 api_version=(v);
-#include <ct6/ct6_all_api_h.h>
-#undef vl_api_version
-
+#include <ct6/ct6.api_enum.h>
+#include <ct6/ct6.api_types.h>
typedef struct
{
@@ -59,33 +37,6 @@ ct6_test_main_t ct6_test_main;
#define __plugin_msg_base ct6_test_main.msg_id_base
#include <vlibapi/vat_helper_macros.h>
-#define foreach_standard_reply_retval_handler \
-_(ct6_enable_disable_reply)
-
-#define _(n) \
- static void vl_api_##n##_t_handler \
- (vl_api_##n##_t * mp) \
- { \
- vat_main_t * vam = ct6_test_main.vat_main; \
- i32 retval = ntohl(mp->retval); \
- if (vam->async_mode) { \
- vam->async_errors += (retval < 0); \
- } else { \
- vam->retval = retval; \
- vam->result_ready = 1; \
- } \
- }
-foreach_standard_reply_retval_handler;
-#undef _
-
-/*
- * Table of message reply handlers, must include boilerplate handlers
- * we just generated
- */
-#define foreach_vpe_api_reply_msg \
-_(CT6_ENABLE_DISABLE_REPLY, ct6_enable_disable_reply)
-
-
static int
api_ct6_enable_disable (vat_main_t * vam)
{
@@ -139,41 +90,7 @@ api_ct6_enable_disable (vat_main_t * vam)
return ret;
}
-/*
- * List of messages that the api test plugin sends,
- * and that the data plane plugin processes
- */
-#define foreach_vpe_api_msg \
-_(ct6_enable_disable, "<intfc> [disable]")
-
-static void
-ct6_api_hookup (vat_main_t * vam)
-{
- ct6_test_main_t *ctmp = &ct6_test_main;
- /* Hook up handlers for replies from the data plane plug-in */
-#define _(N,n) \
- vl_msg_api_set_handlers((VL_API_##N + ctmp->msg_id_base), \
- #n, \
- vl_api_##n##_t_handler, \
- vl_noop_handler, \
- vl_api_##n##_t_endian, \
- vl_api_##n##_t_print, \
- sizeof(vl_api_##n##_t), 1);
- foreach_vpe_api_reply_msg;
-#undef _
-
- /* API messages we can send */
-#define _(n,h) hash_set_mem (vam->function_by_name, #n, api_##n);
- foreach_vpe_api_msg;
-#undef _
-
- /* Help strings */
-#define _(n,h) hash_set_mem (vam->help_by_name, #n, h);
- foreach_vpe_api_msg;
-#undef _
-}
-
-VAT_PLUGIN_REGISTER (ct6);
+#include <ct6/ct6.api_test.c>
/*
* fd.io coding-style-patch-verification: ON