lsquic_engine_public.h revision 0adf085a
1229fce07SDmitri Tikhonov/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */ 250aadb33SDmitri Tikhonov/* 350aadb33SDmitri Tikhonov * lsquic_engine_public.h -- Engine's "public interface" 450aadb33SDmitri Tikhonov * 55392f7a3SLiteSpeed Tech * This structure is used to bundle things in engine that connections 65392f7a3SLiteSpeed Tech * need. This way, the space per mini connection is one pointer instead 75392f7a3SLiteSpeed Tech * of several. 850aadb33SDmitri Tikhonov */ 950aadb33SDmitri Tikhonov 1050aadb33SDmitri Tikhonov#ifndef LSQUIC_ENGINE_PUBLIC_H 1150aadb33SDmitri Tikhonov#define LSQUIC_ENGINE_PUBLIC_H 1 1250aadb33SDmitri Tikhonov 1350aadb33SDmitri Tikhonovstruct lsquic_conn; 1450aadb33SDmitri Tikhonovstruct lsquic_engine; 157f2bd84cSDmitri Tikhonovstruct stack_st_X509; 165392f7a3SLiteSpeed Techstruct lsquic_hash; 175392f7a3SLiteSpeed Techstruct lsquic_stream_if; 185392f7a3SLiteSpeed Techstruct ssl_ctx_st; 195392f7a3SLiteSpeed Tech 205392f7a3SLiteSpeed Techenum warning_type 215392f7a3SLiteSpeed Tech{ 225392f7a3SLiteSpeed Tech WT_ACKPARSE_MINI, 235392f7a3SLiteSpeed Tech WT_ACKPARSE_FULL, 245392f7a3SLiteSpeed Tech N_WARNING_TYPES, 255392f7a3SLiteSpeed Tech}; 265392f7a3SLiteSpeed Tech 275392f7a3SLiteSpeed Tech#define WARNING_INTERVAL (24ULL * 3600ULL * 1000000ULL) 2850aadb33SDmitri Tikhonov 2950aadb33SDmitri Tikhonovstruct lsquic_engine_public { 3050aadb33SDmitri Tikhonov struct lsquic_mm enp_mm; 3150aadb33SDmitri Tikhonov struct lsquic_engine_settings enp_settings; 325392f7a3SLiteSpeed Tech struct token_generator *enp_tokgen; 335392f7a3SLiteSpeed Tech lsquic_lookup_cert_f enp_lookup_cert; 345392f7a3SLiteSpeed Tech void *enp_cert_lu_ctx; 355392f7a3SLiteSpeed Tech struct ssl_ctx_st * (*enp_get_ssl_ctx)(void *peer_ctx); 365392f7a3SLiteSpeed Tech const struct lsquic_shared_hash_if 375392f7a3SLiteSpeed Tech *enp_shi; 385392f7a3SLiteSpeed Tech void *enp_shi_ctx; 395392f7a3SLiteSpeed Tech lsquic_time_t enp_last_warning[N_WARNING_TYPES]; 405392f7a3SLiteSpeed Tech const struct lsquic_stream_if *enp_stream_if; 415392f7a3SLiteSpeed Tech void *enp_stream_if_ctx; 423b55e6aeSDmitri Tikhonov const struct lsquic_hset_if *enp_hsi_if; 433b55e6aeSDmitri Tikhonov void *enp_hsi_ctx; 447f2bd84cSDmitri Tikhonov int (*enp_verify_cert)(void *verify_ctx, 457f2bd84cSDmitri Tikhonov struct stack_st_X509 *chain); 467f2bd84cSDmitri Tikhonov void *enp_verify_ctx; 4750aadb33SDmitri Tikhonov const struct lsquic_packout_mem_if 4850aadb33SDmitri Tikhonov *enp_pmi; 4950aadb33SDmitri Tikhonov void *enp_pmi_ctx; 505392f7a3SLiteSpeed Tech const struct lsquic_keylog_if *enp_kli; 515392f7a3SLiteSpeed Tech void *enp_kli_ctx; 5250aadb33SDmitri Tikhonov struct lsquic_engine *enp_engine; 535392f7a3SLiteSpeed Tech struct lsquic_hash *enp_srst_hash; 5450aadb33SDmitri Tikhonov enum { 5550aadb33SDmitri Tikhonov ENPUB_PROC = (1 << 0), /* Being processed by one of the user-facing 5650aadb33SDmitri Tikhonov * functions. 5750aadb33SDmitri Tikhonov */ 58c44946ecSDmitri Tikhonov ENPUB_CAN_SEND = (1 << 1), 5950aadb33SDmitri Tikhonov } enp_flags; 605392f7a3SLiteSpeed Tech unsigned char enp_ver_tags_buf[ sizeof(lsquic_ver_tag_t) * N_LSQVER ]; 615392f7a3SLiteSpeed Tech unsigned enp_ver_tags_len; 6250aadb33SDmitri Tikhonov}; 6350aadb33SDmitri Tikhonov 64e8bd737dSDmitri Tikhonov/* Put connection onto the Tickable Queue if it is not already on it. If 6550aadb33SDmitri Tikhonov * connection is being destroyed, this is a no-op. 6650aadb33SDmitri Tikhonov */ 6750aadb33SDmitri Tikhonovvoid 68e8bd737dSDmitri Tikhonovlsquic_engine_add_conn_to_tickable (struct lsquic_engine_public *, 69e8bd737dSDmitri Tikhonov lsquic_conn_t *); 7050aadb33SDmitri Tikhonov 7150aadb33SDmitri Tikhonov/* Put connection onto Advisory Tick Time Queue if it is not already on it. 7250aadb33SDmitri Tikhonov */ 7350aadb33SDmitri Tikhonovvoid 7450aadb33SDmitri Tikhonovlsquic_engine_add_conn_to_attq (struct lsquic_engine_public *enpub, 750adf085aSDmitri Tikhonov lsquic_conn_t *, lsquic_time_t, unsigned why); 7650aadb33SDmitri Tikhonov 775392f7a3SLiteSpeed Techvoid 785392f7a3SLiteSpeed Techlsquic_engine_retire_cid (struct lsquic_engine_public *, 795392f7a3SLiteSpeed Tech struct lsquic_conn *, unsigned cce_idx, lsquic_time_t now); 805392f7a3SLiteSpeed Tech 815392f7a3SLiteSpeed Techint 825392f7a3SLiteSpeed Techlsquic_engine_add_cid (struct lsquic_engine_public *, 835392f7a3SLiteSpeed Tech struct lsquic_conn *, unsigned cce_idx); 845392f7a3SLiteSpeed Tech 855392f7a3SLiteSpeed Techstruct lsquic_conn * 865392f7a3SLiteSpeed Techlsquic_engine_find_conn (const struct lsquic_engine_public *pub, 875392f7a3SLiteSpeed Tech const lsquic_cid_t *cid); 885392f7a3SLiteSpeed Tech 8950aadb33SDmitri Tikhonov#endif 90