QUIC API: Rename want_net_read and want_net_write
authorHugo Landau <hlandau@openssl.org>
Mon, 9 Jan 2023 15:48:25 +0000 (15:48 +0000)
committerHugo Landau <hlandau@openssl.org>
Fri, 13 Jan 2023 13:20:38 +0000 (13:20 +0000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19703)

doc/man3/SSL_get_rpoll_descriptor.pod
include/internal/quic_reactor.h
include/internal/quic_ssl.h
include/openssl/ssl.h.in
ssl/quic/quic_channel.c
ssl/quic/quic_impl.c
ssl/quic/quic_reactor.c
ssl/ssl_lib.c
util/libssl.num

index 62378576f0c81ecc72de84fd292f03db6a6712b7..475aac6a44ddeb23ddc3ed95ad3fa1f3503d2347 100644 (file)
@@ -2,8 +2,8 @@
 
 =head1 NAME
 
-SSL_get_rpoll_descriptor, SSL_get_wpoll_descriptor, SSL_want_net_read,
-SSL_want_net_write - obtain information which can be used to determine when
+SSL_get_rpoll_descriptor, SSL_get_wpoll_descriptor, SSL_net_read_desired,
+SSL_net_write_desired - obtain information which can be used to determine when
 network I/O can be performed
 
 =head1 SYNOPSIS
@@ -12,8 +12,8 @@ network I/O can be performed
 
  int SSL_get_rpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *desc);
  int SSL_get_wpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *desc);
- int SSL_want_net_read(SSL *s);
- int SSL_want_net_write(SSL *s);
+ int SSL_net_read_desired(SSL *s);
+ int SSL_net_write_desired(SSL *s);
 
 =head1 DESCRIPTION
 
@@ -25,13 +25,13 @@ object in nonblocking mode can determine when it should call SSL_tick().
 On success, these functions output poll descriptors. For more information on
 poll descriptors, see L<BIO_get_rpoll_descriptor(3)>.
 
-The functions SSL_want_net_read() and SSL_want_net_write() return 1 or 0
+The functions SSL_net_read_desired() and SSL_net_write_desired() return 1 or 0
 depending on whether the SSL object is currently interested in receiving data
 from the network and/or writing data to the network respectively.
 If an SSL object is not interested in reading data from the network at the
-current time, SSL_want_net_read() will return 0; likewise, if an SSL object is
+current time, SSL_net_read_desired() will return 0; likewise, if an SSL object is
 not interested in writing data to the network at the current time,
-SSL_want_net_write() will return 0.
+SSL_net_write_desired() will return 0.
 
 The intention is that an application using QUIC in nonblocking mode can use
 these calls, in conjunction with L<SSL_get_tick_timeout(3)> to wait for network
@@ -49,21 +49,21 @@ SSL_get_tick_timeout(3) (if any) expires
 
 =item *
 
-If the last call to SSL_want_net_read() returned 1, SSL_tick() should be called
+If the last call to SSL_net_read_desired() returned 1, SSL_tick() should be called
 whenever the poll descriptor output by SSL_get_rpoll_descriptor() becomes
 readable.
 
 =item *
 
-If the last call to SSL_want_net_write() returned 1, SSL_tick() should be called
+If the last call to SSL_net_write_desired() returned 1, SSL_tick() should be called
 whenever the poll descriptor output by SSL_get_wpoll_descriptor() becomes
 writable.
 
 =back
 
-The return values of the SSL_want_net_read() and SSL_want_net_write() functions
+The return values of the SSL_net_read_desired() and SSL_net_write_desired() functions
 may change in response to any call to the SSL object other than
-SSL_want_net_read(), SSL_want_net_write(), SSL_get_rpoll_descriptor(),
+SSL_net_read_desired(), SSL_net_write_desired(), SSL_get_rpoll_descriptor(),
 SSL_get_wpoll_descriptor() and SSL_get_tick_timeout().
 
 These functions are not supported on non-QUIC SSL objects.
@@ -78,8 +78,8 @@ L<SSL_tick(3)>, L<SSL_get_tick_timeout(3)>, L<ssl(7)>
 
 =head1 HISTORY
 
-The SSL_get_rpoll_descriptor(), SSL_get_wpoll_descriptor(), SSL_want_net_read()
-and SSL_want_net_write() functions were added in OpenSSL 3.2.
+The SSL_get_rpoll_descriptor(), SSL_get_wpoll_descriptor(), SSL_net_read_desired()
+and SSL_net_write_desired() functions were added in OpenSSL 3.2.
 
 =head1 COPYRIGHT
 
