lsquic_engine_public.h revision 8ae5ecb4
1/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */ 2/* 3 * lsquic_engine_public.h -- Engine's "public interface" 4 * 5 * This structure is used to bundle things in engine that connections 6 * need. This way, the space per mini connection is one pointer instead 7 * of several. 8 */ 9 10#ifndef LSQUIC_ENGINE_PUBLIC_H 11#define LSQUIC_ENGINE_PUBLIC_H 1 12 13struct lsquic_conn; 14struct lsquic_engine; 15struct stack_st_X509; 16struct lsquic_hash; 17struct lsquic_stream_if; 18struct ssl_ctx_st; 19struct crand; 20struct evp_aead_ctx_st; 21 22enum warning_type 23{ 24 WT_ACKPARSE_MINI, 25 WT_ACKPARSE_FULL, 26 WT_NO_POISON, 27 N_WARNING_TYPES, 28}; 29 30#define WARNING_INTERVAL (24ULL * 3600ULL * 1000000ULL) 31 32struct lsquic_engine_public { 33 struct lsquic_mm enp_mm; 34 struct lsquic_engine_settings enp_settings; 35 struct token_generator *enp_tokgen; 36 lsquic_lookup_cert_f enp_lookup_cert; 37 void *enp_cert_lu_ctx; 38 struct ssl_ctx_st * (*enp_get_ssl_ctx)(void *peer_ctx); 39 const struct lsquic_shared_hash_if 40 *enp_shi; 41 void *enp_shi_ctx; 42 lsquic_time_t enp_last_warning[N_WARNING_TYPES]; 43 const struct lsquic_stream_if *enp_stream_if; 44 void *enp_stream_if_ctx; 45 const struct lsquic_hset_if *enp_hsi_if; 46 void *enp_hsi_ctx; 47 int (*enp_verify_cert)(void *verify_ctx, 48 struct stack_st_X509 *chain); 49 void *enp_verify_ctx; 50 const struct lsquic_packout_mem_if 51 *enp_pmi; 52 void *enp_pmi_ctx; 53 const struct lsquic_keylog_if *enp_kli; 54 void *enp_kli_ctx; 55 struct lsquic_engine *enp_engine; 56 struct lsquic_hash *enp_srst_hash; 57 enum { 58 ENPUB_PROC = (1 << 0), /* Being processed by one of the user-facing 59 * functions. 60 */ 61 ENPUB_CAN_SEND = (1 << 1), 62 ENPUB_HTTP = (1 << 2), /* Engine in HTTP mode */ 63 } enp_flags; 64 unsigned char enp_ver_tags_buf[ sizeof(lsquic_ver_tag_t) * N_LSQVER ]; 65 unsigned enp_ver_tags_len; 66 struct crand *enp_crand; 67 struct evp_aead_ctx_st *enp_retry_aead_ctx; 68 unsigned char *enp_alpn; /* May be set if not HTTP */ 69 /* es_noprogress_timeout converted to microseconds for speed */ 70 lsquic_time_t enp_noprog_timeout; 71}; 72 73/* Put connection onto the Tickable Queue if it is not already on it. If 74 * connection is being destroyed, this is a no-op. 75 */ 76void 77lsquic_engine_add_conn_to_tickable (struct lsquic_engine_public *, 78 lsquic_conn_t *); 79 80/* Put connection onto Advisory Tick Time Queue if it is not already on it. 81 */ 82void 83lsquic_engine_add_conn_to_attq (struct lsquic_engine_public *enpub, 84 lsquic_conn_t *, lsquic_time_t, unsigned why); 85 86void 87lsquic_engine_retire_cid (struct lsquic_engine_public *, 88 struct lsquic_conn *, unsigned cce_idx, lsquic_time_t now); 89 90int 91lsquic_engine_add_cid (struct lsquic_engine_public *, 92 struct lsquic_conn *, unsigned cce_idx); 93 94struct lsquic_conn * 95lsquic_engine_find_conn (const struct lsquic_engine_public *pub, 96 const lsquic_cid_t *cid); 97 98#endif 99