]> git.ipfire.org Git - thirdparty/openssl.git/blob - include/internal/quic_ssl.h
Minor fixes
[thirdparty/openssl.git] / include / internal / quic_ssl.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_SSL_H
11 # define OSSL_QUIC_SSL_H
12
13 # include <openssl/ssl.h>
14 # include <openssl/bio.h>
15 # include "internal/quic_record_rx.h" /* OSSL_QRX */
16 # include "internal/quic_ackm.h" /* OSSL_ACKM */
17 # include "internal/quic_channel.h" /* QUIC_CHANNEL */
18
19 # ifndef OPENSSL_NO_QUIC
20
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);
31 __owur int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written);
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);
37 __owur int ossl_quic_key_update(SSL *s, int update_type);
38 __owur int ossl_quic_get_key_update_type(const SSL *s);
39 __owur int ossl_quic_num_ciphers(void);
40 __owur const SSL_CIPHER *ossl_quic_get_cipher(unsigned int u);
41 int ossl_quic_renegotiate_check(SSL *ssl, int initok);
42
43 typedef struct quic_conn_st QUIC_CONNECTION;
44 typedef struct quic_xso_st QUIC_XSO;
45
46 int ossl_quic_do_handshake(SSL *s);
47 void ossl_quic_set_connect_state(SSL *s);
48 void ossl_quic_set_accept_state(SSL *s);
49
50 __owur int ossl_quic_has_pending(const SSL *s);
51 __owur int ossl_quic_handle_events(SSL *s);
52 __owur int ossl_quic_get_event_timeout(SSL *s, struct timeval *tv,
53 int *is_infinite);
54 OSSL_TIME ossl_quic_get_event_deadline(SSL *s);
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,
63 const SSL_SHUTDOWN_EX_ARGS *args,
64 size_t args_len);
65 __owur int ossl_quic_conn_stream_conclude(SSL *s);
66 void ossl_quic_conn_set0_net_rbio(SSL *s, BIO *net_wbio);
67 void ossl_quic_conn_set0_net_wbio(SSL *s, BIO *net_wbio);
68 BIO *ossl_quic_conn_get_net_rbio(const SSL *s);
69 BIO *ossl_quic_conn_get_net_wbio(const SSL *s);
70 __owur int ossl_quic_conn_set_initial_peer_addr(SSL *s,
71 const BIO_ADDR *peer_addr);
72 __owur SSL *ossl_quic_conn_stream_new(SSL *s, uint64_t flags);
73 __owur SSL *ossl_quic_get0_connection(SSL *s);
74 __owur int ossl_quic_get_stream_type(SSL *s);
75 __owur uint64_t ossl_quic_get_stream_id(SSL *s);
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);
79 __owur int ossl_quic_set_incoming_stream_policy(SSL *s, int policy,
80 uint64_t aec);
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);
83
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
98 uint64_t ossl_quic_set_options(SSL *s, uint64_t opts);
99 uint64_t ossl_quic_clear_options(SSL *s, uint64_t opts);
100 uint64_t ossl_quic_get_options(const SSL *s);
101
102 /*
103 * Used to override ossl_time_now() for debug purposes. While this may be
104 * overridden at any time, expect strange results if you change it after
105 * connecting.
106 */
107 int ossl_quic_conn_set_override_now_cb(SSL *s,
108 OSSL_TIME (*now_cb)(void *arg),
109 void *now_cb_arg);
110
111 /*
112 * Condvar waiting in the assist thread doesn't support time faking as it relies
113 * on the OS's notion of time, thus this is used in test code to force a
114 * spurious wakeup instead.
115 */
116 void ossl_quic_conn_force_assist_thread_wake(SSL *s);
117
118 /* For use by tests only. */
119 QUIC_CHANNEL *ossl_quic_conn_get_channel(SSL *s);
120
121 int ossl_quic_has_pending(const SSL *s);
122
123 # endif
124
125 #endif