index 90243e936bd522d07e593ecd296b811c48c5079d..b2bd980b6a7de8b964c477cc41cedc3d2baa4011 100644 (file)
@@ -68,8 +68,8 @@
  * the reactor interface.
  */
 typedef struct quic_tick_result_st {
-    char        want_net_read;
-    char        want_net_write;
+    char        net_read_desired;
+    char        net_write_desired;
     OSSL_TIME   tick_deadline;
 } QUIC_TICK_RESULT;
 
@@ -92,8 +92,8 @@ typedef struct quic_reactor_st {
      * These are true if we would like to know when we can read or write from
      * the network respectively.
      */
-    unsigned int want_net_read  : 1;
-    unsigned int want_net_write : 1;
+    unsigned int net_read_desired   : 1;
+    unsigned int net_write_desired  : 1;
 } QUIC_REACTOR;
 
 void ossl_quic_reactor_init(QUIC_REACTOR *rtor,
@@ -111,9 +111,9 @@ const BIO_POLL_DESCRIPTOR *ossl_quic_reactor_get_poll_r(QUIC_REACTOR *rtor);
 
 const BIO_POLL_DESCRIPTOR *ossl_quic_reactor_get_poll_w(QUIC_REACTOR *rtor);
 
-int ossl_quic_reactor_want_net_read(QUIC_REACTOR *rtor);
+int ossl_quic_reactor_net_read_desired(QUIC_REACTOR *rtor);
 
-int ossl_quic_reactor_want_net_write(QUIC_REACTOR *rtor);
+int ossl_quic_reactor_net_write_desired(QUIC_REACTOR *rtor);
 
 OSSL_TIME ossl_quic_reactor_get_tick_deadline(QUIC_REACTOR *rtor);
 
index 899aca5b357753ef502ab501f7eb5472d0f5650b..d319faef515ec8d9c96a6780e454bc72b62b70f6 100644 (file)
@@ -48,8 +48,8 @@ __owur int ossl_quic_tick(QUIC_CONNECTION *qc);
 __owur int ossl_quic_get_tick_timeout(QUIC_CONNECTION *qc, struct timeval *tv);
 __owur int ossl_quic_get_rpoll_descriptor(QUIC_CONNECTION *qc, BIO_POLL_DESCRIPTOR *d);
 __owur int ossl_quic_get_wpoll_descriptor(QUIC_CONNECTION *qc, BIO_POLL_DESCRIPTOR *d);
-__owur int ossl_quic_get_want_net_read(QUIC_CONNECTION *qc);
-__owur int ossl_quic_get_want_net_write(QUIC_CONNECTION *qc);
+__owur int ossl_quic_get_net_read_desired(QUIC_CONNECTION *qc);
+__owur int ossl_quic_get_net_write_desired(QUIC_CONNECTION *qc);
 __owur int ossl_quic_get_error(const QUIC_CONNECTION *qc, int i);
 __owur int ossl_quic_conn_get_blocking_mode(const QUIC_CONNECTION *qc);
 __owur int ossl_quic_conn_set_blocking_mode(QUIC_CONNECTION *qc, int blocking);
index 66da9ef43c274a9d94c067745fc1a1948dc011da..0a4496844447b34a74099a59244b20c8a759b1a0 100644 (file)
@@ -2252,8 +2252,8 @@ int SSL_tick(SSL *s);
 __owur int SSL_get_tick_timeout(SSL *s, struct timeval *tv);
 __owur int SSL_get_rpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *desc);
 __owur int SSL_get_wpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *desc);
-__owur int SSL_want_net_read(SSL *s);
-__owur int SSL_want_net_write(SSL *s);
+__owur int SSL_net_read_desired(SSL *s);
+__owur int SSL_net_write_desired(SSL *s);
 __owur int SSL_set_blocking_mode(SSL *s, int blocking);
 __owur int SSL_get_blocking_mode(SSL *s);
 __owur int SSL_set_initial_peer_addr(SSL *s, const BIO_ADDR *peer_addr);
