VPP-339: SNAT static mapping
[vpp.git] / plugins / snat-plugin / snat / snat.api
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /**
16  * @file snat.api
17  * @brief VPP control-plane API messages.
18  *
19  * This file defines VPP control-plane API messages which are generally
20  * called through a shared memory interface.
21  */
22
23 /** \brief Add S-NAT address range
24     @param client_index - opaque cookie to identify the sender
25     @param context - sender context, to match reply w/ request
26     @param is_ip4 - 1 if address type is IPv4
27     @first_ip_address - first IP address
28     @last_ip_address - last IP address
29 */
30 define snat_add_address_range {
31   u32 client_index;
32   u32 context;
33   u8 is_ip4;
34   u8 first_ip_address[16];
35   u8 last_ip_address[16];
36 };
37
38 /** \brief Add S-NAT address range reply
39     @param client_index - opaque cookie to identify the sender
40     @param context - sender context, to match reply w/ request
41     @param retval - return code
42 */
43 define snat_add_address_range_reply {
44   u32 context;
45   i32 retval;
46 };
47
48 /** \brief Enable/disable S-NAT feature on the interface
49     @param client_index - opaque cookie to identify the sender
50     @param context - sender context, to match reply w/ request
51     @param is_add - 1 if add, 0 if delete
52     @param is_inside - 1 if inside, 0 if outside
53     @param sw_if_index - software index of the interface
54 */
55 define snat_interface_add_del_feature {
56   u32 client_index;
57   u32 context;
58   u8 is_add;
59   u8 is_inside;
60   u32 sw_if_index;
61 };
62
63 /** \brief Enable/disable S-NAT feature on the interface reply
64     @param client_index - opaque cookie to identify the sender
65     @param context - sender context, to match reply w/ request
66     @param retval - return code
67 */
68 define snat_interface_add_del_feature_reply {
69   u32 context;
70   i32 retval;
71 };
72
73 /** \brief Add/delete S-NAT static mapping
74     @param client_index - opaque cookie to identify the sender
75     @param context - sender context, to match reply w/ request
76     @param is_add - 1 if add, 0 if delete
77     @param is_ip4 - 1 if address type is IPv4
78     @param addr_only - 1 if address only mapping
79     @param local_ip_address - local IP address
80     @param external_ip_address - external IP address
81     @param local_port - local port number
82     @param external_port - external port number
83     @param vfr_id - VRF ID
84 */
85 define snat_add_static_mapping {
86   u32 client_index;
87   u32 context;
88   u8 is_add;
89   u8 is_ip4;
90   u8 addr_only;
91   u8 local_ip_address[16];
92   u8 external_ip_address[16];
93   u16 local_port;
94   u16 external_port;
95   u32 vrf_id;
96 };
97
98 /** \brief Add/delete S-NAT static mapping reply
99     @param client_index - opaque cookie to identify the sender
100     @param context - sender context, to match reply w/ request
101     @param retval - return code
102 */
103 define snat_add_static_mapping_reply {
104   u32 context;
105   i32 retval;
106 };
107
108 /** \brief Dump S-NAT static mappings
109     @param client_index - opaque cookie to identify the sender
110     @param context - sender context, to match reply w/ request
111 */
112 define snat_static_mapping_dump {
113   u32 client_index;
114   u32 context;
115 };
116
117 /** \brief S-NAT static mapping details response
118     @param context - sender context, to match reply w/ request
119     @param is_ip4 - 1 if address type is IPv4
120     @param addr_only - 1 if address only mapping
121     @param local_ip_address - local IP address
122     @param external_ip_address - external IP address
123     @param local_port - local port number
124     @param external_port - external port number
125     @param vfr_id - VRF ID
126 */
127 define snat_static_mapping_details {
128   u32 context;
129   u8 is_ip4;
130   u8 addr_only;
131   u8 local_ip_address[16];
132   u8 external_ip_address[16];
133   u16 local_port;
134   u16 external_port;
135   u32 vrf_id;
136 };
137
138 /** \brief Control ping from client to api server request
139     @param client_index - opaque cookie to identify the sender
140     @param context - sender context, to match reply w/ request
141 */
142 define snat_control_ping
143 {
144   u32 client_index;
145   u32 context;
146 };
147
148 /** \brief Control ping from the client to the server response
149     @param client_index - opaque cookie to identify the sender
150     @param context - sender context, to match reply w/ request
151     @param retval - return code for the request
152     @param vpe_pid - the pid of the vpe, returned by the server
153 */
154 define snat_control_ping_reply
155 {
156   u32 context;
157   i32 retval;
158   u32 client_index;
159   u32 vpe_pid;
160 };
161
162 /** \brief Show S-NAT plugin startup config
163     @param client_index - opaque cookie to identify the sender
164     @param context - sender context, to match reply w/ request
165 */
166 define snat_show_config
167 {
168   u32 client_index;
169   u32 context;
170 };
171
172 /** \brief Show S-NAT plugin startup config reply
173     @param context - sender context, to match reply w/ request
174     @param retval - return code for the request
175     @param static_mapping_only - if 1 dynamic translations disabled
176     @param static_mapping_connection_tracking - if 1 create session data
177     @param translation_buckets - number of translation hash buckets
178     @param translation_memory_size - translation hash memory size
179     @param user_buckets - number of user hash buckets
180     @param user_memory_size - user hash memory size
181     @param max_translations_per_user - maximum number of translations per user
182     @param outside_vrf_id - outside VRF id
183     @param inside_vrf_id - default inside VRF id
184 */
185 define snat_show_config_reply
186 {
187   u32 context;
188   i32 retval;
189   u8 static_mapping_only;
190   u8 static_mapping_connection_tracking;
191   u32 translation_buckets;
192   u32 translation_memory_size;
193   u32 user_buckets;
194   u32 user_memory_size;
195   u32 max_translations_per_user;
196   u32 outside_vrf_id;
197   u32 inside_vrf_id;
198 };