4b4c7c0ca8f6ea3dc2747e8d8bb08b34335fa1c7
[vpp.git] / src / plugins / hs_apps / proxy.h
1
2 /*
3  * builtin_proxy.h - skeleton vpp engine plug-in header file
4  *
5  * Copyright (c) 2017-2019 Cisco and/or its affiliates.
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  */
18 #ifndef __included_proxy_h__
19 #define __included_proxy_h__
20
21 #include <vnet/vnet.h>
22 #include <vnet/ip/ip.h>
23
24 #include <vppinfra/hash.h>
25 #include <vppinfra/error.h>
26 #include <vnet/session/session.h>
27 #include <vnet/session/application_interface.h>
28
29 typedef struct
30 {
31   svm_fifo_t *server_rx_fifo;
32   svm_fifo_t *server_tx_fifo;
33
34   session_handle_t vpp_server_handle;
35   session_handle_t vpp_active_open_handle;
36   volatile int active_open_establishing;
37   volatile int po_disconnected;
38   volatile int ao_disconnected;
39
40   u32 ps_index;
41 } proxy_session_t;
42
43 typedef struct
44 {
45   proxy_session_t *sessions;            /**< session pool, shared */
46   clib_spinlock_t sessions_lock;        /**< lock for session pool */
47   u8 **rx_buf;                          /**< intermediate rx buffers */
48
49   u32 server_client_index;              /**< server API client handle */
50   u32 server_app_index;                 /**< server app index */
51   u32 active_open_client_index;         /**< active open API client handle */
52   u32 active_open_app_index;            /**< active open index after attach */
53   u32 ckpair_index;                     /**< certkey pair index for tls */
54
55   /*
56    * Configuration params
57    */
58   u32 fifo_size;                        /**< initial fifo size */
59   u32 max_fifo_size;                    /**< max fifo size */
60   u8 high_watermark;                    /**< high watermark (%) */
61   u8 low_watermark;                     /**< low watermark (%) */
62   u32 private_segment_count;            /**< Number of private fifo segs */
63   u32 private_segment_size;             /**< size of private fifo segs */
64   u8 prealloc_fifos;                    /**< Request fifo preallocation */
65   int rcv_buffer_size;
66   session_endpoint_cfg_t server_sep;
67   session_endpoint_cfg_t client_sep;
68
69   /*
70    * Flags
71    */
72   u8 is_init;
73 } proxy_main_t;
74
75 extern proxy_main_t proxy_main;
76
77 #endif /* __included_proxy_h__ */
78
79 /*
80  * fd.io coding-style-patch-verification: ON
81  *
82  * Local Variables:
83  * eval: (c-set-style "gnu")
84  * End:
85  */