index 0fb5c6d5d36de7b69ad42fcd520e63520d7e3e67..209309a42432a5d79d1f61a08d754631d0d13093 100644 (file)
@@ -998,9 +998,9 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg)
 
     /* If we are in the TERMINATED state, there is nothing to do. */
     if (ossl_quic_channel_is_terminated(ch)) {
-        res->want_net_read  = 0;
-        res->want_net_write = 0;
-        res->tick_deadline  = ossl_time_infinite();
+        res->net_read_desired   = 0;
+        res->net_write_desired  = 0;
+        res->tick_deadline      = ossl_time_infinite();
         return;
     }
 
@@ -1013,9 +1013,9 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg)
 
         if (ossl_time_compare(now, ch->terminate_deadline) >= 0) {
             ch_on_terminating_timeout(ch);
-            res->want_net_read  = 0;
-            res->want_net_write = 0;
-            res->tick_deadline  = ossl_time_infinite();
+            res->net_read_desired   = 0;
+            res->net_write_desired  = 0;
+            res->tick_deadline      = ossl_time_infinite();
             return; /* abort normal processing, nothing to do */
         }
     }
@@ -1057,9 +1057,9 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg)
          * send a CONN_CLOSE frame; go straight to TERMINATED.
          */
         ch_on_idle_timeout(ch);
-        res->want_net_read  = 0;
-        res->want_net_write = 0;
-        res->tick_deadline  = ossl_time_infinite();
+        res->net_read_desired   = 0;
+        res->net_write_desired  = 0;
+        res->tick_deadline      = ossl_time_infinite();
         return;
     }
 
@@ -1079,10 +1079,10 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg)
      * errors in ch_rx_pre() or ch_tx() may have caused us to transition to the
      * Terminated state.
      */
-    res->want_net_read = !ossl_quic_channel_is_terminated(ch);
+    res->net_read_desired = !ossl_quic_channel_is_terminated(ch);
 
     /* We want to write to the network if we have any in our queue. */
-    res->want_net_write
+    res->net_write_desired
         = (!ossl_quic_channel_is_terminated(ch)
            && ossl_qtx_get_queue_len_datagrams(ch->qtx) > 0);
 }
index 991605c36a43d050d55028edf7ec01068950fa6d..c5490cd07581f4cb910ce6593479571f051b855c 100644 (file)
@@ -445,22 +445,22 @@ int ossl_quic_get_wpoll_descriptor(QUIC_CONNECTION *qc, BIO_POLL_DESCRIPTOR *des
     return BIO_get_wpoll_descriptor(qc->net_wbio, desc);
 }
 
-/* SSL_want_net_read */
-int ossl_quic_get_want_net_read(QUIC_CONNECTION *qc)
+/* SSL_net_read_desired */
+int ossl_quic_get_net_read_desired(QUIC_CONNECTION *qc)
 {
     if (qc->ch == NULL)
         return 0;
 
-    return ossl_quic_reactor_want_net_read(ossl_quic_channel_get_reactor(qc->ch));
+    return ossl_quic_reactor_net_read_desired(ossl_quic_channel_get_reactor(qc->ch));
 }
 
-/* SSL_want_net_write */
-int ossl_quic_get_want_net_write(QUIC_CONNECTION *qc)
+/* SSL_net_write_desired */
+int ossl_quic_get_net_write_desired(QUIC_CONNECTION *qc)
 {
     if (qc->ch == NULL)
         return 0;
 
-    return ossl_quic_reactor_want_net_write(ossl_quic_channel_get_reactor(qc->ch));
+    return ossl_quic_reactor_net_write_desired(ossl_quic_channel_get_reactor(qc->ch));
 }
 
 /*
index aa4cff9a1db7887f51504f75e4a848d881570171..95a54ad6b7fd24b6415fd240feeb5fae6ffd0cfe 100644 (file)
@@ -20,8 +20,8 @@ void ossl_quic_reactor_init(QUIC_REACTOR *rtor,
 {
     rtor->poll_r.type       = BIO_POLL_DESCRIPTOR_TYPE_NONE;
     rtor->poll_w.type       = BIO_POLL_DESCRIPTOR_TYPE_NONE;
-    rtor->want_net_read     = 0;
-    rtor->want_net_write    = 0;
+    rtor->net_read_desired  = 0;
+    rtor->net_write_desired = 0;
     rtor->tick_deadline     = initial_tick_deadline;
 
     rtor->tick_cb           = tick_cb;
@@ -48,14 +48,14 @@ const BIO_POLL_DESCRIPTOR *ossl_quic_reactor_get_poll_w(QUIC_REACTOR *rtor)
     return &rtor->poll_w;
 }
 
-int ossl_quic_reactor_want_net_read(QUIC_REACTOR *rtor)
+int ossl_quic_reactor_net_read_desired(QUIC_REACTOR *rtor)
 {
-    return rtor->want_net_read;
+    return rtor->net_read_desired;
 }
 
-int ossl_quic_reactor_want_net_write(QUIC_REACTOR *rtor)
+int ossl_quic_reactor_net_write_desired(QUIC_REACTOR *rtor)
 {
-    return rtor->want_net_write;
+    return rtor->net_write_desired;
 }
 
 OSSL_TIME ossl_quic_reactor_get_tick_deadline(QUIC_REACTOR *rtor)
@@ -76,8 +76,8 @@ int ossl_quic_reactor_tick(QUIC_REACTOR *rtor)
      */
     rtor->tick_cb(&res, rtor->tick_cb_arg);
 
