Fix session connect_* api message handling.
[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 /** \brief client->vpp, attach application to session layer
17     @param client_index - opaque cookie to identify the sender
18     @param context - sender context, to match reply w/ request
19     @param initial_segment_size - size of the initial shm segment to be 
20                                                           allocated
21     @param options - segment size, fifo sizes, etc.
22 */
23  define application_attach {
24     u32 client_index;
25     u32 context;
26     u32 initial_segment_size;
27     u64 options[16];
28  };
29  
30  /** \brief Application attach reply
31     @param context - sender context, to match reply w/ request
32     @param retval - return code for the request
33     @param app_event_queue_address - vpp event queue address or 0 if this 
34                                          connection shouldn't send events
35     @param segment_size - size of first shm segment
36     @param segment_name_length - length of segment name 
37     @param segment_name - name of segment client needs to attach to
38 */
39 define application_attach_reply {
40     u32 context;
41     i32 retval;
42     u64 app_event_queue_address;
43     u32 segment_size;
44     u8 segment_name_length;
45     u8 segment_name[128];
46 };
47
48  /** \brief client->vpp, attach application to session layer
49     @param client_index - opaque cookie to identify the sender
50     @param context - sender context, to match reply w/ request
51 */
52 autoreply define application_detach {
53     u32 client_index;
54     u32 context;
55  };
56  
57 /** \brief vpp->client, please map an additional shared memory segment
58     @param client_index - opaque cookie to identify the sender
59     @param context - sender context, to match reply w/ request
60     @param segment_name - 
61 */
62 autoreply define map_another_segment {
63     u32 client_index;
64     u32 context;
65     u32 segment_size;
66     u8 segment_name[128];
67 };
68
69  /** \brief Bind to a given URI
70     @param client_index - opaque cookie to identify the sender
71     @param context - sender context, to match reply w/ request
72     @param accept_cookie - sender accept cookie, to identify this bind flavor
73     @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4]
74                  "tcp://::/0/80" [ipv6] etc.
75     @param options - socket options, fifo sizes, etc.
76 */
77 autoreply define bind_uri {
78   u32 client_index;
79   u32 context;
80   u32 accept_cookie;
81   u8 uri[128];
82 };
83
84 /** \brief Unbind a given URI
85     @param client_index - opaque cookie to identify the sender
86     @param context - sender context, to match reply w/ request
87     @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4]
88                  "tcp://::/0/80" [ipv6], etc.
89     @param options - socket options, fifo sizes, etc.
90 */
91 autoreply define unbind_uri {
92   u32 client_index;
93   u32 context;
94   u8 uri[128];
95 };
96
97 /** \brief Connect to a given URI
98     @param client_index - opaque cookie to identify the sender
99     @param context - sender context, to match reply w/ request
100     @param accept_cookie - sender accept cookie, to identify this bind flavor
101     @param uri - a URI, e.g. "tcp4://0.0.0.0/0/80"
102                  "tcp6://::/0/80" [ipv6], etc.
103     @param options - socket options, fifo sizes, etc. passed by vpp to the
104                                  server when redirecting connects 
105     @param client_queue_address - binary API client queue address. Used by 
106                                                           local server when connect was redirected.
107 */
108 autoreply define connect_uri {
109   u32 client_index;
110   u32 context;
111   u8 uri[128];
112   u64 client_queue_address;
113   u64 options[16];
114 };
115
116 /** \brief vpp->client, accept this session
117     @param context - sender context, to match reply w/ request
118     @param listener_handle - tells client which listener this pertains to
119     @param handle - unique session identifier
120     @param session_thread_index - thread index of new session
121     @param rx_fifo_address - rx (vpp -> vpp-client) fifo address 
122     @param tx_fifo_address - tx (vpp-client -> vpp) fifo address 
123     @param vpp_event_queue_address - vpp's event queue address
124     @param port - remote port
125     @param is_ip4 - 1 if the ip is ip4
126     @param ip - remote ip
127 */
128 define accept_session {
129   u32 client_index;
130   u32 context;
131   u64 listener_handle;
132   u64 handle; 
133   u64 server_rx_fifo;
134   u64 server_tx_fifo;
135   u64 vpp_event_queue_address;
136   u16 port;
137   u8 is_ip4;
138   u8 ip[16];
139 };
140
141 /** \brief client->vpp, reply to an accept message
142     @param context - sender context, to match reply w/ request
143     @param retval - return code for the request
144     @param session_index - session index from accept_session / connect_reply
145     @param session_thread_index - thread index from accept_session /
146                                   connect_reply
147 */
148 define accept_session_reply {
149   u32 context;
150   i32 retval;
151   u64 handle;
152 };
153
154 /** \brief bidirectional disconnect API
155     @param client_index - opaque cookie to identify the sender
156                           client to vpp direction only
157     @param context - sender context, to match reply w/ request
158     @param handle - session handle obtained from accept/connect
159 */
160 define disconnect_session {
161   u32 client_index;
162   u32 context;
163   u64 handle;
164 };
165
166 /** \brief bidirectional disconnect reply API
167     @param client_index - opaque cookie to identify the sender
168                           client to vpp direction only
169     @param context - sender context, to match reply w/ request
170     @param retval - return code for the request
171     @param handle - session handle
172 */
173 define disconnect_session_reply {
174   u32 client_index;
175   u32 context;
176   i32 retval;
177   u64 handle;
178 };
179
180 /** \brief vpp->client reset session API
181     @param client_index - opaque cookie to identify the sender
182                           client to vpp direction only
183     @param context - sender context, to match reply w/ request
184     @param handle - session handle obtained via accept/connects
185 */
186 define reset_session {
187   u32 client_index;
188   u32 context;
189   u64 handle;
190 };
191
192 /** \brief client->vpp reset session reply
193     @param client_index - opaque cookie to identify the sender
194                           client to vpp direction only
195     @param context - sender context, to match reply w/ request
196     @param retval - return code for the request
197     @param handle - session handle obtained via accept/connect
198 */
199 define reset_session_reply {
200   u32 client_index;
201   u32 context;
202   i32 retval;
203   u64 handle;
204 };
205
206 /** \brief Bind to an ip:port pair for a given transport protocol
207     @param client_index - opaque cookie to identify the sender
208     @param context - sender context, to match reply w/ request
209     @param vrf - bind namespace
210     @param is_ip4 - flag that is 1 if ip address family is IPv4
211     @param ip - ip address
212     @param port - port 
213     @param proto - protocol 0 - TCP 1 - UDP
214     @param options - socket options, fifo sizes, etc.
215 */
216 define bind_sock {
217   u32 client_index;
218   u32 context;
219   u32 vrf;
220   u8 is_ip4;
221   u8 ip[16];
222   u16 port;
223   u8 proto;
224   u64 options[16];
225 };
226
227 /** \brief Unbind 
228     @param client_index - opaque cookie to identify the sender
229     @param context - sender context, to match reply w/ request
230     @param handle - bind handle obtained from bind reply
231 */
232 autoreply define unbind_sock {
233   u32 client_index;
234   u32 context;
235   u64 handle;
236 };
237
238 /** \brief Connect to a remote peer
239     @param client_index - opaque cookie to identify the sender
240     @param context - sender context, to match reply w/ request
241     @param app_connect - application connection id to be returned in reply
242     @param vrf - connection namespace
243     @param is_ip4 - flag that is 1 if ip address family is IPv4
244     @param ip - ip address
245     @param port - port 
246     @param proto - protocol 0 - TCP 1 - UDP
247     @param client_queue_address - client's API queue address. Non-zero when 
248                                   used to perform redirects
249     @param options - socket options, fifo sizes, etc. when doing redirects
250 */
251 autoreply define connect_sock {
252   u32 client_index;
253   u32 context;
254   u32 vrf;
255   u8 is_ip4;
256   u8 ip[16];
257   u16 port;
258   u8 proto;
259   u64 client_queue_address;
260   u64 options[16];
261 };
262
263 /** \brief Bind reply
264     @param context - sender context, to match reply w/ request
265     @param handle - bind handle
266     @param retval - return code for the request
267     @param event_queue_address - vpp event queue address or 0 if this 
268                                  connection shouldn't send events
269     @param segment_name_length - length of segment name 
270     @param segment_name - name of segment client needs to attach to
271 */
272 define bind_sock_reply {
273   u32 context;
274   u64 handle;
275   i32 retval;
276   u64 server_event_queue_address;
277   u32 segment_size;
278   u8 segment_name_length;
279   u8 segment_name[128];
280 };
281
282 /* Dummy connect message -- needed to satisfy api generators
283 *
284 *  NEVER USED, doxygen tags elided on purpose.
285 */
286 define connect_session {
287   u32 client_index;
288   u32 context;
289 };
290
291 /** \brief vpp/server->client, connect reply -- used for all connect_* messages
292     @param context - sender context, to match reply w/ request
293     @param retval - return code for the request
294     @param handle - connection handle
295     @param server_rx_fifo - rx (vpp -> vpp-client) fifo address 
296     @param server_tx_fifo - tx (vpp-client -> vpp) fifo address 
297     @param vpp_event_queue_address - vpp's event queue address
298     @param segment_size - size of segment to be attached. Only for redirects.
299     @param segment_name_length - non-zero if the client needs to attach to 
300                                  the fifo segment
301     @param segment_name - set if the client needs to attach to the segment
302 */
303 define connect_session_reply {
304   u32 context;
305   i32 retval;
306   u64 handle;
307   u64 server_rx_fifo;
308   u64 server_tx_fifo;
309   u64 vpp_event_queue_address;
310   u32 segment_size;
311   u8 segment_name_length;
312   u8 segment_name[128];
313 };
314
315 /** \brief enable/disable session layer
316     @param client_index - opaque cookie to identify the sender
317                           client to vpp direction only
318     @param context - sender context, to match reply w/ request
319     @param is_enable - disable session layer if 0, enable otherwise
320 */
321 autoreply define session_enable_disable {
322   u32 client_index;
323   u32 context;
324   u8 is_enable;
325 };
326
327 /*
328  * Local Variables:
329  * eval: (c-set-style "gnu")
330  * End:
331  */