2023-11-10 20:34:56 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
2023-11-09 18:27:13 +08:00
|
|
|
#ifndef OSSL_QUIC_PORT_LOCAL_H
|
|
|
|
# define OSSL_QUIC_PORT_LOCAL_H
|
|
|
|
|
|
|
|
# include "internal/quic_port.h"
|
|
|
|
# include "internal/quic_reactor.h"
|
2023-11-09 18:27:13 +08:00
|
|
|
# include "internal/list.h"
|
2023-11-09 18:27:13 +08:00
|
|
|
|
|
|
|
# ifndef OPENSSL_NO_QUIC
|
|
|
|
|
|
|
|
/*
|
|
|
|
* QUIC Port Structure
|
|
|
|
* ===================
|
|
|
|
*
|
|
|
|
* QUIC port internals. It is intended that only the QUIC_PORT and QUIC_CHANNEL
|
|
|
|
* implementation be allowed to access this structure directly.
|
|
|
|
*
|
|
|
|
* Other components should not include this header.
|
|
|
|
*/
|
2023-11-09 18:27:13 +08:00
|
|
|
DECLARE_LIST_OF(ch, QUIC_CHANNEL);
|
|
|
|
|
2023-11-09 18:27:14 +08:00
|
|
|
/* A port is always in one of the following states: */
|
|
|
|
enum {
|
|
|
|
/* Initial and steady state. */
|
|
|
|
QUIC_PORT_STATE_RUNNING,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Terminal state indicating port is no longer functioning. There are no
|
|
|
|
* transitions out of this state. May be triggered by e.g. a permanent
|
|
|
|
* network BIO error.
|
|
|
|
*/
|
|
|
|
QUIC_PORT_STATE_FAILED
|
|
|
|
};
|
|
|
|
|
2023-11-09 18:27:13 +08:00
|
|
|
struct quic_port_st {
|
2023-11-10 20:53:39 +08:00
|
|
|
/* The engine which this port is a child of. */
|
|
|
|
QUIC_ENGINE *engine;
|
|
|
|
|
|
|
|
/*
|
2023-12-19 23:10:43 +08:00
|
|
|
* QUIC_ENGINE keeps the ports which belong to it on a list for bookkeeping
|
|
|
|
* purposes.
|
2023-11-10 20:53:39 +08:00
|
|
|
*/
|
|
|
|
OSSL_LIST_MEMBER(port, QUIC_PORT);
|
|
|
|
|
2023-11-09 18:27:13 +08:00
|
|
|
/* Used to create handshake layer objects inside newly created channels. */
|
|
|
|
SSL_CTX *channel_ctx;
|
|
|
|
|
2023-11-09 18:27:13 +08:00
|
|
|
/* Network-side read and write BIOs. */
|
|
|
|
BIO *net_rbio, *net_wbio;
|
|
|
|
|
|
|
|
/* RX demuxer. We register incoming DCIDs with this. */
|
|
|
|
QUIC_DEMUX *demux;
|
2023-11-09 18:27:13 +08:00
|
|
|
|
|
|
|
/* List of all child channels. */
|
|
|
|
OSSL_LIST(ch) channel_list;
|
2023-11-09 18:27:13 +08:00
|
|
|
|
|
|
|
/* Special TSERVER channel. To be removed in the future. */
|
|
|
|
QUIC_CHANNEL *tserver_ch;
|
|
|
|
|
2023-11-09 18:27:13 +08:00
|
|
|
/* LCIDM used for incoming packet routing by DCID. */
|
|
|
|
QUIC_LCIDM *lcidm;
|
|
|
|
|
|
|
|
/* SRTM used for incoming packet routing by SRT. */
|
|
|
|
QUIC_SRTM *srtm;
|
|
|
|
|
2023-11-09 18:27:14 +08:00
|
|
|
/* Port-level permanent errors (causing failure state) are stored here. */
|
|
|
|
ERR_STATE *err_state;
|
|
|
|
|
2023-11-09 18:27:13 +08:00
|
|
|
/* DCID length used for incoming short header packets. */
|
|
|
|
unsigned char rx_short_dcid_len;
|
|
|
|
/* For clients, CID length used for outgoing Initial packets. */
|
|
|
|
unsigned char tx_init_dcid_len;
|
|
|
|
|
2023-11-09 18:27:14 +08:00
|
|
|
/* Port state (QUIC_PORT_STATE_*). */
|
|
|
|
unsigned int state : 1;
|
|
|
|
|
2023-11-09 18:27:13 +08:00
|
|
|
/* Is this port created to support multiple connections? */
|
|
|
|
unsigned int is_multi_conn : 1;
|
2023-11-09 18:27:13 +08:00
|
|
|
|
2023-11-09 23:30:15 +08:00
|
|
|
/* Has this port sent any packet of any kind yet? */
|
|
|
|
unsigned int have_sent_any_pkt : 1;
|
|
|
|
|
|
|
|
/* Does this port allow incoming connections? */
|
|
|
|
unsigned int is_server : 1;
|
2023-11-10 20:53:39 +08:00
|
|
|
|
|
|
|
/* Are we on the QUIC_ENGINE linked list of ports? */
|
|
|
|
unsigned int on_engine_list : 1;
|
2023-11-09 18:27:13 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
#endif
|