summaryrefslogtreecommitdiffstats
path: root/src/plugins/acl
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/acl')
-rw-r--r--src/plugins/acl/CMakeLists.txt2
-rw-r--r--src/plugins/acl/acl.api14
-rw-r--r--src/plugins/acl/acl_all_api_h.h21
-rw-r--r--src/plugins/acl/acl_msg_enum.h28
-rw-r--r--src/plugins/acl/acl_test.c151
5 files changed, 44 insertions, 172 deletions
diff --git a/src/plugins/acl/CMakeLists.txt b/src/plugins/acl/CMakeLists.txt
index 0977129bafd..a34ad5352f6 100644
--- a/src/plugins/acl/CMakeLists.txt
+++ b/src/plugins/acl/CMakeLists.txt
@@ -30,7 +30,5 @@ add_vpp_plugin(acl
acl_test.c
INSTALL_HEADERS
- acl_all_api_h.h
- acl_msg_enum.h
manual_fns.h
)
diff --git a/src/plugins/acl/acl.api b/src/plugins/acl/acl.api
index b35267d28ed..eb0594650d0 100644
--- a/src/plugins/acl/acl.api
+++ b/src/plugins/acl/acl.api
@@ -109,6 +109,7 @@ manual_print manual_endian define acl_add_replace
u8 tag[64]; /* What gets in here gets out in the corresponding tag field when dumping the ACLs. */
u32 count;
vl_api_acl_rule_t r[count];
+ option vat_help = "<acl-idx> [<ipv4|ipv6> <permit|permit+reflect|deny|action N> [src IP/plen] [dst IP/plen] [sport X-Y] [dport X-Y] [proto P] [tcpflags FL MASK], ... , ...";
};
/** \brief Reply to add/replace ACL
@@ -135,6 +136,7 @@ autoreply manual_print define acl_del
u32 client_index;
u32 context;
u32 acl_index;
+ option vat_help = "<acl-idx>";
};
/* acl_interface_add_del(_reply) to be deprecated in lieu of acl_interface_set_acl_list */
@@ -160,6 +162,7 @@ autoreply manual_print define acl_interface_add_del
u8 is_input;
u32 sw_if_index;
u32 acl_index;
+ option vat_help = "<intfc> | sw_if_index <if-idx> [add|del] [input|output] acl <acl-idx>";
};
/** \brief Set the vector of input/output ACLs checked for an interface
@@ -179,6 +182,7 @@ autoreply manual_print define acl_interface_set_acl_list
u8 count;
u8 n_input; /* First n_input ACLs are set as a list of input ACLs, the rest are applied as output */
u32 acls[count];
+ option vat_help = "<intfc> | sw_if_index <if-idx> input [acl-idx list] output [acl-idx list]";
};
/** \brief Reply to set the ACL list on an interface
@@ -197,6 +201,7 @@ define acl_dump
u32 client_index;
u32 context;
u32 acl_index; /* ~0 for all ACLs */
+ option vat_help = "[<acl-idx>]";
};
/** \brief Details about a single ACL contents
@@ -227,6 +232,7 @@ define acl_interface_list_dump
u32 client_index;
u32 context;
u32 sw_if_index; /* ~0 for all interfaces */
+ option vat_help = "[<intfc> | sw_if_index <if-idx>]";
};
/** \brief Details about a single ACL contents
@@ -261,6 +267,7 @@ manual_endian manual_print define macip_acl_add
u8 tag[64];
u32 count;
vl_api_macip_acl_rule_t r[count];
+ option vat_help = "...";
};
/** \brief Reply to add MACIP ACL
@@ -293,6 +300,7 @@ manual_endian manual_print define macip_acl_add_replace
u8 tag[64];
u32 count;
vl_api_macip_acl_rule_t r[count];
+ option vat_help = "<acl-idx> [<ipv4|ipv6> <permit|deny|action N> [count <count>] [src] ip <ipaddress/[plen]> mac <mac> mask <mac_mask>, ... , ...";
};
/** \brief Reply to add/replace MACIP ACL
@@ -319,6 +327,7 @@ autoreply manual_print define macip_acl_del
u32 client_index;
u32 context;
u32 acl_index;
+ option vat_help = "<acl-idx>";
};
/** \brief Add or delete a MACIP ACL to/from interface
@@ -337,6 +346,7 @@ autoreply manual_print define macip_acl_interface_add_del
/* MACIP ACLs are always input */
u32 sw_if_index;
u32 acl_index;
+ option vat_help = "<intfc> | sw_if_index <if-idx> [add|del] acl <acl-idx>";
};
/** \brief Dump one or all defined MACIP ACLs
@@ -350,6 +360,7 @@ define macip_acl_dump
u32 client_index;
u32 context;
u32 acl_index; /* ~0 for all ACLs */
+ option vat_help = "[<acl-idx>]";
};
/** \brief Details about one MACIP ACL
@@ -438,6 +449,7 @@ autoreply manual_print define acl_interface_set_etype_whitelist
u8 count; /* Total number of ethertypes in the whitelist */
u8 n_input; /* first n_input ethertypes are input, the rest - output */
u16 whitelist[count];
+ option vat_help = "<intfc> | sw_if_index <if-idx> input [ethertype list] output [ethertype list]";
};
/** \brief Dump the list(s) of Ethertype whitelists applied to specific or all interfaces
@@ -451,6 +463,7 @@ define acl_interface_etype_whitelist_dump
u32 client_index;
u32 context;
u32 sw_if_index; /* ~0 for all interfaces */
+ option vat_help = "[<intfc> | sw_if_index <if-idx>]";
};
/** \brief Details about ethertype whitelist on a single interface
@@ -481,4 +494,5 @@ autoreply define acl_stats_intf_counters_enable
u32 client_index;
u32 context;
bool enable;
+ option vat_help = "[disable]";
};
diff --git a/src/plugins/acl/acl_all_api_h.h b/src/plugins/acl/acl_all_api_h.h
deleted file mode 100644
index 2a9d25d0bce..00000000000
--- a/src/plugins/acl/acl_all_api_h.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2016 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.
- * 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 */
-
-#ifdef vl_printfun
-#include <acl/manual_fns.h>
-#endif
-
-#include <acl/acl.api.h>
diff --git a/src/plugins/acl/acl_msg_enum.h b/src/plugins/acl/acl_msg_enum.h
deleted file mode 100644
index 14d8b48c207..00000000000
--- a/src/plugins/acl/acl_msg_enum.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2016 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.
- * 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_acl_msg_enum_h
-#define included_acl_msg_enum_h
-
-#include <vppinfra/byte_order.h>
-
-#define vl_msg_id(n,h) n,
-typedef enum {
-#include <acl/acl_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
diff --git a/src/plugins/acl/acl_test.c b/src/plugins/acl/acl_test.c
index ec951ad7057..a35f050fcba 100644
--- a/src/plugins/acl/acl_test.c
+++ b/src/plugins/acl/acl_test.c
@@ -31,28 +31,14 @@
uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
/* Declare message IDs */
-#include <acl/acl_msg_enum.h>
-
-/* define message structures */
-#define vl_typedefs
-#include <acl/acl_all_api_h.h>
-#undef vl_typedefs
-
-/* define message structures */
-#define vl_endianfun
-#include <acl/acl_all_api_h.h>
-#undef vl_endianfun
-
-/* instantiate all the print functions we know about */
+#include <acl/acl.api_enum.h>
+#include <acl/acl.api_types.h>
#define vl_print(handle, ...)
-#define vl_printfun
-#include <acl/acl_all_api_h.h>
-#undef vl_printfun
-
-/* Get the API version number. */
-#define vl_api_version(n,v) static u32 api_version=(v);
-#include <acl/acl_all_api_h.h>
-#undef vl_api_version
+#include <acl/manual_fns.h>
+#undef vl_print
+#define vl_endianfun /* define message structures */
+#include <acl/acl.api.h>
+#undef vl_endianfun
typedef struct {
/* API message ID base */
@@ -62,15 +48,6 @@ typedef struct {
acl_test_main_t acl_test_main;
-#define foreach_standard_reply_retval_handler \
-_(acl_del_reply) \
-_(acl_interface_add_del_reply) \
-_(macip_acl_interface_add_del_reply) \
-_(acl_interface_set_acl_list_reply) \
-_(acl_interface_set_etype_whitelist_reply) \
-_(macip_acl_del_reply) \
-_(acl_stats_intf_counters_enable_reply)
-
#define foreach_reply_retval_aclindex_handler \
_(acl_add_replace_reply) \
_(macip_acl_add_reply) \
@@ -85,22 +62,6 @@ _(macip_acl_add_replace_reply)
if (vam->async_mode) { \
vam->async_errors += (retval < 0); \
} else { \
- vam->retval = retval; \
- vam->result_ready = 1; \
- } \
- }
-foreach_standard_reply_retval_handler;
-#undef _
-
-#define _(n) \
- static void vl_api_##n##_t_handler \
- (vl_api_##n##_t * mp) \
- { \
- vat_main_t * vam = acl_test_main.vat_main; \
- i32 retval = ntohl(mp->retval); \
- if (vam->async_mode) { \
- vam->async_errors += (retval < 0); \
- } else { \
clib_warning("ACL index: %d", ntohl(mp->acl_index)); \
vam->retval = retval; \
vam->result_ready = 1; \
@@ -156,6 +117,13 @@ static void vl_api_acl_interface_list_details_t_handler
vam->result_ready = 1;
}
+static void vl_api_macip_acl_interface_list_details_t_handler
+(vl_api_macip_acl_interface_list_details_t * mp)
+{
+ // NOT YET IMPLEMENTED
+}
+
+
static void vl_api_acl_interface_etype_whitelist_details_t_handler
(vl_api_acl_interface_etype_whitelist_details_t * mp)
{
@@ -289,31 +257,6 @@ static void vl_api_acl_plugin_control_ping_reply_t_handler
}
}
-
-/*
- * Table of message reply handlers, must include boilerplate handlers
- * we just generated
- */
-#define foreach_vpe_api_reply_msg \
-_(ACL_ADD_REPLACE_REPLY, acl_add_replace_reply) \
-_(ACL_DEL_REPLY, acl_del_reply) \
-_(ACL_INTERFACE_ADD_DEL_REPLY, acl_interface_add_del_reply) \
-_(ACL_INTERFACE_SET_ACL_LIST_REPLY, acl_interface_set_acl_list_reply) \
-_(ACL_INTERFACE_SET_ETYPE_WHITELIST_REPLY, acl_interface_set_etype_whitelist_reply) \
-_(ACL_INTERFACE_ETYPE_WHITELIST_DETAILS, acl_interface_etype_whitelist_details) \
-_(ACL_INTERFACE_LIST_DETAILS, acl_interface_list_details) \
-_(ACL_DETAILS, acl_details) \
-_(MACIP_ACL_ADD_REPLY, macip_acl_add_reply) \
-_(MACIP_ACL_ADD_REPLACE_REPLY, macip_acl_add_replace_reply) \
-_(MACIP_ACL_DEL_REPLY, macip_acl_del_reply) \
-_(MACIP_ACL_DETAILS, macip_acl_details) \
-_(MACIP_ACL_INTERFACE_ADD_DEL_REPLY, macip_acl_interface_add_del_reply) \
-_(MACIP_ACL_INTERFACE_GET_REPLY, macip_acl_interface_get_reply) \
-_(ACL_PLUGIN_CONTROL_PING_REPLY, acl_plugin_control_ping_reply) \
-_(ACL_PLUGIN_GET_VERSION_REPLY, acl_plugin_get_version_reply) \
-_(ACL_PLUGIN_GET_CONN_TABLE_MAX_ENTRIES_REPLY,acl_plugin_get_conn_table_max_entries_reply) \
-_(ACL_STATS_INTF_COUNTERS_ENABLE_REPLY, acl_stats_intf_counters_enable_reply)
-
static int api_acl_plugin_get_version (vat_main_t * vam)
{
acl_test_main_t * sm = &acl_test_main;
@@ -367,6 +310,16 @@ static int api_macip_acl_interface_get (vat_main_t * vam)
} while (0)
+/* NOT YET IMPLEMENTED */
+static int api_acl_plugin_control_ping (vat_main_t * vam)
+{
+ return 0;
+}
+static int api_macip_acl_interface_list_dump (vat_main_t * vam)
+{
+ return 0;
+}
+
static int api_acl_add_replace (vat_main_t * vam)
{
acl_test_main_t * sm = &acl_test_main;
@@ -1496,56 +1449,12 @@ static int api_macip_acl_add_replace (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 \
-_(acl_plugin_get_version, "") \
-_(acl_add_replace, "<acl-idx> [<ipv4|ipv6> <permit|permit+reflect|deny|action N> [src IP/plen] [dst IP/plen] [sport X-Y] [dport X-Y] [proto P] [tcpflags FL MASK], ... , ...") \
-_(acl_add_replace_from_file, "filename <file> [permit] [append-default-permit]") \
-_(acl_del, "<acl-idx>") \
-_(acl_dump, "[<acl-idx>]") \
-_(acl_interface_add_del, "<intfc> | sw_if_index <if-idx> [add|del] [input|output] acl <acl-idx>") \
-_(acl_interface_set_acl_list, "<intfc> | sw_if_index <if-idx> input [acl-idx list] output [acl-idx list]") \
-_(acl_interface_set_etype_whitelist, "<intfc> | sw_if_index <if-idx> input [ethertype list] output [ethertype list]") \
-_(acl_interface_etype_whitelist_dump, "[<intfc> | sw_if_index <if-idx>]") \
-_(acl_interface_list_dump, "[<intfc> | sw_if_index <if-idx>]") \
-_(macip_acl_add, "...") \
-_(macip_acl_add_replace, "<acl-idx> [<ipv4|ipv6> <permit|deny|action N> [count <count>] [src] ip <ipaddress/[plen]> mac <mac> mask <mac_mask>, ... , ...") \
-_(macip_acl_del, "<acl-idx>")\
-_(macip_acl_dump, "[<acl-idx>]") \
-_(macip_acl_interface_add_del, "<intfc> | sw_if_index <if-idx> [add|del] acl <acl-idx>") \
-_(macip_acl_interface_get, "") \
-_(acl_plugin_get_conn_table_max_entries, "") \
-_(acl_stats_intf_counters_enable, "[disable]")
-
-
-static
-void acl_api_hookup (vat_main_t *vam)
+#define VL_API_LOCAL_SETUP_MESSAGE_ID_TABLE local_setup_message_id_table
+static void local_setup_message_id_table (vat_main_t * vam)
{
- acl_test_main_t * sm = &acl_test_main;
- /* Hook up handlers for replies from the data plane plug-in */
-#define _(N,n) \
- vl_msg_api_set_handlers((VL_API_##N + sm->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 _
+ hash_set_mem (vam->function_by_name, "acl_add_replace_from_file", api_acl_add_replace_from_file);
+ hash_set_mem (vam->help_by_name, "acl_add_replace_from_file",
+ "filename <file> [permit] [append-default-permit]");
}
-VAT_PLUGIN_REGISTER(acl);
+#include <acl/acl.api_test.c>