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
111294 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)
68
channel_list;
69
70
/*
71
* Queue of unaccepted incoming channels. Each such channel is also on
72
* channel_list.
73
*/
74
OSSL_LIST(incoming_ch)
75
incoming_channel_list;
76
77
/* Special TSERVER channel. To be removed in the future. */
78
QUIC_CHANNEL *tserver_ch;
79
80
/* LCIDM used for incoming packet routing by DCID. */
81
QUIC_LCIDM *lcidm;
82
83
/* SRTM used for incoming packet routing by SRT. */
84
QUIC_SRTM *srtm;
85
86
/* Port-level permanent errors (causing failure state) are stored here. */
87
ERR_STATE *err_state;
88
89
/* DCID length used for incoming short header packets. */
90
unsigned char rx_short_dcid_len;
91
/* For clients, CID length used for outgoing Initial packets. */
92
unsigned char tx_init_dcid_len;
93
94
/* Port state (QUIC_PORT_STATE_*). */
95
unsigned int state : 1;
96
97
/* Is this port created to support multiple connections? */
98
unsigned int is_multi_conn : 1;
99
100
/* Is this port doing server address validation */
101
unsigned int validate_addr : 1;
102
103
/* Has this port sent any packet of any kind yet? */
104
unsigned int have_sent_any_pkt : 1;
105
106
/* Does this port allow incoming connections? */
107
unsigned int allow_incoming : 1;
108
109
/* Are we on the QUIC_ENGINE linked list of ports? */
110
unsigned int on_engine_list : 1;
111
112
/* Are we using addressed mode (BIO_sendmmsg with non-NULL peer)? */
113
unsigned int addressed_mode_w : 1;
114
unsigned int addressed_mode_r : 1;
115
116
/* Has the BIO been changed since we last updated reactor pollability? */
117
unsigned int bio_changed : 1;
118
119
/* AES-256 GCM context for token encryption */
120
EVP_CIPHER_CTX *token_ctx;
121
};
122
123
#endif
124
125
#endif
126
127