Remove client_index field from replies in API
[vpp.git] / src / vnet / session / session.api
1 /*
2  * Copyright (c) 2015-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 option version = "1.1.0";
17
18 /** \brief client->vpp, attach application to session layer
19     @param client_index - opaque cookie to identify the sender
20     @param context - sender context, to match reply w/ request
21     @param initial_segment_size - size of the initial shm segment to be 
22                                                           allocated
23     @param options - segment size, fifo sizes, etc.
24     @param namespace_id_len - length of the namespace id c-string
25     @param namespace_id - 0 terminted c-string
26 */
27  define application_attach {
28     u32 client_index;
29     u32 context;
30     u32 initial_segment_size;
31     u64 options[16];
32     u8 namespace_id_len;
33     u8 namespace_id [64];
34  };
35  
36  /** \brief Application attach reply
37     @param context - sender context, to match reply w/ request
38     @param retval - return code for the request
39     @param app_event_queue_address - vpp event queue address or 0 if this 
40                                          connection shouldn't send events
41     @param n_fds - number of fds exchanged
42     @param fd_flags - set of flags that indicate which fds are to be expected
43                                   over the socket (set only if socket transport available) 
44     @param segment_size - size of first shm segment
45     @param segment_name_length - length of segment name 
46     @param segment_name - name of segment client needs to attach to
47 */
48 define application_attach_reply {
49     u32 context;
50     i32 retval;
51     u64 app_event_queue_address;
52     u8 n_fds;
53     u8 fd_flags;
54     u32 segment_size;
55     u8 segment_name_length;
56     u8 segment_name[128];
57 };
58
59 /** \brief Application add TLS certificate
60     @param client_index - opaque cookie to identify the sender
61     @param context - sender context, to match reply w/ request
62     @param cert_len - certificate length
63     @param cert - certificate as a string
64 */
65 autoreply define application_tls_cert_add {
66     u32 client_index;
67     u32 context;
68     u32 app_index;
69     u16 cert_len;
70     u8 cert[cert_len];
71 };
72
73 /** \brief Application add TLS key
74     @param client_index - opaque cookie to identify the sender
75     @param context - sender context, to match reply w/ request
76     @param key_len - certificate length
77     @param key - PEM encoded key as a string
78 */
79 autoreply define application_tls_key_add {
80     u32 client_index;
81     u32 context;
82     u32 app_index;
83     u16 key_len;
84     u8 key[key_len];
85 };
86
87  /** \brief client->vpp, attach application to session layer
88     @param client_index - opaque cookie to identify the sender
89     @param context - sender context, to match reply w/ request
90 */
91 autoreply define application_detach {
92     u32 client_index;
93     u32 context;
94  };
95  
96 /** \brief vpp->client, please map an additional shared memory segment
97     @param client_index - opaque cookie to identify the sender
98     @param context - sender context, to match reply w/ request
99         @param fd_flags - set of flags that indicate which, if any, fds are 
100                                           to be expected over the socket. This is set only if 
101                                           socket transport available
102     @param segment_size - size of the segment to be mapped
103     @param segment_name - name of the segment to be mapped
104 */
105 autoreply define map_another_segment {
106     u32 client_index;
107     u32 context;
108     u8 fd_flags;
109     u32 segment_size;
110     u8 segment_name[128];
111 };
112
113 /** \brief vpp->client unmap shared memory segment
114     @param client_index - opaque cookie to identify the sender
115     @param context - sender context, to match reply w/ request
116     @param segment_name - 
117 */
118 autoreply define unmap_segment {
119     u32 client_index;
120     u32 context;
121     u8 segment_name[128];
122 };
123
124  /** \brief Bind to a given URI
125     @param client_index - opaque cookie to identify the sender
126     @param context - sender context, to match reply w/ request
127     @param accept_cookie - sender accept cookie, to identify this bind flavor
128     @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4]
129                  "tcp://::/0/80" [ipv6] etc.
130     @param options - socket options, fifo sizes, etc.
131 */
132 define bind_uri {
133   u32 client_index;
134   u32 context;
135   u32 accept_cookie;
136   u8 uri[128];
137 };
138
139 define bind_uri_reply {
140   u32 context;
141   u64 handle;
142   i32 retval;
143   u64 rx_fifo;
144   u64 tx_fifo;
145   u8 lcl_is_ip4;
146   u8 lcl_ip[16];
147   u16 lcl_port;
148   u64 vpp_evt_q;
149 };
150
151 /** \brief Unbind a given URI
152     @param client_index - opaque cookie to identify the sender
153     @param context - sender context, to match reply w/ request
154     @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4]
155                  "tcp://::/0/80" [ipv6], etc.
156     @param options - socket options, fifo sizes, etc.
157 */
158 autoreply define unbind_uri {
159   u32 client_index;
160   u32 context;
161   u8 uri[128];
162 };
163
164 /** \brief Connect to a given URI
165     @param client_index - opaque cookie to identify the sender
166     @param context - sender context, to match reply w/ request
167     @param client_queue_address - binary API client queue address. Used by 
168                                                           local server when connect was redirected.
169     @param options - socket options, fifo sizes, etc. passed by vpp to the
170                                  server when redirecting connects 
171     @param uri - a URI, e.g. "tcp4://0.0.0.0/0/80"
172                  "tcp6://::/0/80" [ipv6], etc.
173 */
174 autoreply define connect_uri {
175   u32 client_index;
176   u32 context;
177   u64 client_queue_address;
178   u64 options[16];
179   u8 uri[128];
180 };
181
182 /** \brief vpp->client, accept this session
183     @param context - sender context, to match reply w/ request
184     @param listener_handle - tells client which listener this pertains to
185     @param handle - unique session identifier
186     @param rx_fifo_address - rx (vpp -> vpp-client) fifo address 
187     @param tx_fifo_address - tx (vpp-client -> vpp) fifo address 
188     @param vpp_event_queue_address - vpp's event queue address or client's
189                                                                         event queue for cut through
190     @param server_event_queue_address - server's event queue address for
191                                                                            cut through sessions
192     @param port - remote port
193     @param is_ip4 - 1 if the ip is ip4
194     @param ip - remote ip
195 */
196 define accept_session {
197   u32 client_index;
198   u32 context;
199   u64 listener_handle;
200   u64 handle; 
201   u64 server_rx_fifo;
202   u64 server_tx_fifo;
203   u64 vpp_event_queue_address;
204   u64 server_event_queue_address;
205   u16 port;
206   u8 is_ip4;
207   u8 ip[16];
208 };
209
210 /** \brief client->vpp, reply to an accept message
211     @param context - sender context, to match reply w/ request
212     @param retval - return code for the request
213     @param session_index - session index from accept_session / connect_reply
214     @param session_thread_index - thread index from accept_session /
215                                   connect_reply
216 */
217 define accept_session_reply {
218   u32 context;
219   i32 retval;
220   u64 handle;
221 };
222
223 /** \brief bidirectional disconnect API
224     @param client_index - opaque cookie to identify the sender
225                           client to vpp direction only
226     @param context - sender context, to match reply w/ request
227     @param handle - session handle obtained from accept/connect
228 */
229 define disconnect_session {
230   u32 client_index;
231   u32 context;
232   u64 handle;
233 };
234
235 /** \brief bidirectional disconnect reply API
236     @param client_index - opaque cookie to identify the sender
237                           client to vpp direction only
238     @param context - sender context, to match reply w/ request
239     @param retval - return code for the request
240     @param handle - session handle
241 */
242 define disconnect_session_reply {
243   u32 context;
244   i32 retval;
245   u64 handle;
246 };
247
248 /** \brief vpp->client reset session API
249     @param client_index - opaque cookie to identify the sender
250                           client to vpp direction only
251     @param context - sender context, to match reply w/ request
252     @param handle - session handle obtained via accept/connects
253 */
254 define reset_session {
255   u32 client_index;
256   u32 context;
257   u64 handle;
258 };
259
260 /** \brief client->vpp reset session reply
261     @param context - sender context, to match reply w/ request
262     @param retval - return code for the request
263     @param handle - session handle obtained via accept/connect
264 */
265 define reset_session_reply {
266   u32 context;
267   i32 retval;
268   u64 handle;
269 };
270
271 /** \brief Bind to an ip:port pair for a given transport protocol
272     @param client_index - opaque cookie to identify the sender
273     @param context - sender context, to match reply w/ request
274     @param vrf - bind namespace
275     @param is_ip4 - flag that is 1 if ip address family is IPv4
276     @param ip - ip address
277     @param port - port 
278     @param proto - protocol 0 - TCP 1 - UDP
279     @param options - socket options, fifo sizes, etc.
280 */
281 define bind_sock {
282   u32 client_index;
283   u32 context;
284   u32 vrf;
285   u8 is_ip4;
286   u8 ip[16];
287   u16 port;
288   u8 proto;
289   u64 options[16];
290 };
291
292 /** \brief Unbind 
293     @param client_index - opaque cookie to identify the sender
294     @param context - sender context, to match reply w/ request
295     @param handle - bind handle obtained from bind reply
296 */
297 autoreply define unbind_sock {
298   u32 client_index;
299   u32 context;
300   u64 handle;
301 };
302
303 /** \brief Connect to a remote peer
304     @param client_index - opaque cookie to identify the sender
305     @param context - sender context, to match reply w/ request
306     @param client_queue_address - client's API queue address. Non-zero when 
307                                   used to perform redirects
308     @param options - socket options, fifo sizes, etc. when doing redirects
309     @param vrf - connection namespace
310     @param is_ip4 - flag that is 1 if ip address family is IPv4
311     @param ip - ip address
312     @param port - port 
313     @param proto - protocol 0 - TCP 1 - UDP
314     @param hostname-len - length of hostname
315     @param hostname - destination's hostname. If present, used by protocols
316                                           like tls.
317 */
318 autoreply define connect_sock {
319   u32 client_index;
320   u32 context;
321   u64 client_queue_address;
322   u64 options[16];
323   u32 vrf;
324   u8 is_ip4;
325   u8 ip[16];
326   u16 port;
327   u8 proto;
328   u8 hostname_len;
329   u8 hostname[hostname_len];
330 };
331
332 /** \brief Bind reply
333     @param context - sender context, to match reply w/ request
334     @param handle - bind handle
335     @param retval - return code for the request
336     @param lcl_is_ip4 - local ip address type
337     @param lcl_ip6 - local ip address
338     @param lcl_port - local port
339     @param rx_fifo - rx fifo address if allocated (connectionless)
340     @param tx_fifo - tx fifo address if allocated (connectionless) 
341     @param vpp_evt_q - vpp event queue address (connectionless)
342     @param segment_name_length - length of segment name 
343     @param segment_name - name of segment client needs to attach to
344 */
345 define bind_sock_reply {
346   u32 context;
347   u64 handle;
348   i32 retval;
349   u8 lcl_is_ip4;
350   u8 lcl_ip[16];
351   u16 lcl_port;
352   u64 rx_fifo;
353   u64 tx_fifo;
354   u64 vpp_evt_q;
355   u32 segment_size;
356   u8 segment_name_length;
357   u8 segment_name[128];
358 };
359
360 /* Dummy connect message -- needed to satisfy api generators
361 *
362 *  NEVER USED, doxygen tags elided on purpose.
363 */
364 define connect_session {
365   u32 client_index;
366   u32 context;
367 };
368
369 /** \brief vpp/server->client, connect reply -- used for all connect_* messages
370     @param context - sender context, to match reply w/ request
371     @param retval - return code for the request
372     @param handle - connection handle
373     @param server_rx_fifo - rx (vpp -> vpp-client) fifo address 
374     @param server_tx_fifo - tx (vpp-client -> vpp) fifo address 
375     @param vpp_event_queue_address - vpp's event queue address
376     @param client_event_queue_address - client's event queue address
377     @param segment_size - size of segment to be attached. Only for redirects.
378     @param segment_name_length - non-zero if the client needs to attach to 
379                                  the fifo segment
380     @param segment_name - set if the client needs to attach to the segment
381     @param lcl_ip - local ip for connection
382     @param is_ip4 - flag to indicate if ip is v4 or v6
383     @param lcl_port - local port
384 */
385 define connect_session_reply {
386   u32 context;
387   i32 retval;
388   u64 handle;
389   u64 server_rx_fifo;
390   u64 server_tx_fifo;
391   u64 vpp_event_queue_address;
392   u64 client_event_queue_address;
393   u32 segment_size;
394   u8 segment_name_length;
395   u8 segment_name[128];
396   u8 lcl_ip[16];
397   u8 is_ip4;
398   u16 lcl_port;
399 };
400
401 /** \brief ask app to add a new cut-through registration
402     @param client_index - opaque cookie to identify the sender
403                           client to vpp direction only
404     @param context - sender context, to match reply w/ request
405     @param evt_q_address - address of the mq in ssvm segment
406     @param peer_evt_q_address - address of peer's mq in ssvm segment
407     @param n_fds - number of fds exchanged
408     @param fd_flags - flag indicating the fds that will be exchanged over
409                                   api socket
410 */
411 autoreply define app_cut_through_registration_add
412 {
413   u32 client_index;
414   u32 context;
415   u64 evt_q_address;
416   u64 peer_evt_q_address;
417   u8 n_fds;
418   u8 fd_flags;
419 };
420
421 /** \brief enable/disable session layer
422     @param client_index - opaque cookie to identify the sender
423                           client to vpp direction only
424     @param context - sender context, to match reply w/ request
425     @param is_enable - disable session layer if 0, enable otherwise
426 */
427 autoreply define session_enable_disable {
428   u32 client_index;
429   u32 context;
430   u8 is_enable;
431 };
432
433 /** \brief add/del application namespace
434     @param client_index - opaque cookie to identify the sender
435                           client to vpp direction only
436     @param context - sender context, to match reply w/ request
437     @param secret - secret shared between app and vpp 
438     @param sw_if_index - local interface that "supports" namespace. Set to
439                                                 ~0 if no preference
440     @param ip4_fib_id - id of ip4 fib that "supports" the namespace. Ignored 
441                                                 if sw_if_index set.
442     @param ip6_fib_id - id of ip6 fib that "supports" the namespace. Ignored 
443                                                 if sw_if_index set.
444     @param namespace_id_len - length of namespace id lower
445     @param namespace_id - namespace id
446 */
447 define app_namespace_add_del {
448   u32 client_index;
449   u32 context;
450   u64 secret;
451   u32 sw_if_index;
452   u32 ip4_fib_id;
453   u32 ip6_fib_id;
454   u8 namespace_id_len;
455   u8 namespace_id[64];
456 };
457
458 /** \brief Reply for app namespace add/del
459     @param context - returned sender context, to match reply w/ request
460     @param retval - return code
461     @param appns_index - app namespace index
462 */
463 define app_namespace_add_del_reply
464 {
465   u32 context;
466   i32 retval;
467   u32 appns_index;
468 };
469
470 /** \brief add/del session rule
471     @param client_index - opaque cookie to identify the sender
472                           client to vpp direction only
473     @param context - sender context, to match reply w/ request
474     @param transport_proto - transport protocol (0 - tcp 1 - udp)
475     @param is_ip4 - flag to indicate if ip addresses are ip4 or 6
476     @param lcl_ip - local ip
477     @param lcl_plen - local prefix length
478     @param rmt_ip - remote ip
479     @param rmt_ple - remote prefix length
480     @param lcl_port - local port
481     @param rmt_port - remote port
482     @param action_index - the only action defined now is forward to 
483                                                   application with index action_index
484         @param is_add - flag to indicate if add or del
485         @param appns_index - application namespace where rule is to be applied
486                                                  to
487         @param scope - flag that indicates scope of the rule: global or local.
488                                    If 0, default is global, 1 is global 2 is local, 3 is
489                                    both
490 */
491 autoreply define session_rule_add_del {
492   u32 client_index;
493   u32 context;
494   u8 transport_proto;
495   u8 is_ip4;
496   u8 lcl_ip[16];
497   u8 lcl_plen;
498   u8 rmt_ip[16];
499   u8 rmt_plen;
500   u16 lcl_port;
501   u16 rmt_port;
502   u32 action_index;
503   u8 is_add;
504   u32 appns_index;
505   u8 scope;
506   u8 tag[64];
507 };
508
509 /** \brief Dump session rules
510     @param client_index - opaque cookie to identify the sender
511     @param context - sender context, to match reply w/ request
512  */
513 define session_rules_dump
514 {
515   u32 client_index;
516   u32 context;
517 };
518
519 /** \brief Session rules details
520         @param context - sender context, to match reply w/ request
521     @param transport_proto - transport protocol (0 - tcp 1 - udp)
522     @param is_ip4 - flag to indicate if ip addresses are ip4 or 6
523     @param lcl_ip - local ip
524     @param lcl_plen - local prefix length
525     @param rmt_ip - remote ip
526     @param rmt_ple - remote prefix length
527     @param lcl_port - local port
528     @param rmt_port - remote port
529     @param action_index - the only action defined now is forward to
530                                                   application with index action_index
531         @param appns_index - application namespace where rule is to be applied
532                                                  to
533         @param scope - flag that indicates scope of the rule: global or local.
534                                    If 0, default is global, 1 is global 2 is local, 3 is
535                                    both
536   */
537 define session_rules_details
538 {
539   u32 context;
540   u8 transport_proto;
541   u8 is_ip4;
542   u8 lcl_ip[16];
543   u8 lcl_plen;
544   u8 rmt_ip[16];
545   u8 rmt_plen;
546   u16 lcl_port;
547   u16 rmt_port;
548   u32 action_index;
549   u32 appns_index;
550   u8 scope;
551   u8 tag[64];
552 };
553
554 /*
555  * Local Variables:
556  * eval: (c-set-style "gnu")
557  * End:
558  */