diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2021-06-21 10:57:49 +0000 |
---|---|---|
committer | Filip Tehlar <ftehlar@cisco.com> | 2021-06-21 12:16:13 +0000 |
commit | 53dea2792b55bc2bc1b29a7a1b7169023acae406 (patch) | |
tree | 9c2be5bdca135230da3cd9e606a5bd8f9a1c6819 /src/vnet | |
parent | 9597f08f5788e7ee9d9bc21d8851752b39c6e917 (diff) |
misc: ipfix api cleanup
Use autogenerated code.
Does not change API definitions.
Type: improvement
Change-Id: I864979ce490651bf1f5fed107620e9bc4ca4bf93
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/ipfix-export/flow_api.c | 64 | ||||
-rw-r--r-- | src/vnet/ipfix-export/flow_report.h | 2 | ||||
-rw-r--r-- | src/vnet/vnet_all_api_h.h | 1 |
3 files changed, 10 insertions, 57 deletions
diff --git a/src/vnet/ipfix-export/flow_api.c b/src/vnet/ipfix-export/flow_api.c index f4b3fc8be3b..75a656468db 100644 --- a/src/vnet/ipfix-export/flow_api.c +++ b/src/vnet/ipfix-export/flow_api.c @@ -29,33 +29,13 @@ #include <vnet/ipfix-export/flow_report.h> #include <vnet/ipfix-export/flow_report_classify.h> -#include <vnet/vnet_msg_enum.h> - -#define vl_typedefs /* define message structures */ -#include <vnet/vnet_all_api_h.h> -#undef vl_typedefs - -#define vl_endianfun /* define message structures */ -#include <vnet/vnet_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 <vnet/vnet_all_api_h.h> -#undef vl_printfun +#include <vnet/format_fns.h> +#include <vnet/ipfix-export/ipfix_export.api_enum.h> +#include <vnet/ipfix-export/ipfix_export.api_types.h> +#define REPLY_MSG_ID_BASE frm->msg_id_base #include <vlibapi/api_helper_macros.h> -#define foreach_vpe_api_msg \ -_(SET_IPFIX_EXPORTER, set_ipfix_exporter) \ -_(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump) \ -_(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream) \ -_(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump) \ -_(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del) \ -_(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump) \ -_(IPFIX_FLUSH, ipfix_flush) - static void vl_api_set_ipfix_exporter_t_handler (vl_api_set_ipfix_exporter_t * mp) { @@ -366,6 +346,7 @@ static void static void vl_api_ipfix_flush_t_handler (vl_api_ipfix_flush_t * mp) { + flow_report_main_t *frm = &flow_report_main; vl_api_ipfix_flush_reply_t *rmp; vl_api_registration_t *reg; vlib_main_t *vm = vlib_get_main (); @@ -382,44 +363,15 @@ vl_api_ipfix_flush_t_handler (vl_api_ipfix_flush_t * mp) REPLY_MACRO (VL_API_IPFIX_FLUSH_REPLY); } -/* - * flow_api_hookup - * Add vpe's API message handlers to the table. - * vlib has already mapped shared memory and - * added the client registration handlers. - * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process() - */ -#define vl_msg_name_crc_list -#include <vnet/vnet_all_api_h.h> -#undef vl_msg_name_crc_list - -static void -setup_message_id_table (api_main_t * am) -{ -#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); - foreach_vl_msg_name_crc_ipfix_export; -#undef _ -} - +#include <vnet/ipfix-export/ipfix_export.api.c> static clib_error_t * flow_api_hookup (vlib_main_t * vm) { - api_main_t *am = vlibapi_get_main (); - -#define _(N,n) \ - vl_msg_api_set_handlers(VL_API_##N, #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_msg; -#undef _ - + flow_report_main_t *frm = &flow_report_main; /* * Set up the (msg_name, crc, message-id) table */ - setup_message_id_table (am); + REPLY_MSG_ID_BASE = setup_message_id_table (); return 0; } diff --git a/src/vnet/ipfix-export/flow_report.h b/src/vnet/ipfix-export/flow_report.h index 98da146427a..f40015879c4 100644 --- a/src/vnet/ipfix-export/flow_report.h +++ b/src/vnet/ipfix-export/flow_report.h @@ -134,6 +134,8 @@ typedef struct flow_report_main /* convenience variables */ vlib_main_t *vlib_main; vnet_main_t *vnet_main; + + u16 msg_id_base; } flow_report_main_t; extern flow_report_main_t flow_report_main; diff --git a/src/vnet/vnet_all_api_h.h b/src/vnet/vnet_all_api_h.h index 7e26a9b7745..47e22795cbf 100644 --- a/src/vnet/vnet_all_api_h.h +++ b/src/vnet/vnet_all_api_h.h @@ -47,7 +47,6 @@ #include <vnet/mpls/mpls.api.h> #include <vnet/srv6/sr.api.h> #include <vnet/srmpls/sr_mpls.api.h> -#include <vnet/ipfix-export/ipfix_export.api.h> #include <vnet/policer/policer.api.h> #include <vnet/ethernet/p2p_ethernet.api.h> #include <vnet/tcp/tcp.api.h> |