#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
ct6_main_t *cmp = &ct6_main;
int rv;
+ VALIDATE_SW_IF_INDEX (mp);
+
if (mp->is_inside)
rv = ct6_in2out_enable_disable (cmp, ntohl (mp->sw_if_index),
(int) (mp->enable_disable));
rv = ct6_out2in_enable_disable (cmp, ntohl (mp->sw_if_index),
(int) (mp->enable_disable));
+ BAD_SW_IF_INDEX_LABEL;
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...
{
.arc_name = "interface-output",
.node_name = "ct6-in2out",
- .runs_before = VNET_FEATURES ("interface-output"),
+ .runs_before = VNET_FEATURES ("interface-tx"),
};
/* *INDENT-ON */
VLIB_PLUGIN_REGISTER () =
{
.version = VPP_BUILD_VER,
- .description = "ipv6 connection tracker",
+ .description = "IPv6 Connection Tracker",
};
/* *INDENT-ON* */
if (s0 == 0)
{
- s = format (s, "\n%6s%6s%20s%6s%20s%6s",
+ s = format (s, "\n%6s%6s%40s%6s%40s%6s",
"Sess", "Prot", "Src", "Sport", "Dst", "Dport");
return s;
}
- s = format (s, "\n%6d%6d%20U%6u%20U%6u",
+ s = format (s, "\n%6d%6d%40U%6u%40U%6u",
s0 - cmp->sessions[i], s0->key.proto,
format_ip6_address, &s0->key.src,
clib_net_to_host_u16 (s0->key.sport),