-    rtor->want_net_read     = res.want_net_read;
-    rtor->want_net_write    = res.want_net_write;
+    rtor->net_read_desired  = res.net_read_desired;
+    rtor->net_write_desired = res.net_write_desired;
     rtor->tick_deadline     = res.tick_deadline;
     return 1;
 }
@@ -280,9 +280,9 @@ int ossl_quic_reactor_block_until_pred(QUIC_REACTOR *rtor,
             return res;
 
         if (!poll_two_descriptors(ossl_quic_reactor_get_poll_r(rtor),
-                                  ossl_quic_reactor_want_net_read(rtor),
+                                  ossl_quic_reactor_net_read_desired(rtor),
                                   ossl_quic_reactor_get_poll_w(rtor),
-                                  ossl_quic_reactor_want_net_write(rtor),
+                                  ossl_quic_reactor_net_write_desired(rtor),
                                   ossl_quic_reactor_get_tick_deadline(rtor)))
             /*
              * We don't actually care why the call succeeded (timeout, FD
index 9db3c28073095e3f1701df867e46261c12c3d124..39a334c98962a64c1a5a6725a0cdec08872cea6a 100644 (file)
@@ -7105,7 +7105,7 @@ int SSL_get_wpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *desc)
 #endif
 }
 
-int SSL_want_net_read(SSL *s)
+int SSL_net_read_desired(SSL *s)
 {
 #ifndef OPENSSL_NO_QUIC
     QUIC_CONNECTION *qc = QUIC_CONNECTION_FROM_SSL(s);
@@ -7113,13 +7113,13 @@ int SSL_want_net_read(SSL *s)
     if (qc == NULL)
         return 0;
 
-    return ossl_quic_get_want_net_read(qc);
+    return ossl_quic_get_net_read_desired(qc);
 #else
     return 0;
 #endif
 }
 
-int SSL_want_net_write(SSL *s)
+int SSL_net_write_desired(SSL *s)
 {
 #ifndef OPENSSL_NO_QUIC
     QUIC_CONNECTION *qc = QUIC_CONNECTION_FROM_SSL(s);
@@ -7127,7 +7127,7 @@ int SSL_want_net_write(SSL *s)
     if (qc == NULL)
         return 0;
 
-    return ossl_quic_get_want_net_write(qc);
+    return ossl_quic_get_net_write_desired(qc);
 #else
     return 0;
 #endif
index 554c99619a45aa67552ef85dee4b9271168aab65..38535b11b00cf581f7b73b57963c47a31d6d2413 100644 (file)
@@ -536,8 +536,8 @@ SSL_tick                                ?   3_2_0   EXIST::FUNCTION:
 SSL_get_tick_timeout                    ?      3_2_0   EXIST::FUNCTION:
 SSL_get_rpoll_descriptor                ?      3_2_0   EXIST::FUNCTION:
 SSL_get_wpoll_descriptor                ?      3_2_0   EXIST::FUNCTION:
-SSL_want_net_read                       ?      3_2_0   EXIST::FUNCTION:
-SSL_want_net_write                      ?      3_2_0   EXIST::FUNCTION:
 SSL_set_blocking_mode                   ?      3_2_0   EXIST::FUNCTION:
 SSL_get_blocking_mode                   ?      3_2_0   EXIST::FUNCTION:
 SSL_set_initial_peer_addr               ?      3_2_0   EXIST::FUNCTION:
+SSL_net_read_desired                    ?      3_2_0   EXIST::FUNCTION:
+SSL_net_write_desired                   ?      3_2_0   EXIST::FUNCTION: