]> git.ipfire.org Git - thirdparty/openssl.git/blob - ssl/quic/quic_local.h
Move the QUIC_CONNECTION typedef to internal headers
[thirdparty/openssl.git] / ssl / quic / quic_local.h
1 /*
2 * Copyright 2022 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_LOCAL_H
11 # define OSSL_QUIC_LOCAL_H
12
13 # include <openssl/ssl.h>
14 # include "internal/quic_ssl.h" /* QUIC_CONNECTION */
15 # include "../ssl_local.h"
16
17 struct quic_conn_st {
18 /* type identifier and common data */
19 struct ssl_st ssl;
20 /* the associated tls-1.3 connection data */
21 SSL *tls;
22
23 /* For QUIC, diverse handlers */
24 OSSL_ACKM *ackm;
25 OSSL_QRX *qrx;
26 };
27
28 # define QUIC_CONNECTION_FROM_SSL_int(ssl, c) \
29 ((ssl) == NULL ? NULL \
30 : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION \
31 ? (c QUIC_CONNECTION *)(ssl) \
32 : NULL))
33
34 # define SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, c) \
35 ((ssl) == NULL ? NULL \
36 : ((ssl)->type == SSL_TYPE_QUIC_CONNECTION \
37 ? (c SSL_CONNECTION *)((c QUIC_CONNECTION *)(ssl))->tls \
38 : NULL))
39
40 # define QUIC_CONNECTION_FROM_SSL(ssl) \
41 QUIC_CONNECTION_FROM_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
42 # define QUIC_CONNECTION_FROM_CONST_SSL(ssl) \
43 QUIC_CONNECTION_FROM_SSL_int(ssl, const)
44 # define SSL_CONNECTION_FROM_QUIC_SSL(ssl) \
45 SSL_CONNECTION_FROM_QUIC_SSL_int(ssl, SSL_CONNECTION_NO_CONST)
46 # define SSL_CONNECTION_FROM_CONST_QUIC_SSL(ssl) \
47 SSL_CONNECTION_FROM_CONST_QUIC_SSL_int(ssl, const)
48
49 # define OSSL_QUIC_ANY_VERSION 0xFFFFF
50
51 # define IMPLEMENT_quic_meth_func(version, func_name, q_accept, \
52 q_connect, enc_data) \
53 const SSL_METHOD *func_name(void) \
54 { \
55 static const SSL_METHOD func_name##_data= { \
56 version, \
57 0, \
58 0, \
59 ossl_quic_new, \
60 ossl_quic_free, \
61 ossl_quic_reset, \
62 ossl_quic_init, \
63 ossl_quic_clear, \
64 ossl_quic_deinit, \
65 q_accept, \
66 q_connect, \
67 ossl_quic_read, \
68 ossl_quic_peek, \
69 ossl_quic_write, \
70 ossl_quic_shutdown, \
71 NULL /* renegotiate */, \
72 ossl_quic_renegotiate_check, \
73 NULL /* read_bytes */, \
74 NULL /* write_bytes */, \
75 NULL /* dispatch_alert */, \
76 ossl_quic_ctrl, \
77 ossl_quic_ctx_ctrl, \
78 NULL /* get_cipher_by_char */, \
79 NULL /* put_cipher_by_char */, \
80 ossl_quic_pending, \
81 ossl_quic_num_ciphers, \
82 ossl_quic_get_cipher, \
83 ossl_quic_default_timeout, \
84 &enc_data, \
85 ssl_undefined_void_function, \
86 ossl_quic_callback_ctrl, \
87 ossl_quic_ctx_callback_ctrl, \
88 }; \
89 return &func_name##_data; \
90 }
91
92 #endif