=item
Only B<BIO_POLL_DESCRIPTOR> structures with type
-B<BIO_POLL_DESCRIPTOR_TYPE_SSL>, referencing QUIC connection SSL objects or QUIC
+B<BIO_POLL_DESCRIPTOR_TYPE_SSL>, referencing QUIC listener, connection or
stream SSL objects, are supported.
=back
* it natural for us to implement it simply by registering a blocking call per
* SSL object passed in. Since multiple SSL objects may be passed to an SSL_poll
* call, and some SSL objects may correspond to the same reactor, and other SSL
- * objects may correspond toa different reactor, we need to be able to determine
- * when a SSL_poll call has finished with all of the SSL objects *corresponding
- * to a given reactor*.
+ * objects may correspond to a different reactor, we need to be able to
+ * determine when a SSL_poll() call has finished with all of the SSL objects
+ * *corresponding to a given reactor*.
*
- * Doing this requires some ephemeral state tracking as a SSL_poll call may map
- * to an arbitrarily large set of reactor objects. For now, we track this
+ * Doing this requires some ephemeral state tracking as a SSL_poll() call may
+ * map to an arbitrarily large set of reactor objects. For now, we track this
* separately from the reactor code as the state needed is only ephemeral and
* this keeps the reactor internals simple.
*
SOURCE[$LIBSSL]=poll_immediate.c
IF[{- !$disabled{quic} -}]
- SOURCE[$LIBSSL]=rio_notifier.c
+ SOURCE[$LIBSSL]=rio_notifier.c poll_builder.c
ENDIF
-SOURCE[$LIBSSL]=poll_builder.c
-#include "poll_builder.h"
-#include "internal/safe_math.h"
+/*
+ * Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
#include <assert.h>
+#include <errno.h>
+#include "internal/safe_math.h"
+#include "poll_builder.h"
OSSL_SAFE_MATH_UNSIGNED(size_t, size_t)
int ossl_rio_poll_builder_add_fd(RIO_POLL_BUILDER *rpb, int fd,
int want_read, int want_write)
{
+#if RIO_POLL_METHOD == RIO_POLL_METHOD_POLL
+ size_t num_loop;
+#endif
+
if (fd < 0)
return 0;
return 1;
#elif RIO_POLL_METHOD == RIO_POLL_METHOD_POLL
- size_t num_loop;
-
for (num_loop = 0;; ++num_loop) {
size_t i;
struct pollfd *pfds = (rpb->pfd_heap != NULL ? rpb->pfd_heap : rpb->pfds);
/*
- * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
FAIL_FROM(idx_ + 1); \
} while (0)
+#ifndef OPENSSL_NO_QUIC
static int poll_translate_ssl_quic(SSL *ssl,
QUIC_REACTOR_WAIT_CTX *wctx,
RIO_POLL_BUILDER *rpb,
return 0;
}
- if (rd.type != BIO_POLL_DESCRIPTOR_TYPE_SOCK_FD) {
+ if (wd.type != BIO_POLL_DESCRIPTOR_TYPE_SOCK_FD) {
ERR_raise_data(ERR_LIB_SSL, SSL_R_POLL_REQUEST_NOT_SUPPORTED,
"SSL_poll requires the poll descriptors of the "
"network BIOs underlying a QUIC SSL object be "
break;
switch (ssl->type) {
-#ifndef OPENSSL_NO_QUIC
+# ifndef OPENSSL_NO_QUIC
case SSL_TYPE_QUIC_LISTENER:
case SSL_TYPE_QUIC_CONNECTION:
case SSL_TYPE_QUIC_XSO:
postpoll_translation_cleanup_ssl_quic(ssl, wctx);
break;
-#endif
+# endif
default:
break;
}
break;
switch (ssl->type) {
-#ifndef OPENSSL_NO_QUIC
+# ifndef OPENSSL_NO_QUIC
case SSL_TYPE_QUIC_LISTENER:
case SSL_TYPE_QUIC_CONNECTION:
case SSL_TYPE_QUIC_XSO:
ossl_time_from_timeval(timeout)));
break;
-#endif
+# endif
default:
ERR_raise_data(ERR_LIB_SSL, SSL_R_POLL_REQUEST_NOT_SUPPORTED,
ossl_quic_reactor_wait_ctx_cleanup(&wctx);
return ok;
}
+#endif
static int poll_readout(SSL_POLL_ITEM *items,
size_t num_items,
size_t i, result_count = 0;
SSL_POLL_ITEM *item;
SSL *ssl;
- uint64_t events, revents;
+#ifndef OPENSSL_NO_QUIC
+ uint64_t events;
+#endif
+ uint64_t revents;
for (i = 0; i < num_items; ++i) {
item = &ITEM_N(items, stride, i);
+#ifndef OPENSSL_NO_QUIC
events = item->events;
+#endif
revents = 0;
switch (item->desc.type) {
* point onwards.
*/
do_tick = 1;
- if (!poll_block(items, num_items, stride, deadline)) {
+#ifndef OPENSSL_NO_QUIC
+ if (!poll_block(items, num_items, stride, deadline, &result_count)) {
ok = 0;
goto out;
}
+#endif
}
/* TODO(QUIC POLLING): Support for polling FDs */
if (!TEST_ptr(ctx = SSL_CTX_new(method)))
goto err;
+#if defined(OPENSSL_THREADS)
if (!TEST_true(SSL_CTX_set_domain_flags(ctx,
SSL_DOMAIN_FLAG_MULTI_THREAD
| SSL_DOMAIN_FLAG_BLOCKING)))
goto err;
+#endif
if (!TEST_true(ssl_ctx_configure(ctx, is_server)))
goto err;
break;
case 4: /* Listener test */
expected_result_count = 1;
- items[5].events |= SSL_POLL_EVENT_IC;
+ items[5].events = SSL_POLL_EVENT_IC;
expected_items[5].revents = SSL_POLL_EVENT_IC;
break;
default: