ipip: Tunnel flags controlling copying data to/from payload/encap
[vpp.git] / src / vnet / ipip / ipip_types_api.c
1 /*
2  * ipip_api.c - ipip api
3  *
4  * Copyright (c) 2018 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #include <vnet/api_errno.h>
19 #include <vnet/ipip/ipip_types_api.h>
20
21 #include <vnet/ipip/ipip_types.api_enum.h>
22 #include <vnet/ipip/ipip_types.api_types.h>
23
24
25 STATIC_ASSERT (sizeof (vl_api_ipip_tunnel_flags_t) ==
26                sizeof (ipip_tunnel_flags_t),
27                "IPIP tunnel API and internal flags enum size differ");
28
29 int
30 ipip_tunnel_flags_decode (vl_api_ipip_tunnel_flags_t f,
31                           ipip_tunnel_flags_t * o)
32 {
33   if (f & ~IPIP_TUNNEL_FLAG_MASK)
34     /* unknown flags set */
35     return (VNET_API_ERROR_INVALID_VALUE_2);
36
37   *o = (ipip_tunnel_flags_t) f;
38   return (0);
39 }
40
41 vl_api_ipip_tunnel_flags_t
42 ipip_tunnel_flags_encode (ipip_tunnel_flags_t f)
43 {
44   return ((vl_api_ipip_tunnel_flags_t) f);
45 }
46
47 /*
48  * fd.io coding-style-patch-verification: ON
49  *
50  * Local Variables:
51  * eval: (c-set-style "gnu")
52  * End:
53  */