tunnel: support copying TTL and flow label from inner to outer
[vpp.git] / src / vnet / tunnel / tunnel_types.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2019 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 option version = "1.0.1";
17
18 import "vnet/interface_types.api";
19 import "vnet/ip/ip_types.api";
20
21 /**
22  * Flags controlling tunnel behaviour
23  */
24 enum tunnel_encap_decap_flags : u8
25 {
26   TUNNEL_API_ENCAP_DECAP_FLAG_NONE = 0,
27   /** at encap, copy the DF bit of the payload into the tunnel header */
28   TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF = 0x1,
29   /** at encap, set the DF bit in the tunnel header */
30   TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF = 0x2,
31   /** at encap, copy the DSCP bits of the payload into the tunnel header */
32   TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP = 0x4,
33   /** at encap, copy the ECN bit of the payload into the tunnel header */
34   TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN = 0x8,
35   /** at decap, copy the ECN bit of the tunnel header into the payload */
36   TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN = 0x10,
37   /** at encap, compute flow hash on the inner packet for more entropy */
38   TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH = 0x20 [backwards_compatible],
39   /** at encap, copy the hop-limit/TTL of the payload into the tunnel header */
40   TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_HOP_LIMIT = 0x40 [backwards_compatible],
41   /** at encap, copy the Flow Label of the payload into the tunnel header */
42   TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_FLOW_LABEL = 0x80 [backwards_compatible],
43 };
44
45 /**
46  * tunnel mode
47  */
48 enum tunnel_mode : u8
49 {
50   /** point-to-point */
51   TUNNEL_API_MODE_P2P = 0,
52   /** multi-point */
53   TUNNEL_API_MODE_MP,
54 };
55
56 /**
57  * tunnel mode
58  */
59 enumflag tunnel_flags : u8
60 {
61   /**
62    * the tunnel's MTU tracks the MTU of its destination
63    *  Currently NOT IMPLEMENTATION (this is a API place-holder)
64    */
65   TUNNEL_API_FLAG_TRACK_MTU = 0x1,
66 };
67
68 /**
69  * An IP{v4,v6} tunnel.
70  */
71 typedef tunnel
72 {
73   /** If non-~0, specifies a custom dev instance */
74   u32 instance;
75   /** Tunnel source and destination address */
76   vl_api_address_t src;
77   vl_api_address_t dst;
78   /** ignored on create, set in details/dump */
79   vl_api_interface_index_t sw_if_index;
80   /** The table ID in which the source and destination addresses are valid */
81   u32 table_id;
82   vl_api_tunnel_encap_decap_flags_t encap_decap_flags;
83   vl_api_tunnel_mode_t mode;
84   vl_api_tunnel_flags_t flags;
85   /* DSCP value for the tunnel encap, ignored if ECNAP_COPY_DSCP flag is set */
86   vl_api_ip_dscp_t dscp;
87   /* TTL=0 is considered 255 */
88   u8 hop_limit;
89 };
90
91 /*
92  * Local Variables:
93  * eval: (c-set-style "gnu")
94  * End:
95  */