]>
Commit | Line | Data |
---|---|---|
d5ab48a1 | 1 | /* |
b6461792 | 2 | * Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved. |
d5ab48a1 RL |
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_SSL_H | |
11 | # define OSSL_QUIC_SSL_H | |
12 | ||
13 | # include <openssl/ssl.h> | |
22d53c88 | 14 | # include <openssl/bio.h> |
d5ab48a1 RL |
15 | # include "internal/quic_record_rx.h" /* OSSL_QRX */ |
16 | # include "internal/quic_ackm.h" /* OSSL_ACKM */ | |
16f3b542 | 17 | # include "internal/quic_channel.h" /* QUIC_CHANNEL */ |
d5ab48a1 | 18 | |
6292519c HL |
19 | # ifndef OPENSSL_NO_QUIC |
20 | ||
d5ab48a1 RL |
21 | __owur SSL *ossl_quic_new(SSL_CTX *ctx); |
22 | __owur int ossl_quic_init(SSL *s); | |
23 | void ossl_quic_deinit(SSL *s); | |
24 | void ossl_quic_free(SSL *s); | |
25 | int ossl_quic_reset(SSL *s); | |
26 | int ossl_quic_clear(SSL *s); | |
27 | __owur int ossl_quic_accept(SSL *s); | |
28 | __owur int ossl_quic_connect(SSL *s); | |
29 | __owur int ossl_quic_read(SSL *s, void *buf, size_t len, size_t *readbytes); | |
30 | __owur int ossl_quic_peek(SSL *s, void *buf, size_t len, size_t *readbytes); | |
113be15a HL |
31 | __owur int ossl_quic_write_flags(SSL *s, const void *buf, size_t len, |
32 | uint64_t flags, size_t *written); | |
d5ab48a1 | 33 | __owur int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written); |
d5ab48a1 RL |
34 | __owur long ossl_quic_ctrl(SSL *s, int cmd, long larg, void *parg); |
35 | __owur long ossl_quic_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); | |
36 | __owur long ossl_quic_callback_ctrl(SSL *s, int cmd, void (*fp) (void)); | |
37 | __owur long ossl_quic_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp) (void)); | |
38 | __owur size_t ossl_quic_pending(const SSL *s); | |
2525109f HL |
39 | __owur int ossl_quic_key_update(SSL *s, int update_type); |
40 | __owur int ossl_quic_get_key_update_type(const SSL *s); | |
547ea588 | 41 | __owur const SSL_CIPHER *ossl_quic_get_cipher_by_char(const unsigned char *p); |
d5ab48a1 RL |
42 | __owur int ossl_quic_num_ciphers(void); |
43 | __owur const SSL_CIPHER *ossl_quic_get_cipher(unsigned int u); | |
44 | int ossl_quic_renegotiate_check(SSL *ssl, int initok); | |
45 | ||
46 | typedef struct quic_conn_st QUIC_CONNECTION; | |
f8636c7e | 47 | typedef struct quic_xso_st QUIC_XSO; |
d5ab48a1 | 48 | |
072328dd HL |
49 | int ossl_quic_do_handshake(SSL *s); |
50 | void ossl_quic_set_connect_state(SSL *s); | |
51 | void ossl_quic_set_accept_state(SSL *s); | |
22d53c88 | 52 | |
072328dd | 53 | __owur int ossl_quic_has_pending(const SSL *s); |
6084e04b | 54 | __owur int ossl_quic_handle_events(SSL *s); |
7ea49713 HL |
55 | __owur int ossl_quic_get_event_timeout(SSL *s, struct timeval *tv, |
56 | int *is_infinite); | |
6084e04b | 57 | OSSL_TIME ossl_quic_get_event_deadline(SSL *s); |
072328dd HL |
58 | __owur int ossl_quic_get_rpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *d); |
59 | __owur int ossl_quic_get_wpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *d); | |
60 | __owur int ossl_quic_get_net_read_desired(SSL *s); | |
61 | __owur int ossl_quic_get_net_write_desired(SSL *s); | |
62 | __owur int ossl_quic_get_error(const SSL *s, int i); | |
5debf070 | 63 | __owur int ossl_quic_want(const SSL *s); |
072328dd HL |
64 | __owur int ossl_quic_conn_get_blocking_mode(const SSL *s); |
65 | __owur int ossl_quic_conn_set_blocking_mode(SSL *s, int blocking); | |
66 | __owur int ossl_quic_conn_shutdown(SSL *s, uint64_t flags, | |
e8043229 HL |
67 | const SSL_SHUTDOWN_EX_ARGS *args, |
68 | size_t args_len); | |
072328dd HL |
69 | __owur int ossl_quic_conn_stream_conclude(SSL *s); |
70 | void ossl_quic_conn_set0_net_rbio(SSL *s, BIO *net_wbio); | |
71 | void ossl_quic_conn_set0_net_wbio(SSL *s, BIO *net_wbio); | |
72 | BIO *ossl_quic_conn_get_net_rbio(const SSL *s); | |
73 | BIO *ossl_quic_conn_get_net_wbio(const SSL *s); | |
74 | __owur int ossl_quic_conn_set_initial_peer_addr(SSL *s, | |
22d53c88 | 75 | const BIO_ADDR *peer_addr); |
cb5c208b | 76 | __owur SSL *ossl_quic_conn_stream_new(SSL *s, uint64_t flags); |
020d0389 | 77 | __owur SSL *ossl_quic_get0_connection(SSL *s); |
1bca3f1b | 78 | __owur int ossl_quic_get_stream_type(SSL *s); |
19cb0887 | 79 | __owur uint64_t ossl_quic_get_stream_id(SSL *s); |
d2e9e12b | 80 | __owur int ossl_quic_is_stream_local(SSL *s); |
8b7be3aa HL |
81 | __owur int ossl_quic_set_default_stream_mode(SSL *s, uint32_t mode); |
82 | __owur SSL *ossl_quic_detach_stream(SSL *s); | |
83 | __owur int ossl_quic_attach_stream(SSL *conn, SSL *stream); | |
83df44ae HL |
84 | __owur int ossl_quic_set_incoming_stream_policy(SSL *s, int policy, |
85 | uint64_t aec); | |
cb68ce9f HL |
86 | __owur SSL *ossl_quic_accept_stream(SSL *s, uint64_t flags); |
87 | __owur size_t ossl_quic_get_accept_stream_queue_len(SSL *s); | |
57eee469 HL |
88 | __owur int ossl_quic_get_value_uint(SSL *s, uint32_t class_, uint32_t id, |
89 | uint64_t *value); | |
90 | __owur int ossl_quic_set_value_uint(SSL *s, uint32_t class_, uint32_t id, | |
91 | uint64_t value); | |
d5ab48a1 | 92 | |
c3a04ea2 HL |
93 | __owur int ossl_quic_stream_reset(SSL *ssl, |
94 | const SSL_STREAM_RESET_ARGS *args, | |
95 | size_t args_len); | |
96 | ||
97 | __owur int ossl_quic_get_stream_read_state(SSL *ssl); | |
98 | __owur int ossl_quic_get_stream_write_state(SSL *ssl); | |
99 | __owur int ossl_quic_get_stream_read_error_code(SSL *ssl, | |
100 | uint64_t *app_error_code); | |
101 | __owur int ossl_quic_get_stream_write_error_code(SSL *ssl, | |
102 | uint64_t *app_error_code); | |
103 | __owur int ossl_quic_get_conn_close_info(SSL *ssl, | |
104 | SSL_CONN_CLOSE_INFO *info, | |
105 | size_t info_len); | |
106 | ||
f0d9757c HL |
107 | uint64_t ossl_quic_set_options(SSL *s, uint64_t opts); |
108 | uint64_t ossl_quic_clear_options(SSL *s, uint64_t opts); | |
109 | uint64_t ossl_quic_get_options(const SSL *s); | |
110 | ||
3415677e HL |
111 | /* Modifies write buffer size for a stream. */ |
112 | __owur int ossl_quic_set_write_buffer_size(SSL *s, size_t size); | |
113 | ||
b212d554 | 114 | /* |
e3e9794a HL |
115 | * Used to override ossl_time_now() for debug purposes. While this may be |
116 | * overridden at any time, expect strange results if you change it after | |
b212d554 HL |
117 | * connecting. |
118 | */ | |
e3e9794a HL |
119 | int ossl_quic_conn_set_override_now_cb(SSL *s, |
120 | OSSL_TIME (*now_cb)(void *arg), | |
121 | void *now_cb_arg); | |
b212d554 | 122 | |
3b1ab5a3 HL |
123 | /* |
124 | * Condvar waiting in the assist thread doesn't support time faking as it relies | |
125 | * on the OS's notion of time, thus this is used in test code to force a | |
126 | * spurious wakeup instead. | |
127 | */ | |
128 | void ossl_quic_conn_force_assist_thread_wake(SSL *s); | |
129 | ||
16f3b542 HL |
130 | /* For use by tests only. */ |
131 | QUIC_CHANNEL *ossl_quic_conn_get_channel(SSL *s); | |
d6e7ebba | 132 | |
9280d26a | 133 | int ossl_quic_has_pending(const SSL *s); |
7757f5ef | 134 | int ossl_quic_get_shutdown(const SSL *s); |
16f3b542 | 135 | |
fb1a0bb9 | 136 | /* |
de60b122 | 137 | * Set qlog diagnostic title. String is copied internally on success and need |
fb1a0bb9 HL |
138 | * not remain allocated. Only has any effect if logging has not already begun. |
139 | * For use by tests only. Setting this on a context affects any QCSO created | |
140 | * after this is called but does not affect QCSOs already created from a | |
141 | * context. | |
142 | */ | |
143 | int ossl_quic_set_diag_title(SSL_CTX *ctx, const char *title); | |
144 | ||
6ba77d67 | 145 | /* APIs used by the polling infrastructure */ |
9387bd4c HL |
146 | int ossl_quic_conn_poll_events(SSL *ssl, uint64_t events, int do_tick, |
147 | uint64_t *revents); | |
6ba77d67 | 148 | |
6292519c HL |
149 | # endif |
150 | ||
d5ab48a1 | 151 | #endif |