SSL_new_stream.pod 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. =pod
  2. =head1 NAME
  3. SSL_new_stream, SSL_STREAM_FLAG_UNI, SSL_STREAM_FLAG_NO_BLOCK,
  4. SSL_STREAM_FLAG_ADVANCE - create a new locally-initiated QUIC stream
  5. =head1 SYNOPSIS
  6. #include <openssl/ssl.h>
  7. #define SSL_STREAM_FLAG_UNI (1U << 0)
  8. #define SSL_STREAM_FLAG_NO_BLOCK (1U << 1)
  9. #define SSL_STREAM_FLAG_ADVANCE (1U << 2)
  10. SSL *SSL_new_stream(SSL *ssl, uint64_t flags);
  11. =head1 DESCRIPTION
  12. The SSL_new_stream() function, when passed a QUIC connection SSL object, creates
  13. a new locally-initiated bidirectional or unidirectional QUIC stream and returns
  14. the newly created QUIC stream SSL object.
  15. If the B<SSL_STREAM_FLAG_UNI> flag is passed, a unidirectional stream is
  16. created; else a bidirectional stream is created.
  17. To retrieve the stream ID of the newly created stream, use
  18. L<SSL_get_stream_id(3)>.
  19. It is the caller's responsibility to free the QUIC stream SSL object using
  20. L<SSL_free(3)>. The lifetime of the QUIC connection SSL object must exceed that
  21. of the QUIC stream SSL object; in other words, the QUIC stream SSL object must
  22. be freed first.
  23. Once a stream has been created using SSL_new_stream(), it may be used in the
  24. normal way using L<SSL_read(3)> and L<SSL_write(3)>.
  25. This function can only be used to create stream objects for locally-initiated
  26. streams. To accept incoming streams initiated by a peer, use
  27. L<SSL_accept_stream(3)>.
  28. Calling SSL_new_stream() if there is no default stream already present
  29. inhibits the future creation of a default stream. See L<openssl-quic(7)>.
  30. The creation of new streams is subject to flow control by the QUIC protocol. If
  31. it is currently not possible to create a new locally initiated stream of the
  32. specified type, a call to SSL_new_stream() will either block (if the connection
  33. is configured in blocking mode) until a new stream can be created, or otherwise
  34. return NULL.
  35. This function operates in blocking mode if the QUIC connection SSL object is
  36. configured in blocking mode (see L<SSL_set_blocking_mode(3)>). It may also be
  37. used in nonblocking mode on a connection configured in blocking mode by passing
  38. the flag B<SSL_STREAM_FLAG_NO_BLOCK>.
  39. The flag B<SSL_STREAM_FLAG_ADVANCE> may be used to create a QUIC stream SSL
  40. object even if a new QUIC stream cannot yet be opened due to flow control. The
  41. caller may begin to use the new stream and fill the write buffer of the stream
  42. by calling L<SSL_write(3)>. However, no actual stream data (or QUIC frames
  43. regarding the stream) will be sent until QUIC flow control allows it. Any queued
  44. data will be sent as soon as a peer permits it. There is no guarantee the stream
  45. will be eventually created; for example, the connection could fail, or a peer
  46. might simply decide never to increase the number of allowed streams for the
  47. remainder of the connection lifetime.
  48. =head1 RETURN VALUES
  49. SSL_new_stream() returns a new stream object, or NULL on error.
  50. This function fails if called on a QUIC stream SSL object or on a non-QUIC SSL
  51. object.
  52. =head1 SEE ALSO
  53. L<SSL_accept_stream(3)>, L<SSL_free(3)>
  54. =head1 HISTORY
  55. SSL_new_stream() was added in OpenSSL 3.2.
  56. =head1 COPYRIGHT
  57. Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.
  58. Licensed under the Apache License 2.0 (the "License"). You may not use
  59. this file except in compliance with the License. You can obtain a copy
  60. in the file LICENSE in the source distribution or at
  61. L<https://www.openssl.org/source/license.html>.
  62. =cut