Dave Barach | 68b0fb0 | 2017-02-28 15:15:56 -0500 | [diff] [blame^] | 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 Bind to a given URI |
| 17 | @param client_index - opaque cookie to identify the sender |
| 18 | @param context - sender context, to match reply w/ request |
| 19 | @param accept_cookie - sender accept cookie, to identify this bind flavor |
| 20 | @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4] |
| 21 | "tcp://::/0/80" [ipv6] etc. |
| 22 | @param options - socket options, fifo sizes, etc. |
| 23 | */ |
| 24 | define bind_uri { |
| 25 | u32 client_index; |
| 26 | u32 context; |
| 27 | u32 accept_cookie; |
| 28 | u32 initial_segment_size; |
| 29 | u8 uri[128]; |
| 30 | u64 options[16]; |
| 31 | }; |
| 32 | |
| 33 | /** \brief Unbind a given URI |
| 34 | @param client_index - opaque cookie to identify the sender |
| 35 | @param context - sender context, to match reply w/ request |
| 36 | @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4] |
| 37 | "tcp://::/0/80" [ipv6], etc. |
| 38 | @param options - socket options, fifo sizes, etc. |
| 39 | */ |
| 40 | define unbind_uri { |
| 41 | u32 client_index; |
| 42 | u32 context; |
| 43 | u8 uri[128]; |
| 44 | }; |
| 45 | |
| 46 | /** \brief Connect to a given URI |
| 47 | @param client_index - opaque cookie to identify the sender |
| 48 | @param context - sender context, to match reply w/ request |
| 49 | @param accept_cookie - sender accept cookie, to identify this bind flavor |
| 50 | @param uri - a URI, e.g. "tcp4://0.0.0.0/0/80" |
| 51 | "tcp6://::/0/80" [ipv6], etc. |
| 52 | @param options - socket options, fifo sizes, etc. |
| 53 | */ |
| 54 | define connect_uri { |
| 55 | u32 client_index; |
| 56 | u32 context; |
| 57 | u8 uri[128]; |
| 58 | u64 client_queue_address; |
| 59 | u64 options[16]; |
| 60 | }; |
| 61 | |
| 62 | /** \brief Bind reply |
| 63 | @param context - sender context, to match reply w/ request |
| 64 | @param retval - return code for the request |
| 65 | @param event_queue_address - vpp event queue address or 0 if this |
| 66 | connection shouldn't send events |
| 67 | @param segment_name_length - length of segment name |
| 68 | @param segment_name - name of segment client needs to attach to |
| 69 | */ |
| 70 | define bind_uri_reply { |
| 71 | u32 context; |
| 72 | i32 retval; |
| 73 | u64 server_event_queue_address; |
| 74 | u8 segment_name_length; |
| 75 | u32 segment_size; |
| 76 | u8 segment_name[128]; |
| 77 | }; |
| 78 | |
| 79 | /** \brief unbind reply |
| 80 | @param context - sender context, to match reply w/ request |
| 81 | @param retval - return code for the request |
| 82 | */ |
| 83 | define unbind_uri_reply { |
| 84 | u32 context; |
| 85 | i32 retval; |
| 86 | }; |
| 87 | |
| 88 | /** \brief vpp->client, connect reply |
| 89 | @param context - sender context, to match reply w/ request |
| 90 | @param retval - return code for the request |
| 91 | @param server_rx_fifo - rx (vpp -> vpp-client) fifo address |
| 92 | @param server_tx_fifo - tx (vpp-client -> vpp) fifo address |
| 93 | @param session_index - session index; |
| 94 | @param session_thread_index - session thread index |
| 95 | @param session_type - session thread type |
| 96 | @param vpp_event_queue_address - vpp's event queue address |
| 97 | @param client_event_queue_address - client's event queue address |
| 98 | @param segment_name_length - non-zero if the client needs to attach to |
| 99 | the fifo segment |
| 100 | @param segment_name - set if the client needs to attach to the segment |
| 101 | */ |
| 102 | define connect_uri_reply { |
| 103 | u32 context; |
| 104 | i32 retval; |
| 105 | u64 server_rx_fifo; |
| 106 | u64 server_tx_fifo; |
| 107 | u32 session_index; |
| 108 | u32 session_thread_index; |
| 109 | u8 session_type; |
| 110 | u64 client_event_queue_address; |
| 111 | u64 vpp_event_queue_address; |
| 112 | u32 segment_size; |
| 113 | u8 segment_name_length; |
| 114 | u8 segment_name[128]; |
| 115 | }; |
| 116 | |
| 117 | /** \brief vpp->client, please map an additional shared memory segment |
| 118 | @param context - sender context, to match reply w/ request |
| 119 | @param segment_name - |
| 120 | */ |
| 121 | define map_another_segment { |
| 122 | u32 client_index; |
| 123 | u32 context; |
| 124 | u32 segment_size; |
| 125 | u8 segment_name[128]; |
| 126 | }; |
| 127 | |
| 128 | /** \brief client->vpp |
| 129 | @param context - sender context, to match reply w/ request |
| 130 | @param retval - return code for the request |
| 131 | */ |
| 132 | define map_another_segment_reply { |
| 133 | u32 context; |
| 134 | i32 retval; |
| 135 | }; |
| 136 | |
| 137 | /** \brief vpp->client, accept this session |
| 138 | @param context - sender context, to match reply w/ request |
| 139 | @param accept_cookie - tells client which bind flavor just occurred |
| 140 | @param rx_fifo_address - rx (vpp -> vpp-client) fifo address |
| 141 | @param tx_fifo_address - tx (vpp-client -> vpp) fifo address |
| 142 | @param session_index - index of new session |
| 143 | @param session_thread_index - thread index of new session |
| 144 | @param vpp_event_queue_address - vpp's event queue address |
| 145 | @param session_type - type of session |
| 146 | |
| 147 | */ |
| 148 | define accept_session { |
| 149 | u32 client_index; |
| 150 | u32 context; |
| 151 | u32 accept_cookie; |
| 152 | u64 server_rx_fifo; |
| 153 | u64 server_tx_fifo; |
| 154 | u32 session_index; |
| 155 | u32 session_thread_index; |
| 156 | u64 vpp_event_queue_address; |
| 157 | u8 session_type; |
| 158 | }; |
| 159 | |
| 160 | /** \brief client->vpp, reply to an accept message |
| 161 | @param context - sender context, to match reply w/ request |
| 162 | @param retval - return code for the request |
| 163 | @param session_index - session index from accept_session / connect_reply |
| 164 | @param session_thread_index - thread index from accept_session / |
| 165 | connect_reply |
| 166 | */ |
| 167 | define accept_session_reply { |
| 168 | u32 context; |
| 169 | i32 retval; |
| 170 | u8 session_type; |
| 171 | u8 session_thread_index; |
| 172 | u32 session_index; |
| 173 | }; |
| 174 | |
| 175 | /** \brief bidirectional disconnect API |
| 176 | @param client_index - opaque cookie to identify the sender |
| 177 | client to vpp direction only |
| 178 | @param context - sender context, to match reply w/ request |
| 179 | @param session_index - cookie #1 from accept_session / connect_reply |
| 180 | @param session_thread_index - cookie #2 |
| 181 | */ |
| 182 | define disconnect_session { |
| 183 | u32 client_index; |
| 184 | u32 context; |
| 185 | u32 session_index; |
| 186 | u32 session_thread_index; |
| 187 | }; |
| 188 | |
| 189 | /** \brief bidirectional disconnect reply API |
| 190 | @param client_index - opaque cookie to identify the sender |
| 191 | client to vpp direction only |
| 192 | @param context - sender context, to match reply w/ request |
| 193 | @param retval - return code for the request |
| 194 | @param session_index - session index from accept_session / connect_reply |
| 195 | @param session_thread_index - thread index from accept_session / |
| 196 | connect_reply |
| 197 | */ |
| 198 | define disconnect_session_reply { |
| 199 | u32 client_index; |
| 200 | u32 context; |
| 201 | i32 retval; |
| 202 | u32 session_index; |
| 203 | u32 session_thread_index; |
| 204 | }; |
| 205 | |
| 206 | /** \brief vpp->client reset session API |
| 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 session_index - session index from accept_session / connect_reply |
| 211 | @param session_thread_index - thread index from accept_session / |
| 212 | connect_reply |
| 213 | */ |
| 214 | define reset_session { |
| 215 | u32 client_index; |
| 216 | u32 context; |
| 217 | u32 session_index; |
| 218 | u32 session_thread_index; |
| 219 | }; |
| 220 | |
| 221 | /** \brief client->vpp reset session reply |
| 222 | @param client_index - opaque cookie to identify the sender |
| 223 | client to vpp direction only |
| 224 | @param context - sender context, to match reply w/ request |
| 225 | @param retval - return code for the request |
| 226 | @param session_index - session index from accept_session / connect_reply |
| 227 | @param session_thread_index - thread index from accept_session / |
| 228 | connect_reply |
| 229 | */ |
| 230 | define reset_session_reply { |
| 231 | u32 client_index; |
| 232 | u32 context; |
| 233 | i32 retval; |
| 234 | u32 session_index; |
| 235 | u32 session_thread_index; |
| 236 | }; |
| 237 | |
| 238 | /** \brief Bind to an ip:port pair for a given transport protocol |
| 239 | @param client_index - opaque cookie to identify the sender |
| 240 | @param context - sender context, to match reply w/ request |
| 241 | @param vrf - bind namespace |
| 242 | @param is_ip4 - flag that is 1 if ip address family is IPv4 |
| 243 | @param ip - ip address |
| 244 | @param port - port |
| 245 | @param proto - protocol 0 - TCP 1 - UDP |
| 246 | @param options - socket options, fifo sizes, etc. |
| 247 | */ |
| 248 | define bind_sock { |
| 249 | u32 client_index; |
| 250 | u32 context; |
| 251 | u32 vrf; |
| 252 | u8 is_ip4; |
| 253 | u8 ip[16]; |
| 254 | u16 port; |
| 255 | u8 proto; |
| 256 | u64 options[16]; |
| 257 | }; |
| 258 | |
| 259 | /** \brief Unbind |
| 260 | @param client_index - opaque cookie to identify the sender |
| 261 | @param context - sender context, to match reply w/ request |
| 262 | @param handle - bind handle obtained from bind reply |
| 263 | */ |
| 264 | define unbind_sock { |
| 265 | u32 client_index; |
| 266 | u32 context; |
| 267 | u64 handle; |
| 268 | }; |
| 269 | |
| 270 | /** \brief Connect to a remote peer |
| 271 | @param client_index - opaque cookie to identify the sender |
| 272 | @param context - sender context, to match reply w/ request |
| 273 | @param vrf - connection namespace |
| 274 | @param is_ip4 - flag that is 1 if ip address family is IPv4 |
| 275 | @param ip - ip address |
| 276 | @param port - port |
| 277 | @param proto - protocol 0 - TCP 1 - UDP |
| 278 | @param client_queue_address - client's API queue address. Non-zero when |
| 279 | used to perform redirects |
| 280 | @param options - socket options, fifo sizes, etc. |
| 281 | */ |
| 282 | define connect_sock { |
| 283 | u32 client_index; |
| 284 | u32 context; |
| 285 | u32 vrf; |
| 286 | u8 is_ip4; |
| 287 | u8 ip[16]; |
| 288 | u16 port; |
| 289 | u8 proto; |
| 290 | u64 client_queue_address; |
| 291 | u64 options[16]; |
| 292 | }; |
| 293 | |
| 294 | /** \brief Bind reply |
| 295 | @param context - sender context, to match reply w/ request |
| 296 | @param handle - bind handle |
| 297 | @param retval - return code for the request |
| 298 | @param event_queue_address - vpp event queue address or 0 if this |
| 299 | connection shouldn't send events |
| 300 | @param segment_name_length - length of segment name |
| 301 | @param segment_name - name of segment client needs to attach to |
| 302 | */ |
| 303 | define bind_sock_reply { |
| 304 | u32 context; |
| 305 | u64 handle; |
| 306 | i32 retval; |
| 307 | u64 server_event_queue_address; |
| 308 | u32 segment_size; |
| 309 | u8 segment_name_length; |
| 310 | u8 segment_name[128]; |
| 311 | }; |
| 312 | |
| 313 | /** \brief unbind reply |
| 314 | @param context - sender context, to match reply w/ request |
| 315 | @param retval - return code for the request |
| 316 | */ |
| 317 | define unbind_sock_reply { |
| 318 | u32 context; |
| 319 | i32 retval; |
| 320 | }; |
| 321 | |
| 322 | /** \brief vpp/server->client, connect reply |
| 323 | @param context - sender context, to match reply w/ request |
| 324 | @param retval - return code for the request |
| 325 | @param handle - connection handle |
| 326 | @param server_rx_fifo - rx (vpp -> vpp-client) fifo address |
| 327 | @param server_tx_fifo - tx (vpp-client -> vpp) fifo address |
| 328 | @param vpp_event_queue_address - vpp's event queue address |
| 329 | @param client_event_queue_address - client's event queue address |
| 330 | @param segment_name_length - non-zero if the client needs to attach to |
| 331 | the fifo segment |
| 332 | @param segment_name - set if the client needs to attach to the segment |
| 333 | */ |
| 334 | define connect_sock_reply { |
| 335 | u32 context; |
| 336 | i32 retval; |
| 337 | u64 handle; |
| 338 | u64 server_rx_fifo; |
| 339 | u64 server_tx_fifo; |
| 340 | u64 client_event_queue_address; |
| 341 | u64 vpp_event_queue_address; |
| 342 | u32 segment_size; |
| 343 | u8 segment_name_length; |
| 344 | u8 segment_name[128]; |
| 345 | }; |
| 346 | |
| 347 | /** \brief bidirectional disconnect API |
| 348 | @param client_index - opaque cookie to identify the sender |
| 349 | client to vpp direction only |
| 350 | @param context - sender context, to match reply w/ request |
| 351 | @param handle - session handle obtained through accept/connect |
| 352 | */ |
| 353 | define disconnect_sock { |
| 354 | u32 client_index; |
| 355 | u32 context; |
| 356 | u64 handle; |
| 357 | }; |
| 358 | |
| 359 | /** \brief bidirectional disconnect reply API |
| 360 | @param client_index - opaque cookie to identify the sender |
| 361 | client to vpp direction only |
| 362 | @param client_context - sender context, to match reply w/ request |
| 363 | @param handle - session handle obtained through accept/connect |
| 364 | */ |
| 365 | define disconnect_sock_reply { |
| 366 | u32 client_index; |
| 367 | u32 context; |
| 368 | i32 retval; |
| 369 | u64 handle; |
| 370 | }; |
| 371 | |
| 372 | /** \brief vpp->client, accept this session |
| 373 | @param context - sender context, to match reply w/ request |
| 374 | @param accept_cookie - tells client which bind flavor just occurred |
| 375 | @param handle - session handle obtained through accept/connect |
| 376 | @param rx_fifo_address - rx (vpp -> vpp-client) fifo address |
| 377 | @param tx_fifo_address - tx (vpp-client -> vpp) fifo address |
| 378 | @param vpp_event_queue_address - vpp's event queue address |
| 379 | */ |
| 380 | define accept_sock { |
| 381 | u32 client_index; |
| 382 | u32 context; |
| 383 | u32 accept_cookie; |
| 384 | u64 handle; |
| 385 | u64 server_rx_fifo; |
| 386 | u64 server_tx_fifo; |
| 387 | u64 vpp_event_queue_address; |
| 388 | }; |
| 389 | |
| 390 | /** \brief client->vpp, reply to an accept message |
| 391 | @param context - sender context, to match reply w/ request |
| 392 | @param retval - return code for the request |
| 393 | @param handle - session handle obtained through accept/connect |
| 394 | */ |
| 395 | define accept_sock_reply { |
| 396 | u32 context; |
| 397 | i32 retval; |
| 398 | u64 handle; |
| 399 | }; |
| 400 | |
| 401 | /** \brief vpp->client reset session API |
| 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 handle - session handle obtained through accept/connect |
| 406 | */ |
| 407 | define reset_sock { |
| 408 | u32 client_index; |
| 409 | u32 context; |
| 410 | u64 handle; |
| 411 | }; |
| 412 | |
| 413 | /** \brief client->vpp reset session reply |
| 414 | @param client_index - opaque cookie to identify the sender |
| 415 | client to vpp direction only |
| 416 | @param context - sender context, to match reply w/ request |
| 417 | @param handle - session handle obtained through accept/connect |
| 418 | */ |
| 419 | define reset_sock_reply { |
| 420 | u32 client_index; |
| 421 | u32 context; |
| 422 | i32 retval; |
| 423 | u64 handle; |
| 424 | }; |
| 425 | /* |
| 426 | * Local Variables: |
| 427 | * eval: (c-set-style "gnu") |
| 428 | * End: |
| 429 | */ |