1a253f0e45c92835f51614aaed24e5690ad36f52
[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 #define TLS_WRITE_OFFSET(x) ((x)->write_buffer.base + (x)->write_buffer_offset)
16 #define TLS_WRITE_IS_LEFT(x) ((x)->write_buffer.off == (x)->write_buffer_offset)
17
18
19 typedef struct tls_ctx_picotls_
20 {
21   tls_ctx_t ctx;
22   u32 ptls_ctx_idx;
23   ptls_t *tls;
24   u8 *rx_content;
25   int rx_offset;
26   int rx_len;
27   ptls_buffer_t write_buffer;
28   uint8_t *write_content;
29   int write_buffer_offset;
30   int is_write_buffer_finished;
31 } picotls_ctx_t;
32
33 typedef struct tls_listen_ctx_picotls_
34 {
35   u32 ptls_lctx_index;
36   ptls_context_t *ptls_ctx;
37 } picotls_listen_ctx_t;
38
39 typedef struct picotls_main_
40 {
41   picotls_ctx_t ***ctx_pool;
42   picotls_listen_ctx_t *lctx_pool;
43 } picotls_main_t;
44
45 #endif /* __included_quic_certs_h__ */
46
47 /*
48  * fd.io coding-style-patch-verification: ON
49  *
50  * Local Variables:
51  * eval: (c-set-style "gnu")
52  * End:
53  */