FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
cnat.api
Go to the documentation of this file.
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 
28 {
30 };
31 
33 {
34  /* Dont translate said endpoint tuple but
35  * still forward */
37 };
38 
39 
41 {
44 };
45 
46 /* An enpoint is either
47  * An IP & a port
48  * An interface, an address familiy and a port */
49 typedef cnat_endpoint
50 {
51  vl_api_address_t addr;
52  vl_api_interface_index_t sw_if_index;
53  vl_api_address_family_t if_af;
55 };
56 
57 typedef cnat_endpoint_tuple
58 {
59  vl_api_cnat_endpoint_t dst_ep;
60  vl_api_cnat_endpoint_t src_ep;
62 };
63 
64 typedef cnat_translation
65 {
66  vl_api_cnat_endpoint_t vip;
68  vl_api_ip_proto_t ip_proto;
70  u8 flags;
71  vl_api_cnat_lb_type_t lb_type;
73  vl_api_cnat_endpoint_tuple_t paths[n_paths];
74 };
75 
77 {
80  vl_api_cnat_translation_t translation;
81 };
82 
83 define cnat_translation_update_reply
84 {
88 };
89 
90 autoreply define cnat_translation_del
91 {
95 };
96 
97 define cnat_translation_details
98 {
100  vl_api_cnat_translation_t translation;
101 };
102 
103 define cnat_translation_dump
104 {
107 };
108 
109 autoreply define cnat_session_purge
110 {
113 };
114 
115 typedef cnat_session
116 {
117  vl_api_cnat_endpoint_t src;
118  vl_api_cnat_endpoint_t dst;
119  vl_api_cnat_endpoint_t new;
120  vl_api_ip_proto_t ip_proto;
123 };
124 
125 define cnat_session_details
126 {
128  vl_api_cnat_session_t session;
129 };
130 
131 define cnat_session_dump
132 {
135 };
136 
137 autoreply define cnat_set_snat_addresses
138 {
141  vl_api_ip4_address_t snat_ip4;
142  vl_api_ip6_address_t snat_ip6;
143  vl_api_interface_index_t sw_if_index;
144 };
145 
146 define cnat_get_snat_addresses
147 {
150 };
151 
152 define cnat_get_snat_addresses_reply
153 {
157  vl_api_ip4_address_t snat_ip4;
158  vl_api_ip6_address_t snat_ip6;
159  vl_api_interface_index_t sw_if_index;
160 };
161 
162 autoreply define cnat_snat_policy_add_del_exclude_pfx
163 {
167  vl_api_prefix_t prefix;
168 };
169 
171 {
175 };
176 
178 {
181  vl_api_interface_index_t sw_if_index;
183  vl_api_cnat_snat_policy_table_t table;
184 };
185 
186 /* A snat policy controls what traffic is srcNATed */
188 {
189  /* No filter applied, srcNAT everything */
191  /* Filter by interface list : snat_policy_add_del_if
192  * and prefix list : snat_policy_add_del_if */
194  /* Kubernetes specific policy */
196 };
197 
198 autoreply define cnat_set_snat_policy
199 {
202  vl_api_cnat_snat_policies_t policy;
203 };
204 
205 /*
206  * fd.io coding-style-patch-verification: ON
207  *
208  * Local Variables:
209  * eval: (c-set-style "gnu")
210  * End:
211  */
CNAT_POLICY_NONE
@ CNAT_POLICY_NONE
Definition: cnat.api:190
vl_api_cnat_get_snat_addresses_reply_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: cnat.api:159
CNAT_EPT_NO_NAT
@ CNAT_EPT_NO_NAT
Definition: cnat.api:36
vl_api_cnat_set_snat_policy_t::client_index
u32 client_index
Definition: cnat.api:200
vl_api_cnat_session_purge_t::context
u32 context
Definition: cnat.api:112
vl_api_cnat_translation_del_t::client_index
u32 client_index
Definition: cnat.api:92
vl_api_cnat_translation_dump_t::client_index
u32 client_index
Definition: cnat.api:105
cnat_lb_type
cnat_lb_type
Definition: cnat.api:40
vl_api_cnat_session_purge_t::client_index
u32 client_index
Definition: cnat.api:111
is_real_ip
u8 is_real_ip
Definition: cnat.api:69
vl_api_cnat_set_snat_addresses_t::snat_ip4
vl_api_ip4_address_t snat_ip4
Definition: cnat.api:141
vl_api_cnat_translation_update_reply_t::retval
i32 retval
Definition: cnat.api:86
vl_api_cnat_snat_policy_add_del_if_t::client_index
u32 client_index
Definition: cnat.api:179
CNAT_POLICY_K8S
@ CNAT_POLICY_K8S
Definition: cnat.api:195
CNAT_POLICY_POD
@ CNAT_POLICY_POD
Definition: cnat.api:174
CNAT_POLICY_IF_PFX
@ CNAT_POLICY_IF_PFX
Definition: cnat.api:193
vl_api_cnat_translation_del_t::context
u32 context
Definition: cnat.api:93
if_af
vl_api_address_family_t if_af
Definition: cnat.api:53
timestamp
f64 timestamp
Definition: cnat.api:122
u16
unsigned short u16
Definition: types.h:57
vl_api_cnat_set_snat_addresses_t
Definition: cnat.api:137
vl_api_cnat_snat_policy_add_del_if_t::table
vl_api_cnat_snat_policy_table_t table
Definition: cnat.api:183
vl_api_cnat_session_details_t::session
vl_api_cnat_session_t session
Definition: cnat.api:128
cnat_session_purge
int cnat_session_purge(void)
Purge all the sessions.
Definition: cnat_session.c:159
vl_api_cnat_translation_del_t
Definition: cnat.api:90
port
u16 port
Definition: cnat.api:54
addr
vhost_vring_addr_t addr
Definition: vhost_user.h:130
vl_api_cnat_snat_policy_add_del_exclude_pfx_t
Definition: cnat.api:162
n_paths
u32 n_paths
Definition: cnat.api:72
CNAT_TRANSLATION_ALLOC_PORT
@ CNAT_TRANSLATION_ALLOC_PORT
Definition: cnat.api:29
vl_api_cnat_session_dump_t::client_index
u32 client_index
Definition: cnat.api:133
vl_api_cnat_snat_policy_add_del_exclude_pfx_t::prefix
vl_api_prefix_t prefix
Definition: cnat.api:167
i32
signed int i32
Definition: types.h:77
vl_api_cnat_session_dump_t::context
u32 context
Definition: cnat.api:134
vl_api_cnat_translation_update_t::client_index
u32 client_index
Definition: cnat.api:78
cnat_snat_policy_add_del_if
int cnat_snat_policy_add_del_if(u32 sw_if_index, u8 is_add, cnat_snat_interface_map_type_t table)
Definition: cnat_snat_policy.c:89
cnat_translation_update
u32 cnat_translation_update(cnat_endpoint_t *vip, ip_protocol_t proto, cnat_endpoint_tuple_t *paths, u8 flags, cnat_lb_type_t lb_type)
create or update a translation
Definition: cnat_translation.c:366
cnat_snat_policies
cnat_snat_policies
Definition: cnat.api:187
vl_api_cnat_snat_policy_add_del_if_t::context
u32 context
Definition: cnat.api:180
version
option version
Definition: cnat.api:22
CNAT_LB_TYPE_DEFAULT
@ CNAT_LB_TYPE_DEFAULT
Definition: cnat.api:42
vl_api_cnat_snat_policy_add_del_if_t::is_add
u8 is_add
Definition: cnat.api:182
lb_type
vl_api_cnat_lb_type_t lb_type
Definition: cnat.api:71
src_ep
vl_api_cnat_endpoint_t src_ep
Definition: cnat.api:60
vl_api_cnat_get_snat_addresses_t::context
u32 context
Definition: cnat.api:149
vl_api_cnat_set_snat_policy_t::policy
vl_api_cnat_snat_policies_t policy
Definition: cnat.api:202
vl_api_cnat_snat_policy_add_del_exclude_pfx_t::is_add
u8 is_add
Definition: cnat.api:166
cnat_translation_flags
cnat_translation_flags
Definition: cnat.api:27
CNAT_POLICY_INCLUDE_V4
@ CNAT_POLICY_INCLUDE_V4
Definition: cnat.api:172
flags
u8 flags
Definition: cnat.api:61
cnat_endpoint
typedef cnat_endpoint
Definition: cnat.api:50
f64
double f64
Definition: types.h:142
cnat_snat_policy_table
cnat_snat_policy_table
Definition: cnat.api:170
vl_api_cnat_set_snat_addresses_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: cnat.api:143
vl_api_cnat_translation_update_reply_t
Definition: cnat.api:83
cnat_translation
typedef cnat_translation
Definition: cnat.api:65
src
vl_api_address_t src
Definition: gre.api:54
vl_api_cnat_get_snat_addresses_t
Definition: cnat.api:146
cnat_endpoint_tuple_flags
cnat_endpoint_tuple_flags
Definition: cnat.api:32
vl_api_cnat_translation_update_reply_t::context
u32 context
Definition: cnat.api:85
cnat_set_snat_policy
int cnat_set_snat_policy(cnat_snat_policy_type_t policy)
Definition: cnat_snat_policy.c:473
vl_api_cnat_set_snat_addresses_t::client_index
u32 client_index
Definition: cnat.api:139
vl_api_cnat_get_snat_addresses_reply_t::retval
i32 retval
Definition: cnat.api:155
vl_api_cnat_snat_policy_add_del_exclude_pfx_t::context
u32 context
Definition: cnat.api:165
vl_api_cnat_translation_details_t::translation
vl_api_cnat_translation_t translation
Definition: cnat.api:100
id
u32 id
Definition: cnat.api:67
vl_api_cnat_session_dump_t
Definition: cnat.api:131
CNAT_LB_TYPE_MAGLEV
@ CNAT_LB_TYPE_MAGLEV
Definition: cnat.api:43
vl_api_cnat_translation_details_t
Definition: cnat.api:97
vl_api_cnat_session_details_t
Definition: cnat.api:125
vl_api_cnat_snat_policy_add_del_exclude_pfx_t::client_index
u32 client_index
Definition: cnat.api:164
ip_proto
vl_api_ip_proto_t ip_proto
Definition: cnat.api:68
vl_api_cnat_set_snat_policy_t
Definition: cnat.api:198
u32
unsigned int u32
Definition: types.h:88
vl_api_cnat_get_snat_addresses_reply_t::id
u32 id
Definition: cnat.api:156
vl_api_cnat_translation_del_t::id
u32 id
Definition: cnat.api:94
cnat_session
typedef cnat_session
Definition: cnat.api:116
vl_api_cnat_translation_update_t::translation
vl_api_cnat_translation_t translation
Definition: cnat.api:80
vl_api_cnat_translation_update_reply_t::id
u32 id
Definition: cnat.api:87
vl_api_cnat_set_snat_policy_t::context
u32 context
Definition: cnat.api:201
CNAT_POLICY_INCLUDE_V6
@ CNAT_POLICY_INCLUDE_V6
Definition: cnat.api:173
vl_api_cnat_translation_dump_t::context
u32 context
Definition: cnat.api:106
vl_api_cnat_session_purge_t
Definition: cnat.api:109
u8
unsigned char u8
Definition: types.h:56
vl_api_cnat_translation_update_t::context
u32 context
Definition: cnat.api:79
cnat_endpoint_tuple
typedef cnat_endpoint_tuple
Definition: cnat.api:58
vl_api_cnat_translation_details_t::context
u32 context
Definition: cnat.api:99
vl_api_cnat_get_snat_addresses_reply_t::context
u32 context
Definition: cnat.api:154
vl_api_cnat_translation_dump_t
Definition: cnat.api:103
location
u8 location
Definition: cnat.api:121
vl_api_cnat_translation_update_t
Definition: cnat.api:76
paths
vl_api_cnat_endpoint_tuple_t paths[n_paths]
Definition: cnat.api:73
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: cnat.api:52
vl_api_cnat_session_details_t::context
u32 context
Definition: cnat.api:127
vl_api_cnat_set_snat_addresses_t::snat_ip6
vl_api_ip6_address_t snat_ip6
Definition: cnat.api:142
vl_api_cnat_get_snat_addresses_reply_t
Definition: cnat.api:152
vl_api_cnat_get_snat_addresses_t::client_index
u32 client_index
Definition: cnat.api:148
vl_api_cnat_snat_policy_add_del_if_t
Definition: cnat.api:177
vl_api_cnat_get_snat_addresses_reply_t::snat_ip6
vl_api_ip6_address_t snat_ip6
Definition: cnat.api:158
vl_api_cnat_snat_policy_add_del_if_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: cnat.api:181
vl_api_cnat_get_snat_addresses_reply_t::snat_ip4
vl_api_ip4_address_t snat_ip4
Definition: cnat.api:157
dst
vl_api_cnat_endpoint_t dst
Definition: cnat.api:118
vl_api_cnat_set_snat_addresses_t::context
u32 context
Definition: cnat.api:140