builtinurl: mark api as deprecated
[vpp.git] / src / plugins / cnat / cnat.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2023 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
17 /** \file
18     This file defines the vpp control-plane API messages
19     used to control the ABF plugin
20 */
21
22 option version = "0.3.0";
23 import "vnet/ip/ip_types.api";
24 import "vnet/fib/fib_types.api";
25 import "vnet/interface_types.api";
26 import "vnet/ip/ip.api";
27
28 enum cnat_translation_flags:u8
29 {
30   CNAT_TRANSLATION_ALLOC_PORT = 1,
31   CNAT_TRANSLATION_NO_RETURN_SESSION = 4,
32 };
33
34 enum cnat_endpoint_tuple_flags:u8
35 {
36   /* Dont translate said endpoint tuple but
37    * still forward */
38   CNAT_EPT_NO_NAT = 1,
39 };
40
41
42 enum cnat_lb_type:u8
43 {
44   CNAT_LB_TYPE_DEFAULT = 0,
45   CNAT_LB_TYPE_MAGLEV = 1,
46 };
47
48 /* An enpoint is either
49  * An IP & a port
50  * An interface, an address familiy and a port */
51 typedef cnat_endpoint
52 {
53   vl_api_address_t addr;
54   vl_api_interface_index_t sw_if_index;
55   vl_api_address_family_t if_af;
56   u16 port;
57 };
58
59 typedef cnat_endpoint_tuple
60 {
61   vl_api_cnat_endpoint_t dst_ep;
62   vl_api_cnat_endpoint_t src_ep;
63   u8 flags;
64 };
65
66 typedef cnat_translation
67 {
68   vl_api_cnat_endpoint_t vip;
69   u32 id;
70   vl_api_ip_proto_t ip_proto;
71   u8 is_real_ip;
72   u8 flags;
73   vl_api_cnat_lb_type_t lb_type;
74   u32 n_paths;
75   vl_api_ip_flow_hash_config_v2_t flow_hash_config;
76   vl_api_cnat_endpoint_tuple_t paths[n_paths];
77 };
78
79 define cnat_translation_update
80 {
81   u32 client_index;
82   u32 context;
83   vl_api_cnat_translation_t translation;
84 };
85
86 define cnat_translation_update_reply
87 {
88   u32 context;
89   i32 retval;
90   u32 id;
91 };
92
93 autoreply define cnat_translation_del
94 {
95   u32 client_index;
96   u32 context;
97   u32 id;
98 };
99
100 define cnat_translation_details
101 {
102   u32 context;
103   vl_api_cnat_translation_t translation;
104 };
105
106 define cnat_translation_dump
107 {
108   u32 client_index;
109   u32 context;
110 };
111
112 autoreply define cnat_session_purge
113 {
114   u32 client_index;
115   u32 context;
116 };
117
118 typedef cnat_session
119 {
120   vl_api_cnat_endpoint_t src;
121   vl_api_cnat_endpoint_t dst;
122   vl_api_cnat_endpoint_t new;
123   vl_api_ip_proto_t ip_proto;
124   u8 location;
125   f64 timestamp;
126 };
127
128 define cnat_session_details
129 {
130   u32 context;
131   vl_api_cnat_session_t session;
132 };
133
134 define cnat_session_dump
135 {
136   u32 client_index;
137   u32 context;
138 };
139
140 autoreply define cnat_set_snat_addresses
141 {
142   u32 client_index;
143   u32 context;
144   vl_api_ip4_address_t snat_ip4;
145   vl_api_ip6_address_t snat_ip6;
146   vl_api_interface_index_t sw_if_index;
147 };
148
149 define cnat_get_snat_addresses
150 {
151   u32 client_index;
152   u32 context;
153 };
154
155 define cnat_get_snat_addresses_reply
156 {
157   u32 context;
158   i32 retval;
159   u32 id;
160   vl_api_ip4_address_t snat_ip4;
161   vl_api_ip6_address_t snat_ip6;
162   vl_api_interface_index_t sw_if_index;
163 };
164
165 autoreply define cnat_snat_policy_add_del_exclude_pfx
166 {
167   u32 client_index;
168   u32 context;
169   u8 is_add;
170   vl_api_prefix_t prefix;
171 };
172
173 enum cnat_snat_policy_table:u8
174 {
175   CNAT_POLICY_INCLUDE_V4 = 0,
176   CNAT_POLICY_INCLUDE_V6 = 1,
177   CNAT_POLICY_POD = 2,
178   CNAT_POLICY_HOST = 3,
179 };
180
181 autoreply define cnat_snat_policy_add_del_if
182 {
183   u32 client_index;
184   u32 context;
185   vl_api_interface_index_t sw_if_index;
186   u8 is_add;
187   vl_api_cnat_snat_policy_table_t table;
188 };
189
190 /* A snat policy controls what traffic is srcNATed */
191 enum cnat_snat_policies:u8
192 {
193   /* No filter applied, srcNAT everything */
194   CNAT_POLICY_NONE = 0,
195   /* Filter by interface list : snat_policy_add_del_if
196    * and prefix list : snat_policy_add_del_if */
197   CNAT_POLICY_IF_PFX = 1,
198   /* Kubernetes specific policy */
199   CNAT_POLICY_K8S = 2,
200 };
201
202 autoreply define cnat_set_snat_policy
203 {
204   u32 client_index;
205   u32 context;
206   vl_api_cnat_snat_policies_t policy;
207 };
208
209 /*
210  * fd.io coding-style-patch-verification: ON
211  *
212  * Local Variables:
213  * eval: (c-set-style "gnu")
214  * End:
215  */