]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/internal/quic_ssl.h
QUIC: Allow application to trigger TXKU
[thirdparty/openssl.git] / include / internal / quic_ssl.h
CommitLineData
d5ab48a1
RL
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_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);
23void ossl_quic_deinit(SSL *s);
24void ossl_quic_free(SSL *s);
25int ossl_quic_reset(SSL *s);
26int 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);
31__owur int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written);
d5ab48a1
RL
32__owur long ossl_quic_ctrl(SSL *s, int cmd, long larg, void *parg);
33__owur long ossl_quic_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg);
34__owur long ossl_quic_callback_ctrl(SSL *s, int cmd, void (*fp) (void));
35__owur long ossl_quic_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp) (void));
36__owur size_t ossl_quic_pending(const SSL *s);
2525109f
HL
37__owur int ossl_quic_key_update(SSL *s, int update_type);
38__owur int ossl_quic_get_key_update_type(const SSL *s);
d5ab48a1
RL
39__owur int ossl_quic_num_ciphers(void);
40__owur const SSL_CIPHER *ossl_quic_get_cipher(unsigned int u);
41int ossl_quic_renegotiate_check(SSL *ssl, int initok);
42
43typedef struct quic_conn_st QUIC_CONNECTION;
f8636c7e 44typedef struct quic_xso_st QUIC_XSO;
d5ab48a1 45
072328dd
HL
46int ossl_quic_do_handshake(SSL *s);
47void ossl_quic_set_connect_state(SSL *s);
48void ossl_quic_set_accept_state(SSL *s);
22d53c88 49
072328dd 50__owur int ossl_quic_has_pending(const SSL *s);
6084e04b 51__owur int ossl_quic_handle_events(SSL *s);
7ea49713
HL
52__owur int ossl_quic_get_event_timeout(SSL *s, struct timeval *tv,
53 int *is_infinite);
6084e04b 54OSSL_TIME ossl_quic_get_event_deadline(SSL *s);
072328dd
HL
55__owur int ossl_quic_get_rpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *d);
56__owur int ossl_quic_get_wpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *d);
57__owur int ossl_quic_get_net_read_desired(SSL *s);
58__owur int ossl_quic_get_net_write_desired(SSL *s);
59__owur int ossl_quic_get_error(const SSL *s, int i);
60__owur int ossl_quic_conn_get_blocking_mode(const SSL *s);
61__owur int ossl_quic_conn_set_blocking_mode(SSL *s, int blocking);
62__owur int ossl_quic_conn_shutdown(SSL *s, uint64_t flags,
e8043229
HL
63 const SSL_SHUTDOWN_EX_ARGS *args,
64 size_t args_len);
072328dd
HL
65__owur int ossl_quic_conn_stream_conclude(SSL *s);
66void ossl_quic_conn_set0_net_rbio(SSL *s, BIO *net_wbio);
67void ossl_quic_conn_set0_net_wbio(SSL *s, BIO *net_wbio);
68BIO *ossl_quic_conn_get_net_rbio(const SSL *s);
69BIO *ossl_quic_conn_get_net_wbio(const SSL *s);
70__owur int ossl_quic_conn_set_initial_peer_addr(SSL *s,
22d53c88 71 const BIO_ADDR *peer_addr);
cb5c208b 72__owur SSL *ossl_quic_conn_stream_new(SSL *s, uint64_t flags);
020d0389 73__owur SSL *ossl_quic_get0_connection(SSL *s);
1bca3f1b 74__owur int ossl_quic_get_stream_type(SSL *s);
19cb0887 75__owur uint64_t ossl_quic_get_stream_id(SSL *s);
8b7be3aa
HL
76__owur int ossl_quic_set_default_stream_mode(SSL *s, uint32_t mode);
77__owur SSL *ossl_quic_detach_stream(SSL *s);
78__owur int ossl_quic_attach_stream(SSL *conn, SSL *stream);
83df44ae
HL
79__owur int ossl_quic_set_incoming_stream_policy(SSL *s, int policy,
80 uint64_t aec);
cb68ce9f
HL
81__owur SSL *ossl_quic_accept_stream(SSL *s, uint64_t flags);
82__owur size_t ossl_quic_get_accept_stream_queue_len(SSL *s);
d5ab48a1 83
c3a04ea2
HL
84__owur int ossl_quic_stream_reset(SSL *ssl,
85 const SSL_STREAM_RESET_ARGS *args,
86 size_t args_len);
87
88__owur int ossl_quic_get_stream_read_state(SSL *ssl);
89__owur int ossl_quic_get_stream_write_state(SSL *ssl);
90__owur int ossl_quic_get_stream_read_error_code(SSL *ssl,
91 uint64_t *app_error_code);
92__owur int ossl_quic_get_stream_write_error_code(SSL *ssl,
93 uint64_t *app_error_code);
94__owur int ossl_quic_get_conn_close_info(SSL *ssl,
95 SSL_CONN_CLOSE_INFO *info,
96 size_t info_len);
97
b212d554 98/*
e3e9794a
HL
99 * Used to override ossl_time_now() for debug purposes. While this may be
100 * overridden at any time, expect strange results if you change it after
b212d554
HL
101 * connecting.
102 */
e3e9794a
HL
103int ossl_quic_conn_set_override_now_cb(SSL *s,
104 OSSL_TIME (*now_cb)(void *arg),
105 void *now_cb_arg);
b212d554 106
3b1ab5a3
HL
107/*
108 * Condvar waiting in the assist thread doesn't support time faking as it relies
109 * on the OS's notion of time, thus this is used in test code to force a
110 * spurious wakeup instead.
111 */
112void ossl_quic_conn_force_assist_thread_wake(SSL *s);
113
16f3b542
HL
114/* For use by tests only. */
115QUIC_CHANNEL *ossl_quic_conn_get_channel(SSL *s);
116
6292519c
HL
117# endif
118
d5ab48a1 119#endif