xref: /freebsd/crypto/openssl/include/openssl/quic.h (revision e7be843b4a162e68651d3911f0357ed464915629)
1 /*
2  * Copyright 2022-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 OPENSSL_QUIC_H
11 # define OPENSSL_QUIC_H
12 # pragma once
13 
14 # include <openssl/macros.h>
15 # include <openssl/ssl.h>
16 
17 # ifndef OPENSSL_NO_QUIC
18 
19 #  ifdef __cplusplus
20 extern "C" {
21 #  endif
22 
23 /*
24  * Method used for non-thread-assisted QUIC client operation.
25  */
26 __owur const SSL_METHOD *OSSL_QUIC_client_method(void);
27 
28 /*
29  * Method used for thread-assisted QUIC client operation.
30  */
31 __owur const SSL_METHOD *OSSL_QUIC_client_thread_method(void);
32 
33 /*
34  * QUIC transport error codes (RFC 9000 s. 20.1)
35  */
36 #  define OSSL_QUIC_ERR_NO_ERROR                  0x00
37 #  define OSSL_QUIC_ERR_INTERNAL_ERROR            0x01
38 #  define OSSL_QUIC_ERR_CONNECTION_REFUSED        0x02
39 #  define OSSL_QUIC_ERR_FLOW_CONTROL_ERROR        0x03
40 #  define OSSL_QUIC_ERR_STREAM_LIMIT_ERROR        0x04
41 #  define OSSL_QUIC_ERR_STREAM_STATE_ERROR        0x05
42 #  define OSSL_QUIC_ERR_FINAL_SIZE_ERROR          0x06
43 #  define OSSL_QUIC_ERR_FRAME_ENCODING_ERROR      0x07
44 #  define OSSL_QUIC_ERR_TRANSPORT_PARAMETER_ERROR 0x08
45 #  define OSSL_QUIC_ERR_CONNECTION_ID_LIMIT_ERROR 0x09
46 #  define OSSL_QUIC_ERR_PROTOCOL_VIOLATION        0x0A
47 #  define OSSL_QUIC_ERR_INVALID_TOKEN             0x0B
48 #  define OSSL_QUIC_ERR_APPLICATION_ERROR         0x0C
49 #  define OSSL_QUIC_ERR_CRYPTO_BUFFER_EXCEEDED    0x0D
50 #  define OSSL_QUIC_ERR_KEY_UPDATE_ERROR          0x0E
51 #  define OSSL_QUIC_ERR_AEAD_LIMIT_REACHED        0x0F
52 #  define OSSL_QUIC_ERR_NO_VIABLE_PATH            0x10
53 
54 /* Inclusive range for handshake-specific errors. */
55 #  define OSSL_QUIC_ERR_CRYPTO_ERR_BEGIN          0x0100
56 #  define OSSL_QUIC_ERR_CRYPTO_ERR_END            0x01FF
57 
58 #  define OSSL_QUIC_ERR_CRYPTO_ERR(X) \
59     (OSSL_QUIC_ERR_CRYPTO_ERR_BEGIN + (X))
60 
61 /* Local errors. */
62 #  define OSSL_QUIC_LOCAL_ERR_IDLE_TIMEOUT        \
63     ((uint64_t)0xFFFFFFFFFFFFFFFFULL)
64 
65 /*
66  * Method used for QUIC server operation.
67  */
68 __owur const SSL_METHOD *OSSL_QUIC_server_method(void);
69 
70 #  ifdef __cplusplus
71 }
72 #  endif
73 
74 # endif /* OPENSSL_NO_QUIC */
75 #endif
76