diff options
author | Neale Ranns <nranns@cisco.com> | 2019-12-29 23:55:18 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-01-27 20:40:30 +0000 |
commit | 59ff918ea5b86112ffc89054aa38107703354585 (patch) | |
tree | 0e6dc887ead19b7be828954a08b1e15da81ddb58 /src/vnet/gre/gre_api.c | |
parent | 3b37125bdb0251181f90a429a4532b339711cf89 (diff) |
tunnel: Common types for IP tunnels
Type: refactor
Signed-off-by: Neale Ranns <nranns@cisco.com>
Change-Id: I18dcdb7af3e327f6cacdbcb1e52b89f13d6ba6e2
Diffstat (limited to 'src/vnet/gre/gre_api.c')
-rw-r--r-- | src/vnet/gre/gre_api.c | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/src/vnet/gre/gre_api.c b/src/vnet/gre/gre_api.c index be91f758777..619b5fc233c 100644 --- a/src/vnet/gre/gre_api.c +++ b/src/vnet/gre/gre_api.c @@ -25,6 +25,7 @@ #include <vnet/gre/gre.h> #include <vnet/fib/fib_table.h> +#include <vnet/tunnel/tunnel_types_api.h> #include <vnet/ip/ip_types_api.h> #include <vnet/vnet_msg_enum.h> @@ -83,40 +84,6 @@ gre_tunnel_type_encode (gre_tunnel_type_t in) return (out); } -static int -gre_tunnel_mode_decode (vl_api_gre_tunnel_mode_t in, gre_tunnel_mode_t * out) -{ - switch (in) - { -#define _(n, v) \ - case GRE_API_TUNNEL_MODE_##n: \ - *out = GRE_TUNNEL_MODE_##n; \ - return (0); - foreach_gre_tunnel_mode -#undef _ - } - - return (VNET_API_ERROR_INVALID_VALUE_2); -} - -static vl_api_gre_tunnel_mode_t -gre_tunnel_mode_encode (gre_tunnel_mode_t in) -{ - vl_api_gre_tunnel_mode_t out = GRE_API_TUNNEL_MODE_P2P; - - switch (in) - { -#define _(n, v) \ - case GRE_TUNNEL_MODE_##n: \ - out = GRE_API_TUNNEL_MODE_##n; \ - break; - foreach_gre_tunnel_mode -#undef _ - } - - return (out); -} - static void vl_api_gre_tunnel_add_del_t_handler (vl_api_gre_tunnel_add_del_t * mp) { @@ -146,7 +113,7 @@ static void vl_api_gre_tunnel_add_del_t_handler if (rv) goto out; - rv = gre_tunnel_mode_decode (mp->tunnel.mode, &a->mode); + rv = tunnel_mode_decode (mp->tunnel.mode, &a->mode); if (rv) goto out; @@ -185,7 +152,7 @@ static void send_gre_tunnel_details (t->outer_fib_index, t->tunnel_dst.fp_proto)); rmp->tunnel.type = gre_tunnel_type_encode (t->type); - rmp->tunnel.mode = gre_tunnel_mode_encode (t->mode); + rmp->tunnel.mode = tunnel_mode_encode (t->mode); rmp->tunnel.instance = htonl (t->user_instance); rmp->tunnel.sw_if_index = htonl (t->sw_if_index); rmp->tunnel.session_id = htons (t->session_id); |