Dave Barach | 52851e6 | 2017-08-07 09:35:25 -0400 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * builtin_proxy.h - skeleton vpp engine plug-in header file |
| 4 | * |
| 5 | * Copyright (c) <current-year> <your-organization> |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at: |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | */ |
Florin Coras | 4399c2e | 2018-01-25 06:34:42 -0800 | [diff] [blame^] | 18 | #ifndef __included_proxy_h__ |
| 19 | #define __included_proxy_h__ |
Dave Barach | 52851e6 | 2017-08-07 09:35:25 -0400 | [diff] [blame] | 20 | |
| 21 | #include <vnet/vnet.h> |
| 22 | #include <vnet/ip/ip.h> |
Dave Barach | 52851e6 | 2017-08-07 09:35:25 -0400 | [diff] [blame] | 23 | |
| 24 | #include <vppinfra/hash.h> |
| 25 | #include <vppinfra/error.h> |
Dave Barach | 52851e6 | 2017-08-07 09:35:25 -0400 | [diff] [blame] | 26 | #include <svm/svm_fifo_segment.h> |
| 27 | #include <vnet/session/session.h> |
| 28 | #include <vnet/session/application_interface.h> |
| 29 | |
| 30 | typedef struct |
| 31 | { |
| 32 | svm_fifo_t *server_rx_fifo; |
| 33 | svm_fifo_t *server_tx_fifo; |
| 34 | |
| 35 | u64 vpp_server_handle; |
| 36 | u64 vpp_active_open_handle; |
| 37 | } proxy_session_t; |
| 38 | |
| 39 | typedef struct |
| 40 | { |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 41 | svm_queue_t *vl_input_queue; /**< vpe input queue */ |
Dave Barach | 52851e6 | 2017-08-07 09:35:25 -0400 | [diff] [blame] | 42 | /** per-thread vectors */ |
Florin Coras | e86a8ed | 2018-01-05 03:20:25 -0800 | [diff] [blame] | 43 | svm_queue_t **server_event_queue; |
| 44 | svm_queue_t **active_open_event_queue; |
Dave Barach | 52851e6 | 2017-08-07 09:35:25 -0400 | [diff] [blame] | 45 | u8 **rx_buf; /**< intermediate rx buffers */ |
| 46 | |
| 47 | u32 cli_node_index; /**< cli process node index */ |
| 48 | u32 server_client_index; /**< server API client handle */ |
| 49 | u32 server_app_index; /**< server app index */ |
| 50 | u32 active_open_client_index; /**< active open API client handle */ |
| 51 | u32 active_open_app_index; /**< active open index after attach */ |
| 52 | |
| 53 | uword *proxy_session_by_server_handle; |
| 54 | uword *proxy_session_by_active_open_handle; |
| 55 | |
| 56 | /* |
| 57 | * Configuration params |
| 58 | */ |
| 59 | u8 *connect_uri; /**< URI for slave's connect */ |
| 60 | u32 configured_segment_size; |
| 61 | u32 fifo_size; |
| 62 | u32 private_segment_count; /**< Number of private fifo segs */ |
| 63 | u32 private_segment_size; /**< size of private fifo segs */ |
| 64 | int rcv_buffer_size; |
Florin Coras | ee7e1f5 | 2018-01-11 02:23:35 -0800 | [diff] [blame] | 65 | u8 *server_uri; |
| 66 | u8 *client_uri; |
Dave Barach | 52851e6 | 2017-08-07 09:35:25 -0400 | [diff] [blame] | 67 | |
| 68 | /* |
| 69 | * Test state variables |
| 70 | */ |
| 71 | proxy_session_t *sessions; /**< Session pool, shared */ |
| 72 | clib_spinlock_t sessions_lock; |
| 73 | u32 **connection_index_by_thread; |
| 74 | pthread_t client_thread_handle; |
| 75 | |
| 76 | /* |
| 77 | * Flags |
| 78 | */ |
| 79 | u8 is_init; |
| 80 | u8 prealloc_fifos; /**< Request fifo preallocation */ |
Florin Coras | 4399c2e | 2018-01-25 06:34:42 -0800 | [diff] [blame^] | 81 | } proxy_main_t; |
Dave Barach | 52851e6 | 2017-08-07 09:35:25 -0400 | [diff] [blame] | 82 | |
Florin Coras | 4399c2e | 2018-01-25 06:34:42 -0800 | [diff] [blame^] | 83 | extern proxy_main_t proxy_main; |
Dave Barach | 52851e6 | 2017-08-07 09:35:25 -0400 | [diff] [blame] | 84 | |
Florin Coras | 4399c2e | 2018-01-25 06:34:42 -0800 | [diff] [blame^] | 85 | #endif /* __included_proxy_h__ */ |
Dave Barach | 52851e6 | 2017-08-07 09:35:25 -0400 | [diff] [blame] | 86 | |
| 87 | /* |
| 88 | * fd.io coding-style-patch-verification: ON |
| 89 | * |
| 90 | * Local Variables: |
| 91 | * eval: (c-set-style "gnu") |
| 92 | * End: |
| 93 | */ |