aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-cp/lisp_api.c
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2017-02-01 08:50:31 +0100
committerFlorin Coras <florin.coras@gmail.com>2017-02-02 07:04:54 +0000
commit05a057bb3af7d83f62a2919ccab57aa0a41b04a9 (patch)
tree4623cde1670e38afa83b7f266f084e83485389cb /src/vnet/lisp-cp/lisp_api.c
parenta93ea428fe60cc3fb64b758f5d97ebf87a07f95f (diff)
LISP: enhance binary part of some APIs
Remote mapping and locator set binary APIs uses zero length arrays defined as 'u8 array[0]' in .api file. This path will change such cases to form 'type_t array[count];' in order to enhance maintainability. Change-Id: I98d0252b441020609c550d48186ed0d8338a3f2d Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/vnet/lisp-cp/lisp_api.c')
-rw-r--r--src/vnet/lisp-cp/lisp_api.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/src/vnet/lisp-cp/lisp_api.c b/src/vnet/lisp-cp/lisp_api.c
index 6f34d02c407..a877540b3ed 100644
--- a/src/vnet/lisp-cp/lisp_api.c
+++ b/src/vnet/lisp-cp/lisp_api.c
@@ -27,6 +27,16 @@
#include <vnet/vnet_msg_enum.h>
+#define vl_api_remote_locator_t_endian vl_noop_handler
+#define vl_api_remote_locator_t_print vl_noop_handler
+#define vl_api_local_locator_t_endian vl_noop_handler
+#define vl_api_local_locator_t_print vl_noop_handler
+
+#define vl_api_lisp_add_del_locator_set_t_endian vl_noop_handler
+#define vl_api_lisp_add_del_locator_set_t_print vl_noop_handler
+#define vl_api_lisp_add_del_remote_mapping_t_endian vl_noop_handler
+#define vl_api_lisp_add_del_remote_mapping_t_print vl_noop_handler
+
#define vl_typedefs /* define message structures */
#include <vnet/vnet_all_api_h.h>
#undef vl_typedefs
@@ -76,36 +86,17 @@ _(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
_(LISP_USE_PETR, lisp_use_petr) \
_(SHOW_LISP_USE_PETR, show_lisp_use_petr) \
-/** Used for transferring locators via VPP API */
-/* *INDENT-OFF* */
-typedef CLIB_PACKED (struct {
- u8 is_ip4; /**< is locator an IPv4 address */
- u8 priority; /**< locator priority */
- u8 weight; /**< locator weight */
- u8 addr[16]; /**< IPv4/IPv6 address */
-}) rloc_t;
-/* *INDENT-ON* */
-
-/** Used for transferring locators via VPP API */
-/* *INDENT-OFF* */
-typedef CLIB_PACKED (struct {
- u32 sw_if_index; /**< locator sw_if_index */
- u8 priority; /**< locator priority */
- u8 weight; /**< locator weight */
-}) ls_locator_t;
-/* *INDENT-ON* */
-
static locator_t *
-unformat_lisp_locs (void *rmt_locs, u32 rloc_num)
+unformat_lisp_locs (vl_api_remote_locator_t * rmt_locs, u32 rloc_num)
{
u32 i;
locator_t *locs = 0, loc;
- rloc_t *r;
+ vl_api_remote_locator_t *r;
for (i = 0; i < rloc_num; i++)
{
/* remote locators */
- r = &((rloc_t *) rmt_locs)[i];
+ r = &rmt_locs[i];
memset (&loc, 0, sizeof (loc));
gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
@@ -125,7 +116,7 @@ vl_api_lisp_add_del_locator_set_t_handler (vl_api_lisp_add_del_locator_set_t *
int rv = 0;
vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
locator_t locator;
- ls_locator_t *ls_loc;
+ vl_api_local_locator_t *ls_loc;
u32 ls_index = ~0, locator_num;
u8 *locator_name = NULL;
int i;
@@ -142,7 +133,7 @@ vl_api_lisp_add_del_locator_set_t_handler (vl_api_lisp_add_del_locator_set_t *
memset (&locator, 0, sizeof (locator));
for (i = 0; i < locator_num; i++)
{
- ls_loc = &((ls_locator_t *) mp->locators)[i];
+ ls_loc = &mp->locators[i];
VALIDATE_SW_IF_INDEX (ls_loc);
locator.sw_if_index = htonl (ls_loc->sw_if_index);