2 * Copyright (c) 2019 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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef __included_quic_h__
17 #define __included_quic_h__
19 #include <vnet/session/application_interface.h>
21 #include <vppinfra/lock.h>
22 #include <vppinfra/tw_timer_1t_3w_1024sl_ov.h>
23 #include <vppinfra/bihash_16_8.h>
29 * 2 - connection/stream events
36 #define QUIC_DEFAULT_CA_CERT_PATH "/etc/ssl/certs/ca-certificates.crt"
38 #define QUIC_TSTAMP_RESOLUTION 0.001 /* QUIC tick resolution (1ms) */
42 #define QUIC_DBG(_lvl, _fmt, _args...) \
43 if (_lvl <= QUIC_DEBUG) \
44 clib_warning (_fmt, ##_args)
46 #define QUIC_DBG(_lvl, _fmt, _args...)
49 #define QUIC_CONN_STATE_OPENED 0
50 #define QUIC_CONN_STATE_HANDSHAKE 1
51 #define QUIC_CONN_STATE_READY 2
54 typedef CLIB_PACKED (struct quic_ctx_id_
56 u32 parent_app_wrk_id;
60 session_handle_t udp_session_handle;
66 quicly_stream_t *stream;
67 u32 quic_connection_ctx_id;
74 STATIC_ASSERT (sizeof (quic_ctx_id_t) <= 42, "ctx id must be less than 42");
76 /* This structure is used to implement the concept of VPP connection for QUIC.
77 * We create one per connection and one per stream. */
78 typedef struct quic_ctx_
82 transport_connection_t connection;
83 quic_ctx_id_t c_quic_ctx_id;
92 typedef struct quic_stream_data_
96 u32 app_rx_data_len; /* bytes received, to be read by external app */
99 typedef struct quic_worker_ctx_
101 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
102 int64_t time_now; /**< worker time */
103 tw_timer_wheel_1t_3w_1024sl_ov_t timer_wheel; /**< worker timer wheel */
104 u32 *opening_ctx_pool;
107 typedef struct quic_main_
110 quic_ctx_t **ctx_pool;
111 quic_worker_ctx_t *wrk_ctx;
112 clib_bihash_16_8_t connection_hash; /* quicly connection id -> conn handle */
113 f64 tstamp_ticks_per_clock;
118 quicly_context_t quicly_ctx;
119 ptls_handshake_properties_t hs_properties;
120 quicly_cid_plaintext_t next_cid;
121 u8 use_test_cert_in_ca;
125 #endif /* __included_quic_h__ */
128 * fd.io coding-style-patch-verification: ON
131 * eval: (c-set-style "gnu")