xref: /freebsd/crypto/openssl/ssl/quic/quic_obj_local.h (revision e7be843b4a162e68651d3911f0357ed464915629)
1*e7be843bSPierre Pronchery /*
2*e7be843bSPierre Pronchery  * Copyright 2024-2025 The OpenSSL Project Authors. All Rights Reserved.
3*e7be843bSPierre Pronchery  *
4*e7be843bSPierre Pronchery  * Licensed under the Apache License 2.0 (the "License").  You may not use
5*e7be843bSPierre Pronchery  * this file except in compliance with the License.  You can obtain a copy
6*e7be843bSPierre Pronchery  * in the file LICENSE in the source distribution or at
7*e7be843bSPierre Pronchery  * https://www.openssl.org/source/license.html
8*e7be843bSPierre Pronchery  */
9*e7be843bSPierre Pronchery 
10*e7be843bSPierre Pronchery #ifndef OSSL_QUIC_OBJ_LOCAL_H
11*e7be843bSPierre Pronchery # define OSSL_QUIC_OBJ_LOCAL_H
12*e7be843bSPierre Pronchery 
13*e7be843bSPierre Pronchery # include <openssl/ssl.h>
14*e7be843bSPierre Pronchery # include "internal/quic_predef.h"
15*e7be843bSPierre Pronchery # include "internal/quic_engine.h"
16*e7be843bSPierre Pronchery # include "../ssl_local.h"
17*e7be843bSPierre Pronchery 
18*e7be843bSPierre Pronchery # ifndef OPENSSL_NO_QUIC
19*e7be843bSPierre Pronchery 
20*e7be843bSPierre Pronchery /*
21*e7be843bSPierre Pronchery  * QUIC Object Structure.
22*e7be843bSPierre Pronchery  *
23*e7be843bSPierre Pronchery  * In the libssl APL, we have QLSOs, QCSOs and QSSOs, and in the future might
24*e7be843bSPierre Pronchery  * choose to introduce QDSOs. There are also roles such as Port Leader and Event
25*e7be843bSPierre Pronchery  * Leader which can be assumed by these different types under different
26*e7be843bSPierre Pronchery  * circumstances — in other words, whether an APL object is a Port or Event
27*e7be843bSPierre Pronchery  * Leader is not a static function of its type and these roles can 'float'
28*e7be843bSPierre Pronchery  * dynamically depending on the circumstances under which an APL object was
29*e7be843bSPierre Pronchery  * created.
30*e7be843bSPierre Pronchery  *
31*e7be843bSPierre Pronchery  * The QUIC_OBJ is a base type for QUIC APL objects which provides functionality
32*e7be843bSPierre Pronchery  * common to all QUIC objects and which supports having different APL objects
33*e7be843bSPierre Pronchery  * dynamically assume leader roles. It can therefore be seen as an extension of
34*e7be843bSPierre Pronchery  * the SSL base class and extends the SSL object for QUIC APL objects. This
35*e7be843bSPierre Pronchery  * avoids duplication of functionality for different types of QUIC object and
36*e7be843bSPierre Pronchery  * allows access to common responsibilities of different types of APL object
37*e7be843bSPierre Pronchery  * without regard to the kind of APL object we are dealing with.
38*e7be843bSPierre Pronchery  *
39*e7be843bSPierre Pronchery  * The "inheritance" hierarchy is as follows:
40*e7be843bSPierre Pronchery  *
41*e7be843bSPierre Pronchery  *   SSL
42*e7be843bSPierre Pronchery  *      SSL_CONNECTION
43*e7be843bSPierre Pronchery  *      QUIC_OBJ
44*e7be843bSPierre Pronchery  *          QUIC_DOMAIN         (QDSO) -> QUIC_ENGINE  *E
45*e7be843bSPierre Pronchery  *          QUIC_LISTENER       (QLSO) -> QUIC_PORT     eP
46*e7be843bSPierre Pronchery  *          QUIC_CONNECTION     (QCSO) -> QUIC_CHANNEL  epCs
47*e7be843bSPierre Pronchery  *          QUIC_XSO            (QSSO) -> QUIC_STREAM      S
48*e7be843bSPierre Pronchery  *
49*e7be843bSPierre Pronchery  * Legend:
50*e7be843bSPierre Pronchery  *
51*e7be843bSPierre Pronchery  *   *: Not currently modelled in the APL, though QUIC_ENGINE exists internally.
52*e7be843bSPierre Pronchery  *
53*e7be843bSPierre Pronchery  *   E: Always an event leader if it exists.
54*e7be843bSPierre Pronchery  *   e: Potentially an event leader (namely if it is the root APL object in a
55*e7be843bSPierre Pronchery  *      hierarchy).
56*e7be843bSPierre Pronchery  *
57*e7be843bSPierre Pronchery  *   P: Always a port leader if it exists.
58*e7be843bSPierre Pronchery  *   p: Potentially a port leader (namely if there is no port leader above it).
59*e7be843bSPierre Pronchery  *
60*e7be843bSPierre Pronchery  *   C: Always a connection leader.
61*e7be843bSPierre Pronchery  *
62*e7be843bSPierre Pronchery  *   s: Potentially usable as a stream (if it has a default stream attached).
63*e7be843bSPierre Pronchery  *   S: Always has the stream role if it exists.
64*e7be843bSPierre Pronchery  *
65*e7be843bSPierre Pronchery  * This structure must come at the start of a QUIC object structure definition.
66*e7be843bSPierre Pronchery  *
67*e7be843bSPierre Pronchery  * ssl->type still determines the actual object type. An SSL object
68*e7be843bSPierre Pronchery  * pointer s can be safely cast to (QUIC_OBJ *) iff IS_QUIC(s) is true.
69*e7be843bSPierre Pronchery  */
70*e7be843bSPierre Pronchery struct quic_obj_st {
71*e7be843bSPierre Pronchery     /* SSL object common header. */
72*e7be843bSPierre Pronchery     struct ssl_st           ssl;
73*e7be843bSPierre Pronchery 
74*e7be843bSPierre Pronchery     /*
75*e7be843bSPierre Pronchery      * Pointer to a parent APL object in a QUIC APL object hierarchy, or NULL if
76*e7be843bSPierre Pronchery      * this is the root object.
77*e7be843bSPierre Pronchery      */
78*e7be843bSPierre Pronchery     QUIC_OBJ                *parent_obj;
79*e7be843bSPierre Pronchery 
80*e7be843bSPierre Pronchery     /* invariant: != NULL */
81*e7be843bSPierre Pronchery     QUIC_OBJ                *cached_event_leader;
82*e7be843bSPierre Pronchery     /* invariant: != NULL iff this is a port leader or subsidiary object */
83*e7be843bSPierre Pronchery     QUIC_OBJ                *cached_port_leader;
84*e7be843bSPierre Pronchery 
85*e7be843bSPierre Pronchery     /*
86*e7be843bSPierre Pronchery      * Points to the QUIC_ENGINE instance. Always equals
87*e7be843bSPierre Pronchery      * cached_event_leader->engine. The containing_obj APL object owns this
88*e7be843bSPierre Pronchery      * instance iff is_event_leader is set, otherwise it is an additional
89*e7be843bSPierre Pronchery      * reference cached for convenience. Unlike port this is never NULL because
90*e7be843bSPierre Pronchery      * a QUIC domain is always rooted in an event leader.
91*e7be843bSPierre Pronchery      */
92*e7be843bSPierre Pronchery     QUIC_ENGINE             *engine;
93*e7be843bSPierre Pronchery 
94*e7be843bSPierre Pronchery     /*
95*e7be843bSPierre Pronchery      * Points to the QUIC_PORT instance applicable to the containing_obj APL
96*e7be843bSPierre Pronchery      * object, or NULL if we are not at or below a port leader. Always equals
97*e7be843bSPierre Pronchery      * cached_port_leader->port. The containing_obj APL object owns this
98*e7be843bSPierre Pronchery      * instance iff is_port_leader is set, otherwise it is an additional
99*e7be843bSPierre Pronchery      * reference cached for convenience.
100*e7be843bSPierre Pronchery      */
101*e7be843bSPierre Pronchery     QUIC_PORT               *port;
102*e7be843bSPierre Pronchery 
103*e7be843bSPierre Pronchery     /* SSL_DOMAIN_FLAG values taken from SSL_CTX at construction time. */
104*e7be843bSPierre Pronchery     uint64_t                domain_flags;
105*e7be843bSPierre Pronchery 
106*e7be843bSPierre Pronchery     unsigned int            init_done       : 1;
107*e7be843bSPierre Pronchery     unsigned int            is_event_leader : 1;
108*e7be843bSPierre Pronchery     unsigned int            is_port_leader  : 1;
109*e7be843bSPierre Pronchery 
110*e7be843bSPierre Pronchery     /*
111*e7be843bSPierre Pronchery      * Blocking mode configuration is handled generically through QUIC_OBJ as it
112*e7be843bSPierre Pronchery      * by default inherits from the parent SSL object.
113*e7be843bSPierre Pronchery      */
114*e7be843bSPierre Pronchery     unsigned int            req_blocking_mode       : 2; /* QUIC_BLOCKING_MODE */
115*e7be843bSPierre Pronchery 
116*e7be843bSPierre Pronchery     /* Event handling mode. One of SSL_QUIC_VALUE_EVENT_HANDLING. */
117*e7be843bSPierre Pronchery     unsigned int            event_handling_mode     : 2;
118*e7be843bSPierre Pronchery };
119*e7be843bSPierre Pronchery 
120*e7be843bSPierre Pronchery enum {
121*e7be843bSPierre Pronchery     QUIC_BLOCKING_MODE_INHERIT,
122*e7be843bSPierre Pronchery     QUIC_BLOCKING_MODE_NONBLOCKING,
123*e7be843bSPierre Pronchery     QUIC_BLOCKING_MODE_BLOCKING
124*e7be843bSPierre Pronchery };
125*e7be843bSPierre Pronchery 
126*e7be843bSPierre Pronchery /*
127*e7be843bSPierre Pronchery  * Core Functions and Inlines
128*e7be843bSPierre Pronchery  * ==========================
129*e7be843bSPierre Pronchery  */
130*e7be843bSPierre Pronchery 
131*e7be843bSPierre Pronchery /*
132*e7be843bSPierre Pronchery  * Initialises a QUIC_OBJ structure with zero or more roles active. Returns 1
133*e7be843bSPierre Pronchery  * on success or 0 on failure.
134*e7be843bSPierre Pronchery  *
135*e7be843bSPierre Pronchery  * ctx: A SSL_CTX used to initialise the SSL base object structure.
136*e7be843bSPierre Pronchery  *
137*e7be843bSPierre Pronchery  * type: A SSL_TYPE_* value designating the SSL object type.
138*e7be843bSPierre Pronchery  *
139*e7be843bSPierre Pronchery  * parent_obj: NULL if this is the root APL object in a new hierarchy, or a
140*e7be843bSPierre Pronchery  * pointer to the parent APL object otherwise.
141*e7be843bSPierre Pronchery  *
142*e7be843bSPierre Pronchery  * engine: If non-NULL, this object becomes the Event Leader. parent_obj must be
143*e7be843bSPierre Pronchery  * NULL iff this is non-NULL as currently the Event Leader is always the root in
144*e7be843bSPierre Pronchery  * an APL object hierarchy. If NULL, the contextually applicable engine is
145*e7be843bSPierre Pronchery  * determined by using parent_obj and ancestors to find the Event Leader.
146*e7be843bSPierre Pronchery  *
147*e7be843bSPierre Pronchery  * port: If non-NULL, this object becomes a Port Leader. If NULL, the
148*e7be843bSPierre Pronchery  * contextually applicable port (if any) is determined by using parent_obj and
149*e7be843bSPierre Pronchery  * ancestors to find the Port Leader.
150*e7be843bSPierre Pronchery  */
151*e7be843bSPierre Pronchery int ossl_quic_obj_init(QUIC_OBJ *obj,
152*e7be843bSPierre Pronchery                        SSL_CTX *ctx,
153*e7be843bSPierre Pronchery                        int type,
154*e7be843bSPierre Pronchery                        SSL *parent_obj,
155*e7be843bSPierre Pronchery                        QUIC_ENGINE *engine,
156*e7be843bSPierre Pronchery                        QUIC_PORT *port);
157*e7be843bSPierre Pronchery 
158*e7be843bSPierre Pronchery /*
159*e7be843bSPierre Pronchery  * Returns a pointer to the handshake layer object which should be accessible on
160*e7be843bSPierre Pronchery  * obj for purposes of handshake API autoforwarding, if any.
161*e7be843bSPierre Pronchery  *
162*e7be843bSPierre Pronchery  * This returns NULL if a handshake layer SSL object is available but should not
163*e7be843bSPierre Pronchery  * be used for autoforwarding purposes, for example on a QSSO.
164*e7be843bSPierre Pronchery  */
165*e7be843bSPierre Pronchery SSL_CONNECTION *ossl_quic_obj_get0_handshake_layer(QUIC_OBJ *obj);
166*e7be843bSPierre Pronchery 
167*e7be843bSPierre Pronchery /*
168*e7be843bSPierre Pronchery  * Returns a pointer to the SSL base object structure. Returns NULL if obj is
169*e7be843bSPierre Pronchery  * NULL. If obj is non-NULL, it must be initialised.
170*e7be843bSPierre Pronchery  */
171*e7be843bSPierre Pronchery static ossl_inline ossl_unused SSL *
ossl_quic_obj_get0_ssl(QUIC_OBJ * obj)172*e7be843bSPierre Pronchery ossl_quic_obj_get0_ssl(QUIC_OBJ *obj)
173*e7be843bSPierre Pronchery {
174*e7be843bSPierre Pronchery     /*
175*e7be843bSPierre Pronchery      * ->ssl is guaranteed to have an offset of 0 but the NULL check here makes
176*e7be843bSPierre Pronchery      *  ubsan happy.
177*e7be843bSPierre Pronchery      */
178*e7be843bSPierre Pronchery     if (!ossl_assert(obj != NULL))
179*e7be843bSPierre Pronchery         return NULL;
180*e7be843bSPierre Pronchery 
181*e7be843bSPierre Pronchery     return &obj->ssl;
182*e7be843bSPierre Pronchery }
183*e7be843bSPierre Pronchery 
184*e7be843bSPierre Pronchery /*
185*e7be843bSPierre Pronchery  * Determines the applicable engine and return a pointer to it. Never returns
186*e7be843bSPierre Pronchery  * NULL.
187*e7be843bSPierre Pronchery  */
188*e7be843bSPierre Pronchery static ossl_inline ossl_unused QUIC_ENGINE *
ossl_quic_obj_get0_engine(const QUIC_OBJ * obj)189*e7be843bSPierre Pronchery ossl_quic_obj_get0_engine(const QUIC_OBJ *obj)
190*e7be843bSPierre Pronchery {
191*e7be843bSPierre Pronchery     assert(obj->init_done);
192*e7be843bSPierre Pronchery     assert(obj->engine != NULL);
193*e7be843bSPierre Pronchery     return obj->engine;
194*e7be843bSPierre Pronchery }
195*e7be843bSPierre Pronchery 
196*e7be843bSPierre Pronchery /* Determines the applicable port (if any) and returns a pointer to it. */
197*e7be843bSPierre Pronchery static ossl_inline ossl_unused QUIC_PORT *
ossl_quic_obj_get0_port(const QUIC_OBJ * obj)198*e7be843bSPierre Pronchery ossl_quic_obj_get0_port(const QUIC_OBJ *obj)
199*e7be843bSPierre Pronchery {
200*e7be843bSPierre Pronchery     assert(obj->init_done);
201*e7be843bSPierre Pronchery     return obj->port;
202*e7be843bSPierre Pronchery }
203*e7be843bSPierre Pronchery 
204*e7be843bSPierre Pronchery /* Returns 1 iff this leader structure represents an event leader. */
205*e7be843bSPierre Pronchery static ossl_inline ossl_unused int
ossl_quic_obj_is_event_leader(const QUIC_OBJ * obj)206*e7be843bSPierre Pronchery ossl_quic_obj_is_event_leader(const QUIC_OBJ *obj)
207*e7be843bSPierre Pronchery {
208*e7be843bSPierre Pronchery     return obj->is_event_leader;
209*e7be843bSPierre Pronchery }
210*e7be843bSPierre Pronchery 
211*e7be843bSPierre Pronchery /*
212*e7be843bSPierre Pronchery  * Similar to ossl_quic_obj_get0_engine, but only returns a non-NULL value if
213*e7be843bSPierre Pronchery  * the obj object itself is an event leader, rather than one of its ancestors.
214*e7be843bSPierre Pronchery  */
215*e7be843bSPierre Pronchery static ossl_inline ossl_unused QUIC_ENGINE *
ossl_quic_obj_get0_engine_local(const QUIC_OBJ * obj)216*e7be843bSPierre Pronchery ossl_quic_obj_get0_engine_local(const QUIC_OBJ *obj)
217*e7be843bSPierre Pronchery {
218*e7be843bSPierre Pronchery     return ossl_quic_obj_is_event_leader(obj)
219*e7be843bSPierre Pronchery         ? ossl_quic_obj_get0_engine(obj) : NULL;
220*e7be843bSPierre Pronchery }
221*e7be843bSPierre Pronchery 
222*e7be843bSPierre Pronchery /* Returns 1 iff this leader structure represents a port leader. */
223*e7be843bSPierre Pronchery static ossl_inline ossl_unused int
ossl_quic_obj_is_port_leader(const QUIC_OBJ * obj)224*e7be843bSPierre Pronchery ossl_quic_obj_is_port_leader(const QUIC_OBJ *obj)
225*e7be843bSPierre Pronchery {
226*e7be843bSPierre Pronchery     return obj->is_port_leader;
227*e7be843bSPierre Pronchery }
228*e7be843bSPierre Pronchery 
229*e7be843bSPierre Pronchery /*
230*e7be843bSPierre Pronchery  * Similar to ossl_quic_obj_get0_port, but only returns a non-NULL value if
231*e7be843bSPierre Pronchery  * the obj object itself is a port leader, rather than one of its ancestors.
232*e7be843bSPierre Pronchery  */
233*e7be843bSPierre Pronchery static ossl_inline ossl_unused QUIC_PORT *
ossl_quic_obj_get0_port_local(const QUIC_OBJ * obj)234*e7be843bSPierre Pronchery ossl_quic_obj_get0_port_local(const QUIC_OBJ *obj)
235*e7be843bSPierre Pronchery {
236*e7be843bSPierre Pronchery     return ossl_quic_obj_is_port_leader(obj)
237*e7be843bSPierre Pronchery         ? ossl_quic_obj_get0_port(obj) : NULL;
238*e7be843bSPierre Pronchery }
239*e7be843bSPierre Pronchery 
240*e7be843bSPierre Pronchery /*
241*e7be843bSPierre Pronchery  * Return 1 if we are currently capable of supporting blocking mode (regardless
242*e7be843bSPierre Pronchery  * of whether it is actually turned on).
243*e7be843bSPierre Pronchery  */
244*e7be843bSPierre Pronchery int ossl_quic_obj_can_support_blocking(const QUIC_OBJ *obj);
245*e7be843bSPierre Pronchery 
246*e7be843bSPierre Pronchery /*
247*e7be843bSPierre Pronchery  * Returns 1 if we *desire* to do blocking I/O, regardless of whether it will
248*e7be843bSPierre Pronchery  * actually be used (e.g. because it cannot currently be supported).
249*e7be843bSPierre Pronchery  */
250*e7be843bSPierre Pronchery int ossl_quic_obj_desires_blocking(const QUIC_OBJ *obj);
251*e7be843bSPierre Pronchery 
252*e7be843bSPierre Pronchery /*
253*e7be843bSPierre Pronchery  * Return 1 if an API call directly to the given object should use blocking mode
254*e7be843bSPierre Pronchery  * and 0 otherwise.
255*e7be843bSPierre Pronchery  */
256*e7be843bSPierre Pronchery int ossl_quic_obj_blocking(const QUIC_OBJ *obj);
257*e7be843bSPierre Pronchery 
258*e7be843bSPierre Pronchery /*
259*e7be843bSPierre Pronchery  * Set the (requested) blocking mode, which might or might not be honoured
260*e7be843bSPierre Pronchery  * depending on whether the BIO configuration can support it. Argument is a
261*e7be843bSPierre Pronchery  * QUIC_BLOCKING_MODE value. If the top-level object in a QSO hierarchy is set
262*e7be843bSPierre Pronchery  * to QUIC_BLOCKING_MODE_INHERIT, defaults to blocking mode.
263*e7be843bSPierre Pronchery  */
264*e7be843bSPierre Pronchery void ossl_quic_obj_set_blocking_mode(QUIC_OBJ *obj, unsigned int mode);
265*e7be843bSPierre Pronchery 
266*e7be843bSPierre Pronchery /*
267*e7be843bSPierre Pronchery  * Convenience Inlines
268*e7be843bSPierre Pronchery  * ===================
269*e7be843bSPierre Pronchery  *
270*e7be843bSPierre Pronchery  * These inlines are expressed in terms of the core functions and inlines above.
271*e7be843bSPierre Pronchery  */
272*e7be843bSPierre Pronchery 
273*e7be843bSPierre Pronchery /* Get a pointer to the QUIC domain mutex. Always returns non-NULL. */
274*e7be843bSPierre Pronchery static ossl_inline ossl_unused CRYPTO_MUTEX *
ossl_quic_obj_get0_mutex(const QUIC_OBJ * obj)275*e7be843bSPierre Pronchery ossl_quic_obj_get0_mutex(const QUIC_OBJ *obj)
276*e7be843bSPierre Pronchery {
277*e7be843bSPierre Pronchery     return ossl_quic_engine_get0_mutex(ossl_quic_obj_get0_engine(obj));
278*e7be843bSPierre Pronchery }
279*e7be843bSPierre Pronchery 
280*e7be843bSPierre Pronchery /*
281*e7be843bSPierre Pronchery  * Get a reference to the reactor applicable to a leader. Always returns
282*e7be843bSPierre Pronchery  * non-NULL.
283*e7be843bSPierre Pronchery  */
284*e7be843bSPierre Pronchery static ossl_inline ossl_unused QUIC_REACTOR *
ossl_quic_obj_get0_reactor(const QUIC_OBJ * obj)285*e7be843bSPierre Pronchery ossl_quic_obj_get0_reactor(const QUIC_OBJ *obj)
286*e7be843bSPierre Pronchery {
287*e7be843bSPierre Pronchery     return ossl_quic_engine_get0_reactor(ossl_quic_obj_get0_engine(obj));
288*e7be843bSPierre Pronchery }
289*e7be843bSPierre Pronchery 
290*e7be843bSPierre Pronchery /* Get a reference to the OSSL_LIB_CTX pointer applicable to a leader. */
291*e7be843bSPierre Pronchery static ossl_inline ossl_unused OSSL_LIB_CTX *
ossl_quic_obj_get0_libctx(const QUIC_OBJ * obj)292*e7be843bSPierre Pronchery ossl_quic_obj_get0_libctx(const QUIC_OBJ *obj)
293*e7be843bSPierre Pronchery {
294*e7be843bSPierre Pronchery     return ossl_quic_engine_get0_libctx(ossl_quic_obj_get0_engine(obj));
295*e7be843bSPierre Pronchery }
296*e7be843bSPierre Pronchery 
297*e7be843bSPierre Pronchery /* Get a reference to the propq pointer applicable to a leader. */
298*e7be843bSPierre Pronchery static ossl_inline ossl_unused const char *
ossl_quic_obj_get0_propq(const QUIC_OBJ * obj)299*e7be843bSPierre Pronchery ossl_quic_obj_get0_propq(const QUIC_OBJ *obj)
300*e7be843bSPierre Pronchery {
301*e7be843bSPierre Pronchery     return ossl_quic_engine_get0_propq(ossl_quic_obj_get0_engine(obj));
302*e7be843bSPierre Pronchery }
303*e7be843bSPierre Pronchery 
304*e7be843bSPierre Pronchery /*
305*e7be843bSPierre Pronchery  * Returns the APL object pointer to the event leader in a hierarchy. Always
306*e7be843bSPierre Pronchery  * returns non-NULL.
307*e7be843bSPierre Pronchery  */
308*e7be843bSPierre Pronchery static ossl_inline ossl_unused SSL *
ossl_quic_obj_get0_event_leader(const QUIC_OBJ * obj)309*e7be843bSPierre Pronchery ossl_quic_obj_get0_event_leader(const QUIC_OBJ *obj)
310*e7be843bSPierre Pronchery {
311*e7be843bSPierre Pronchery     assert(obj->init_done);
312*e7be843bSPierre Pronchery     return obj->cached_event_leader != NULL
313*e7be843bSPierre Pronchery         ? &obj->cached_event_leader->ssl
314*e7be843bSPierre Pronchery         : NULL;
315*e7be843bSPierre Pronchery }
316*e7be843bSPierre Pronchery 
317*e7be843bSPierre Pronchery /*
318*e7be843bSPierre Pronchery  * Returns the APL object pointer to the port leader in a hierarchy (if any).
319*e7be843bSPierre Pronchery  * Always returns non-NULL.
320*e7be843bSPierre Pronchery  */
321*e7be843bSPierre Pronchery static ossl_inline ossl_unused SSL *
ossl_quic_obj_get0_port_leader(const QUIC_OBJ * obj)322*e7be843bSPierre Pronchery ossl_quic_obj_get0_port_leader(const QUIC_OBJ *obj)
323*e7be843bSPierre Pronchery {
324*e7be843bSPierre Pronchery     assert(obj->init_done);
325*e7be843bSPierre Pronchery     return obj->cached_port_leader != NULL
326*e7be843bSPierre Pronchery         ? &obj->cached_port_leader->ssl
327*e7be843bSPierre Pronchery         : NULL;
328*e7be843bSPierre Pronchery }
329*e7be843bSPierre Pronchery 
330*e7be843bSPierre Pronchery /*
331*e7be843bSPierre Pronchery  * Change the domain flags. Should only be called immediately after
332*e7be843bSPierre Pronchery  * ossl_quic_obj_init().
333*e7be843bSPierre Pronchery  */
334*e7be843bSPierre Pronchery static ossl_inline ossl_unused void
ossl_quic_obj_set_domain_flags(QUIC_OBJ * obj,uint64_t domain_flags)335*e7be843bSPierre Pronchery ossl_quic_obj_set_domain_flags(QUIC_OBJ *obj, uint64_t domain_flags)
336*e7be843bSPierre Pronchery {
337*e7be843bSPierre Pronchery     obj->domain_flags = domain_flags;
338*e7be843bSPierre Pronchery }
339*e7be843bSPierre Pronchery 
340*e7be843bSPierre Pronchery # endif
341*e7be843bSPierre Pronchery #endif
342