vcl session: switch to generic cert key apis
[vpp.git] / src / vnet / session / session.api
1 /*
2  * Copyright (c) 2015-2020 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 option version = "4.0.0";
17
18 import "vnet/interface_types.api";
19 import "vnet/ip/ip_types.api";
20
21
22 enum transport_proto : u8
23 {
24         TRANSPORT_PROTO_API_TCP,
25         TRANSPORT_PROTO_API_UDP,
26         TRANSPORT_PROTO_API_NONE,
27         TRANSPORT_PROTO_API_TLS,
28         TRANSPORT_PROTO_API_QUIC,
29 };
30
31 /** \brief Application attach to session layer
32     @param client_index - opaque cookie to identify the sender
33     @param context - sender context, to match reply w/ request
34     @param options - segment size, fifo sizes, etc.
35     @param namespace_id - string
36 */
37  define app_attach {
38     u32 client_index;
39     u32 context;
40     u64 options[18];
41     string namespace_id[];
42  };
43
44 /** \brief Application attach reply
45     @param context - sender context, to match reply w/ request
46     @param retval - return code for the request
47     @param app_mq - app message queue
48     @param vpp_ctrl_mq - vpp message queue for control events that should
49                                          be handled in main thread, i.e., bind/connect
50     @param vpp_ctrl_mq_thread_index - thread index of the ctrl mq
51     @param app_index - index of the newly created app
52     @param n_fds - number of fds exchanged
53     @param fd_flags - set of flags that indicate which fds are to be expected
54                                   over the socket (set only if socket transport available)
55     @param segment_size - size of first shm segment
56     @param segment_handle - handle for segment
57     @param segment_name - name of segment client needs to attach to
58 */
59 define app_attach_reply {
60     u32 context;
61     i32 retval;
62     u64 app_mq;
63     u64 vpp_ctrl_mq;
64     u8 vpp_ctrl_mq_thread;
65     u32 app_index;
66     u8 n_fds;
67     u8 fd_flags;
68     u32 segment_size;
69     u64 segment_handle;
70     string segment_name[];
71 };
72
73 /** \brief Application detach from session layer
74     @param client_index - opaque cookie to identify the sender
75     @param context - sender context, to match reply w/ request
76 */
77 autoreply define application_detach {
78     u32 client_index;
79     u32 context;
80 };
81
82 /** \brief Add certificate and key
83     @param client_index - opaque cookie to identify the sender
84     @param context - sender context, to match reply w/ request
85     @param engine - crypto engine
86     @param cert_len - cert length (comes first)
87     @param certkey_len - cert and key length
88     @param certkey - cert & key data (due to API limitation)
89 */
90 define app_add_cert_key_pair {
91     u32 client_index;
92     u32 context;
93     u16 cert_len;
94     u16 certkey_len;
95     u8 certkey[certkey_len];
96 };
97
98 /** \brief Add certificate and key
99     @param context - sender context, to match reply w/ request
100     @param retval - return code for the request
101     @param index - index in certificate store
102 */
103 define app_add_cert_key_pair_reply {
104     u32 context;
105     i32 retval;
106     u32 index;
107 };
108
109 /** \brief Delete certificate and key
110     @param client_index - opaque cookie to identify the sender
111     @param context - sender context, to match reply w/ request
112     @param index - index in certificate store
113 */
114 autoreply define app_del_cert_key_pair {
115     u32 client_index;
116     u32 context;
117     u32 index;
118 };
119
120 /** \brief Application add TLS certificate
121         ### WILL BE DEPRECATED POST 20.01 ###
122     @param client_index - opaque cookie to identify the sender
123     @param context - sender context, to match reply w/ request
124     @param cert_len - certificate length
125     @param cert - certificate as a string
126 */
127 autoreply define application_tls_cert_add {
128     option deprecated="to be removed post 21.06";
129     u32 client_index;
130     u32 context;
131     u32 app_index;
132     u16 cert_len;
133     u8 cert[cert_len];
134 };
135
136 /** \brief Application add TLS key
137         ### WILL BE DEPRECATED POST 20.01 ###
138     @param client_index - opaque cookie to identify the sender
139     @param context - sender context, to match reply w/ request
140     @param key_len - certificate length
141     @param key - PEM encoded key as a string
142 */
143 autoreply define application_tls_key_add {
144     option deprecated="to be removed post 21.06";
145     u32 client_index;
146     u32 context;
147     u32 app_index;
148     u16 key_len;
149     u8 key[key_len];
150 };
151
152 /** \brief add/del application worker
153     @param client_index - opaque cookie to identify the sender
154                           client to vpp direction only
155     @param context - sender context, to match reply w/ request
156     @param app_index - application index
157     @param wrk_index - worker index, if a delete
158     @param is_add - set if an add
159 */
160 define app_worker_add_del
161 {
162   u32 client_index;
163   u32 context;
164   u32 app_index;
165   u32 wrk_index;
166   bool is_add [default=true];
167 };
168
169 /** \brief Reply for app worker add/del
170     @param context - returned sender context, to match reply w/ request
171     @param retval - return code
172     @param wrk_index - worker index, if add
173     @param app_event_queue_address - vpp event queue address of new worker
174     @param n_fds - number of fds exchanged
175     @param fd_flags - set of flags that indicate which fds are to be expected
176                                   over the socket (set only if socket transport available)
177     @param segment_handle - handle for segment
178     @param is_add - add if non zero, else delete
179     @param segment_name - name of segment client needs to attach to
180 */
181 define app_worker_add_del_reply
182 {
183   u32 context;
184   i32 retval;
185   u32 wrk_index;
186   u64 app_event_queue_address;
187   u8 n_fds;
188   u8 fd_flags;
189   u64 segment_handle;
190   bool is_add [default=true];
191   string segment_name[];
192 };
193
194 /** \brief enable/disable session layer
195     @param client_index - opaque cookie to identify the sender
196                           client to vpp direction only
197     @param context - sender context, to match reply w/ request
198     @param is_enable - disable session layer if 0, enable otherwise
199 */
200 autoreply define session_enable_disable {
201   u32 client_index;
202   u32 context;
203   bool is_enable [default=true];
204 };
205
206 /** \brief add/del application namespace
207     @param client_index - opaque cookie to identify the sender
208                           client to vpp direction only
209     @param context - sender context, to match reply w/ request
210     @param secret - secret shared between app and vpp
211     @param sw_if_index - local interface that "supports" namespace. Set to
212                          ~0 if no preference
213     @param ip4_fib_id - id of ip4 fib that "supports" the namespace. Ignored
214                         if sw_if_index set.
215     @param ip6_fib_id - id of ip6 fib that "supports" the namespace. Ignored
216                         if sw_if_index set.
217     @param namespace_id - namespace id
218 */
219 define app_namespace_add_del {
220   u32 client_index;
221   u32 context;
222   u64 secret;
223   vl_api_interface_index_t sw_if_index [default=0xffffffff];
224   u32 ip4_fib_id;
225   u32 ip6_fib_id;
226   string namespace_id[];
227 };
228
229 /** \brief Reply for app namespace add/del
230     @param context - returned sender context, to match reply w/ request
231     @param retval - return code
232     @param appns_index - app namespace index
233 */
234 define app_namespace_add_del_reply
235 {
236   u32 context;
237   i32 retval;
238   u32 appns_index;
239 };
240
241 enum session_rule_scope {
242         SESSION_RULE_SCOPE_API_GLOBAL = 0,
243         SESSION_RULE_SCOPE_API_LOCAL = 1,
244         SESSION_RULE_SCOPE_API_BOTH = 2,
245 };
246
247 /** \brief add/del session rule
248     @param client_index - opaque cookie to identify the sender
249                           client to vpp direction only
250     @param context - sender context, to match reply w/ request
251     @param transport_proto - transport protocol
252     @param is_ip4 - flag to indicate if ip addresses are ip4 or 6
253     @param lcl_ip - local ip
254     @param lcl_plen - local prefix length
255     @param rmt_ip - remote ip
256     @param rmt_ple - remote prefix length
257     @param lcl_port - local port
258     @param rmt_port - remote port
259     @param action_index - the only action defined now is forward to
260                           application with index action_index
261     @param is_add - flag to indicate if add or del
262     @param appns_index - application namespace where rule is to be applied to
263     @param scope - enum that indicates scope of the rule: global or local.
264                    If 0, default is global, 1 is global 2 is local, 3 is both
265     @param tag - tag
266 */
267 autoreply define session_rule_add_del {
268   u32 client_index;
269   u32 context;
270   vl_api_transport_proto_t transport_proto;
271   vl_api_prefix_t lcl;
272   vl_api_prefix_t rmt;
273   u16 lcl_port;
274   u16 rmt_port;
275   u32 action_index;
276   bool is_add [default=true];
277   u32 appns_index;
278   vl_api_session_rule_scope_t scope;
279   string tag[64];
280 };
281
282 /** \brief Dump session rules
283     @param client_index - opaque cookie to identify the sender
284     @param context - sender context, to match reply w/ request
285  */
286 define session_rules_dump
287 {
288   u32 client_index;
289   u32 context;
290 };
291
292 /** \brief Session rules details
293     @param context - sender context, to match reply w/ request
294     @param transport_proto - transport protocol
295     @param is_ip4 - flag to indicate if ip addresses are ip4 or 6
296     @param lcl_ip - local ip
297     @param lcl_plen - local prefix length
298     @param rmt_ip - remote ip
299     @param rmt_ple - remote prefix length
300     @param lcl_port - local port
301     @param rmt_port - remote port
302     @param action_index - the only action defined now is forward to
303                           application with index action_index
304     @param appns_index - application namespace where rule is to be applied to
305     @param scope - enum that indicates scope of the rule: global or local.
306                    If 0, default is global, 1 is global 2 is local, 3 is both
307     @param tag - tag
308   */
309 define session_rules_details
310 {
311   u32 context;
312   vl_api_transport_proto_t transport_proto;
313   vl_api_prefix_t lcl;
314   vl_api_prefix_t rmt;
315   u16 lcl_port;
316   u16 rmt_port;
317   u32 action_index;
318   u32 appns_index;
319   vl_api_session_rule_scope_t scope;
320   string tag[64];
321 };
322
323 /*
324  * Local Variables:
325  * eval: (c-set-style "gnu")
326  * End:
327  */