2 * Copyright (c) 2015-2019 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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 option version = "2.0.0";
18 import "vnet/interface_types.api";
19 import "vnet/ip/ip_types.api";
22 enum transport_proto : u8
24 TRANSPORT_PROTO_API_TCP,
25 TRANSPORT_PROTO_API_UDP,
26 TRANSPORT_PROTO_API_NONE,
27 TRANSPORT_PROTO_API_TLS,
28 TRANSPORT_PROTO_API_UDPC,
29 TRANSPORT_PROTO_API_QUIC,
32 /** \brief client->vpp, attach application to session layer
33 ### WILL BE DEPRECATED POST 20.01 ###
34 @param client_index - opaque cookie to identify the sender
35 @param context - sender context, to match reply w/ request
36 @param initial_segment_size - size of the initial shm segment to be
38 @param options - segment size, fifo sizes, etc.
39 @param namespace_id - string
41 define application_attach {
44 u32 initial_segment_size;
46 string namespace_id[];
49 /** \brief Application attach reply
50 ### WILL BE DEPRECATED POST 20.01 ###
51 @param context - sender context, to match reply w/ request
52 @param retval - return code for the request
53 @param app_event_queue_address - vpp event queue address or 0 if this
54 connection shouldn't send events
55 @param n_fds - number of fds exchanged
56 @param fd_flags - set of flags that indicate which fds are to be expected
57 over the socket (set only if socket transport available)
58 @param segment_size - size of first shm segment
59 @param app_index - index of the newly created app
60 @param segment_handle - handle for segment
61 @param segment_name - name of segment client needs to attach to
63 define application_attach_reply {
66 u64 app_event_queue_address;
72 string segment_name[];
75 /** \brief Application attach to session layer
76 @param client_index - opaque cookie to identify the sender
77 @param context - sender context, to match reply w/ request
78 @param options - segment size, fifo sizes, etc.
79 @param namespace_id - string
85 string namespace_id[];
88 /** \brief Application attach reply
89 @param context - sender context, to match reply w/ request
90 @param retval - return code for the request
91 @param app_mq - app message queue
92 @param vpp_ctrl_mq - vpp message queue for control events that should
93 be handled in main thread, i.e., bind/connect
94 @param vpp_ctrl_mq_thread_index - thread index of the ctrl mq
95 @param app_index - index of the newly created app
96 @param n_fds - number of fds exchanged
97 @param fd_flags - set of flags that indicate which fds are to be expected
98 over the socket (set only if socket transport available)
99 @param segment_size - size of first shm segment
100 @param segment_handle - handle for segment
101 @param segment_name - name of segment client needs to attach to
103 define app_attach_reply {
108 u8 vpp_ctrl_mq_thread;
114 string segment_name[];
117 /** \brief Add certificate and key
118 @param client_index - opaque cookie to identify the sender
119 @param context - sender context, to match reply w/ request
120 @param engine - crypto engine
121 @param cert_len - cert length (comes first)
122 @param certkey_len - cert and key length
123 @param certkey - cert & key data (due to API limitation)
125 define app_add_cert_key_pair {
130 u8 certkey[certkey_len];
133 /** \brief Add certificate and key
134 @param context - sender context, to match reply w/ request
135 @param retval - return code for the request
136 @param index - index in certificate store
138 define app_add_cert_key_pair_reply {
144 /** \brief Delete certificate and key
145 @param client_index - opaque cookie to identify the sender
146 @param context - sender context, to match reply w/ request
147 @param index - index in certificate store
149 autoreply define app_del_cert_key_pair {
155 /** \brief Application add TLS certificate
156 ### WILL BE DEPRECATED POST 20.01 ###
157 @param client_index - opaque cookie to identify the sender
158 @param context - sender context, to match reply w/ request
159 @param cert_len - certificate length
160 @param cert - certificate as a string
162 autoreply define application_tls_cert_add {
170 /** \brief Application add TLS key
171 ### WILL BE DEPRECATED POST 20.01 ###
172 @param client_index - opaque cookie to identify the sender
173 @param context - sender context, to match reply w/ request
174 @param key_len - certificate length
175 @param key - PEM encoded key as a string
177 autoreply define application_tls_key_add {
185 /** \brief client->vpp, attach application to session layer
186 ### WILL BE DEPRECATED POST 20.01 ###
187 @param client_index - opaque cookie to identify the sender
188 @param context - sender context, to match reply w/ request
190 autoreply define application_detach {
195 /** \brief vpp->client, please map an additional shared memory segment
196 ### WILL BE DEPRECATED POST 20.01 ###
197 @param client_index - opaque cookie to identify the sender
198 @param context - sender context, to match reply w/ request
199 @param fd_flags - set of flags that indicate which, if any, fds are
200 to be expected over the socket. This is set only if
201 socket transport available
202 @param segment_size - size of the segment to be mapped
203 @param segment_name - name of the segment to be mapped
204 @param segment_handle - unique identifier for segment
206 autoreply define map_another_segment {
211 string segment_name[128];
215 /** \brief vpp->client unmap shared memory segment
216 ### WILL BE DEPRECATED POST 20.01 ###
217 @param client_index - opaque cookie to identify the sender
218 @param context - sender context, to match reply w/ request
219 @param segment_name - segment name
220 @param segment_handle - handle of the segment to be unmapped
222 autoreply define unmap_segment {
228 /** \brief Bind to a given URI
229 ### WILL BE DEPRECATED POST 20.01 ###
230 @param client_index - opaque cookie to identify the sender
231 @param context - sender context, to match reply w/ request
232 @param accept_cookie - sender accept cookie, to identify this bind flavor
233 @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4]
234 "tcp://::/0/80" [ipv6] etc.
235 @param options - socket options, fifo sizes, etc.
237 autoreply define bind_uri {
244 /** \brief Unbind a given URI
245 ### WILL BE DEPRECATED POST 20.01 ###
246 @param client_index - opaque cookie to identify the sender
247 @param context - sender context, to match reply w/ request
248 @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4]
249 "tcp://::/0/80" [ipv6], etc.
250 @param options - socket options, fifo sizes, etc.
252 autoreply define unbind_uri {
258 /** \brief Connect to a given URI
259 ### WILL BE DEPRECATED POST 20.01 ###
260 @param client_index - opaque cookie to identify the sender
261 @param context - sender context, to match reply w/ request
262 @param client_queue_address - binary API client queue address. Used by
263 local server when connect was redirected.
264 @param options - socket options, fifo sizes, etc. passed by vpp to the
265 server when redirecting connects
266 @param uri - a URI, e.g. "tcp4://0.0.0.0/0/80"
267 "tcp6://::/0/80" [ipv6], etc.
269 autoreply define connect_uri {
272 u64 client_queue_address;
277 /** \brief bidirectional disconnect API
278 ### WILL BE DEPRECATED POST 20.01 ###
279 @param client_index - opaque cookie to identify the sender
280 client to vpp direction only
281 @param context - sender context, to match reply w/ request
282 @param handle - session handle obtained from accept/connect
284 define disconnect_session {
290 /** \brief bidirectional disconnect reply API
291 ### WILL BE DEPRECATED POST 20.01 ###
292 @param client_index - opaque cookie to identify the sender
293 client to vpp direction only
294 @param context - sender context, to match reply w/ request
295 @param retval - return code for the request
296 @param handle - session handle
298 define disconnect_session_reply {
304 /** \brief Bind to an ip:port pair for a given transport protocol
305 ### WILL BE DEPRECATED POST 20.01 ###
306 @param client_index - opaque cookie to identify the sender
307 @param context - sender context, to match reply w/ request
308 @param wrk_index - index of worker requesting the bind
309 @param vrf - bind namespace
310 @param ip - ip address
312 @param proto - protocol 0 - TCP 1 - UDP
313 @param options - socket options, fifo sizes, etc.
315 autoreply define bind_sock {
322 vl_api_transport_proto_t proto;
327 ### WILL BE DEPRECATED POST 20.01 ###s
328 @param client_index - opaque cookie to identify the sender
329 @param context - sender context, to match reply w/ request
330 @param wrk_index - index of worker requesting the bind
331 @param handle - bind handle obtained from bind reply
333 autoreply define unbind_sock {
340 /** \brief Connect to a remote peer
341 ### WILL BE DEPRECATED POST 20.01 ###
342 @param client_index - opaque cookie to identify the sender
343 @param context - sender context, to match reply w/ request
344 @param wrk_index - worker that requests the connect
345 @param client_queue_address - client's API queue address. Non-zero when
346 used to perform redirects
347 @param options - socket options, fifo sizes, etc. when doing redirects
348 @param vrf - connection namespace
349 @param ip - ip address
351 @param proto - protocol 0 - TCP 1 - UDP
352 @param hostname-len - length of hostname
353 @param hostname - destination's hostname. If present, used by protocols
355 @param parent_handle - handle of parent session (e.g. for opening quic streams).
357 autoreply define connect_sock {
361 u64 client_queue_address;
366 vl_api_transport_proto_t proto;
371 /** \brief ask app to add a new cut-through registration
372 ### WILL BE DEPRECATED POST 20.01 ###
373 @param client_index - opaque cookie to identify the sender
374 client to vpp direction only
375 @param context - sender context, to match reply w/ request
376 @param evt_q_address - address of the mq in ssvm segment
377 @param peer_evt_q_address - address of peer's mq in ssvm segment
378 @param wrk_index - index of worker to receive the registration
379 @param n_fds - number of fds exchanged
380 @param fd_flags - flag indicating the fds that will be exchanged over
383 autoreply define app_cut_through_registration_add
388 u64 peer_evt_q_address;
394 /** \brief add/del application worker
395 @param client_index - opaque cookie to identify the sender
396 client to vpp direction only
397 @param context - sender context, to match reply w/ request
398 @param app_index - application index
399 @param wrk_index - worker index, if a delete
400 @param is_add - set if an add
402 define app_worker_add_del
408 bool is_add [default=true];
411 /** \brief Reply for app worker add/del
412 @param context - returned sender context, to match reply w/ request
413 @param retval - return code
414 @param wrk_index - worker index, if add
415 @param app_event_queue_address - vpp event queue address of new worker
416 @param n_fds - number of fds exchanged
417 @param fd_flags - set of flags that indicate which fds are to be expected
418 over the socket (set only if socket transport available)
419 @param segment_handle - handle for segment
420 @param is_add - add if non zero, else delete
421 @param segment_name - name of segment client needs to attach to
423 define app_worker_add_del_reply
428 u64 app_event_queue_address;
432 bool is_add [default=true];
433 string segment_name[];
436 /** \brief enable/disable session layer
437 @param client_index - opaque cookie to identify the sender
438 client to vpp direction only
439 @param context - sender context, to match reply w/ request
440 @param is_enable - disable session layer if 0, enable otherwise
442 autoreply define session_enable_disable {
445 bool is_enable [default=true];
448 /** \brief add/del application namespace
449 @param client_index - opaque cookie to identify the sender
450 client to vpp direction only
451 @param context - sender context, to match reply w/ request
452 @param secret - secret shared between app and vpp
453 @param sw_if_index - local interface that "supports" namespace. Set to
455 @param ip4_fib_id - id of ip4 fib that "supports" the namespace. Ignored
457 @param ip6_fib_id - id of ip6 fib that "supports" the namespace. Ignored
459 @param namespace_id - namespace id
461 define app_namespace_add_del {
465 vl_api_interface_index_t sw_if_index;
468 string namespace_id[];
471 /** \brief Reply for app namespace add/del
472 @param context - returned sender context, to match reply w/ request
473 @param retval - return code
474 @param appns_index - app namespace index
476 define app_namespace_add_del_reply
483 enum session_rule_scope {
484 SESSION_RULE_SCOPE_API_GLOBAL = 0,
485 SESSION_RULE_SCOPE_API_LOCAL = 1,
486 SESSION_RULE_SCOPE_API_BOTH = 2,
489 /** \brief add/del session rule
490 @param client_index - opaque cookie to identify the sender
491 client to vpp direction only
492 @param context - sender context, to match reply w/ request
493 @param transport_proto - transport protocol
494 @param is_ip4 - flag to indicate if ip addresses are ip4 or 6
495 @param lcl_ip - local ip
496 @param lcl_plen - local prefix length
497 @param rmt_ip - remote ip
498 @param rmt_ple - remote prefix length
499 @param lcl_port - local port
500 @param rmt_port - remote port
501 @param action_index - the only action defined now is forward to
502 application with index action_index
503 @param is_add - flag to indicate if add or del
504 @param appns_index - application namespace where rule is to be applied to
505 @param scope - enum that indicates scope of the rule: global or local.
506 If 0, default is global, 1 is global 2 is local, 3 is both
509 autoreply define session_rule_add_del {
512 vl_api_transport_proto_t transport_proto;
518 bool is_add [default=true];
520 vl_api_session_rule_scope_t scope;
524 /** \brief Dump session rules
525 @param client_index - opaque cookie to identify the sender
526 @param context - sender context, to match reply w/ request
528 define session_rules_dump
534 /** \brief Session rules details
535 @param context - sender context, to match reply w/ request
536 @param transport_proto - transport protocol
537 @param is_ip4 - flag to indicate if ip addresses are ip4 or 6
538 @param lcl_ip - local ip
539 @param lcl_plen - local prefix length
540 @param rmt_ip - remote ip
541 @param rmt_ple - remote prefix length
542 @param lcl_port - local port
543 @param rmt_port - remote port
544 @param action_index - the only action defined now is forward to
545 application with index action_index
546 @param appns_index - application namespace where rule is to be applied to
547 @param scope - enum that indicates scope of the rule: global or local.
548 If 0, default is global, 1 is global 2 is local, 3 is both
551 define session_rules_details
554 vl_api_transport_proto_t transport_proto;
561 vl_api_session_rule_scope_t scope;
567 * eval: (c-set-style "gnu")