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