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>
27 #define QUIC_DEBUG_LEVEL_CLIENT 0
28 #define QUIC_DEBUG_LEVEL_SERVER 0
30 #define QUIC_DEFAULT_CA_CERT_PATH "/etc/ssl/certs/ca-certificates.crt"
32 #define QUIC_TIMER_HANDLE_INVALID ((u32) ~0)
34 #define QUIC_TSTAMP_RESOLUTION 0.001 /* QUIC tick resolution (1ms) */
38 #define QUIC_DBG(_lvl, _fmt, _args...) \
39 if (_lvl <= QUIC_DEBUG) \
40 clib_warning (_fmt, ##_args)
42 #define QUIC_DBG(_lvl, _fmt, _args...)
45 #define QUIC_CONN_STATE_HANDSHAKE 0
46 #define QUIC_CONN_STATE_READY 1
50 typedef CLIB_PACKED (struct quic_ctx_id_
52 session_handle_t app_session;
53 session_handle_t quic_session;
54 u32 parent_app_wrk_idx;
64 STATIC_ASSERT (sizeof (quic_ctx_id_t) <= 42, "ctx id must be less than 42");
66 typedef struct quic_ctx_
70 transport_connection_t connection;
71 quic_ctx_id_t c_quic_ctx_id;
74 quicly_stream_t *stream;
80 typedef struct quic_worker_ctx_
82 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
83 u32 time_now; /**< worker time */
84 tw_timer_wheel_1t_3w_1024sl_ov_t timer_wheel; /**< worker timer wheel */
85 u32 *tx_buffers; /**< tx buffer free list */
88 typedef struct quic_main_
91 quic_ctx_t *half_open_ctx_pool;
92 quic_ctx_t **ctx_pool;
93 clib_rwlock_t half_open_rwlock;
94 quic_worker_ctx_t *wrk_ctx;
95 f64 tstamp_ticks_per_clock;
101 quicly_context_t quicly_ctx;
102 ptls_handshake_properties_t hs_properties;
103 quicly_cid_plaintext_t next_cid;
104 u8 use_test_cert_in_ca;
108 quic_main_t *vnet_quic_get_main (void);
110 #endif /* __included_quic_h__ */
113 * fd.io coding-style-patch-verification: ON
116 * eval: (c-set-style "gnu")