Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/crypto/openssl/ssl/quic/quic_port_local.h
48262 views
1
/*
2
* Copyright 2023-2025 The OpenSSL Project Authors. All Rights Reserved.
3
*
4
* Licensed under the Apache License 2.0 (the "License"). You may not use
5
* this file except in compliance with the License. You can obtain a copy
6
* in the file LICENSE in the source distribution or at
7
* https://www.openssl.org/source/license.html
8
*/
9
10
#ifndef OSSL_QUIC_PORT_LOCAL_H
11
# define OSSL_QUIC_PORT_LOCAL_H
12
13
# include "internal/quic_port.h"
14
# include "internal/quic_reactor.h"
15
# include "internal/list.h"
16
17
# ifndef OPENSSL_NO_QUIC
18
19
/*
20
* QUIC Port Structure
21
* ===================
22
*
23
* QUIC port internals. It is intended that only the QUIC_PORT and QUIC_CHANNEL
24
* implementation be allowed to access this structure directly.
25
*
26
* Other components should not include this header.
27
*/
28
DECLARE_LIST_OF(ch, QUIC_CHANNEL);
29
DECLARE_LIST_OF(incoming_ch, QUIC_CHANNEL);
30
31
/* A port is always in one of the following states: */
32
enum {
33
/* Initial and steady state. */
34
QUIC_PORT_STATE_RUNNING,
35
36
/*
37
* Terminal state indicating port is no longer functioning. There are no
38
* transitions out of this state. May be triggered by e.g. a permanent
39
* network BIO error.
40
*/
41
QUIC_PORT_STATE_FAILED
42
};
43
44
struct quic_port_st {
45
/* The engine which this port is a child of. */
46
QUIC_ENGINE *engine;
47
48
/*
49
* QUIC_ENGINE keeps the ports which belong to it on a list for bookkeeping
50
* purposes.
51
*/
52
OSSL_LIST_MEMBER(port, QUIC_PORT);
53
54
SSL * (*get_conn_user_ssl)(QUIC_CHANNEL *ch, void *arg);
55
void *user_ssl_arg;
56
57
/* Used to create handshake layer objects inside newly created channels. */
58
SSL_CTX *channel_ctx;
59
60
/* Network-side read and write BIOs. */
61
BIO *net_rbio, *net_wbio;
62
63
/* RX demuxer. We register incoming DCIDs with this. */
64
QUIC_DEMUX *demux;
65
66
/* List of all child channels. */
67
OSSL_LIST(ch) channel_list;
68
69
/*
70
* Queue of unaccepted incoming channels. Each such channel is also on
71
* channel_list.
72
*/
73
OSSL_LIST(incoming_ch) incoming_channel_list;
74
75
/* Special TSERVER channel. To be removed in the future. */
76
QUIC_CHANNEL *tserver_ch;
77
78
/* LCIDM used for incoming packet routing by DCID. */
79
QUIC_LCIDM *lcidm;
80
81
/* SRTM used for incoming packet routing by SRT. */
82
QUIC_SRTM *srtm;
83
84
/* Port-level permanent errors (causing failure state) are stored here. */
85
ERR_STATE *err_state;
86
87
/* DCID length used for incoming short header packets. */
88
unsigned char rx_short_dcid_len;
89
/* For clients, CID length used for outgoing Initial packets. */
90
unsigned char tx_init_dcid_len;
91
92
/* Port state (QUIC_PORT_STATE_*). */
93
unsigned int state : 1;
94
95
/* Is this port created to support multiple connections? */
96
unsigned int is_multi_conn : 1;
97
98
/* Is this port doing server address validation */
99
unsigned int validate_addr : 1;
100
101
/* Has this port sent any packet of any kind yet? */
102
unsigned int have_sent_any_pkt : 1;
103
104
/* Does this port allow incoming connections? */
105
unsigned int allow_incoming : 1;
106
107
/* Are we on the QUIC_ENGINE linked list of ports? */
108
unsigned int on_engine_list : 1;
109
110
/* Are we using addressed mode (BIO_sendmmsg with non-NULL peer)? */
111
unsigned int addressed_mode_w : 1;
112
unsigned int addressed_mode_r : 1;
113
114
/* Has the BIO been changed since we last updated reactor pollability? */
115
unsigned int bio_changed : 1;
116
117
/* AES-256 GCM context for token encryption */
118
EVP_CIPHER_CTX *token_ctx;
119
};
120
121
# endif
122
123
#endif
124
125