tls: refactor picotls ctx_read process to improve CPS
[vpp.git] / src / plugins / tlspicotls / tls_picotls.h
1 #ifndef __included_tls_picotls_h__
2 #define __included_tls_picotls_h__
3
4 #include <picotls.h>
5 #include <picotls/openssl.h>
6 #include <vnet/plugin/plugin.h>
7 #include <vnet/tls/tls.h>
8 #include <vpp/app/version.h>
9
10 #define TLS_RX_LEN(x) ((x)->rx_content + (x)->rx_len)
11 #define TLS_RX_OFFSET(x) ((x)->rx_content + (x)->rx_offset)
12 #define TLS_RX_IS_LEFT(x) ((x)->rx_len != (x)->rx_offset)
13 #define TLS_RX_LEFT_LEN(x) ((x)->rx_len - (x)->rx_offset)
14
15
16 typedef struct tls_ctx_picotls_
17 {
18   tls_ctx_t ctx;
19   u32 ptls_ctx_idx;
20   ptls_t *tls;
21   u8 *rx_content;
22   int rx_offset;
23   int rx_len;
24 } picotls_ctx_t;
25
26 typedef struct tls_listen_ctx_picotls_
27 {
28   u32 ptls_lctx_index;
29   ptls_context_t *ptls_ctx;
30 } picotls_listen_ctx_t;
31
32 typedef struct picotls_main_
33 {
34   picotls_ctx_t ***ctx_pool;
35   picotls_listen_ctx_t *lctx_pool;
36 } picotls_main_t;
37
38 #endif /* __included_quic_certs_h__ */
39
40 /*
41  * fd.io coding-style-patch-verification: ON
42  *
43  * Local Variables:
44  * eval: (c-set-style "gnu")
45  * End:
46  */