SSL_get_value_uint.pod 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. =pod
  2. =head1 NAME
  3. SSL_get_value_uint, SSL_set_value_uint, SSL_get_generic_value_uint,
  4. SSL_set_generic_value_uint, SSL_get_feature_request_uint,
  5. SSL_set_feature_request_uint, SSL_get_feature_peer_request_uint,
  6. SSL_get_feature_negotiated_uint, SSL_get_quic_stream_bidi_local_avail,
  7. SSL_get_quic_stream_bidi_remote_avail, SSL_get_quic_stream_uni_local_avail,
  8. SSL_get_quic_stream_uni_remote_avail, SSL_VALUE_CLASS_GENERIC,
  9. SSL_VALUE_CLASS_FEATURE_REQUEST, SSL_VALUE_CLASS_FEATURE_PEER_REQUEST,
  10. SSL_VALUE_CLASS_FEATURE_NEGOTIATED, SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL,
  11. SSL_VALUE_QUIC_STREAM_BIDI_REMOTE_AVAIL, SSL_VALUE_QUIC_STREAM_UNI_LOCAL_AVAIL,
  12. SSL_VALUE_QUIC_STREAM_UNI_REMOTE_AVAIL, SSL_VALUE_QUIC_IDLE_TIMEOUT,
  13. SSL_VALUE_EVENT_HANDLING_MODE,
  14. SSL_VALUE_EVENT_HANDLING_MODE_INHERIT,
  15. SSL_VALUE_EVENT_HANDLING_MODE_EXPLICIT,
  16. SSL_VALUE_EVENT_HANDLING_MODE_IMPLICIT,
  17. SSL_get_event_handling_mode,
  18. SSL_set_event_handling_mode,
  19. SSL_VALUE_STREAM_WRITE_BUF_SIZE,
  20. SSL_get_stream_write_buf_size,
  21. SSL_VALUE_STREAM_WRITE_BUF_USED,
  22. SSL_get_stream_write_buf_used,
  23. SSL_VALUE_STREAM_WRITE_BUF_AVAIL,
  24. SSL_get_stream_write_buf_avail -
  25. manage negotiable features and configuration values for a SSL object
  26. =head1 SYNOPSIS
  27. #include <openssl/ssl.h>
  28. int SSL_get_value_uint(SSL *ssl, uint32_t class_, uint32_t id,
  29. uint64_t *value);
  30. int SSL_set_value_uint(SSL *ssl, uint32_t class_, uint32_t id,
  31. uint64_t value);
  32. #define SSL_VALUE_CLASS_GENERIC
  33. #define SSL_VALUE_CLASS_FEATURE_REQUEST
  34. #define SSL_VALUE_CLASS_FEATURE_PEER_REQUEST
  35. #define SSL_VALUE_CLASS_FEATURE_NEGOTIATED
  36. #define SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL
  37. #define SSL_VALUE_QUIC_STREAM_BIDI_REMOTE_AVAIL
  38. #define SSL_VALUE_QUIC_STREAM_UNI_LOCAL_AVAIL
  39. #define SSL_VALUE_QUIC_STREAM_UNI_REMOTE_AVAIL
  40. #define SSL_VALUE_QUIC_IDLE_TIMEOUT
  41. #define SSL_VALUE_EVENT_HANDLING_MODE
  42. #define SSL_VALUE_EVENT_HANDLING_MODE_INHERIT
  43. #define SSL_VALUE_EVENT_HANDLING_MODE_EXPLICIT
  44. #define SSL_VALUE_EVENT_HANDLING_MODE_IMPLICIT
  45. #define SSL_VALUE_STREAM_WRITE_BUF_SIZE
  46. #define SSL_VALUE_STREAM_WRITE_BUF_USED
  47. #define SSL_VALUE_STREAM_WRITE_BUF_AVAIL
  48. The following convenience macros can also be used:
  49. int SSL_get_generic_value_uint(SSL *ssl, uint32_t id, uint64_t *value);
  50. int SSL_set_generic_value_uint(SSL *ssl, uint32_t id, uint64_t value);
  51. int SSL_get_feature_request_uint(SSL *ssl, uint32_t id, uint64_t *value);
  52. int SSL_set_feature_request_uint(SSL *ssl, uint32_t id, uint64_t value);
  53. int SSL_get_feature_peer_request_uint(SSL *ssl, uint32_t id, uint64_t *value);
  54. int SSL_get_feature_negotiated_uint(SSL *ssl, uint32_t id, uint64_t *value);
  55. int SSL_get_quic_stream_bidi_local_avail(SSL *ssl, uint64_t *value);
  56. int SSL_get_quic_stream_bidi_remote_avail(SSL *ssl, uint64_t *value);
  57. int SSL_get_quic_stream_uni_local_avail(SSL *ssl, uint64_t *value);
  58. int SSL_get_quic_stream_uni_remote_avail(SSL *ssl, uint64_t *value);
  59. int SSL_get_event_handling_mode(SSL *ssl, uint64_t *value);
  60. int SSL_set_event_handling_mode(SSL *ssl, uint64_t value);
  61. int SSL_get_stream_write_buf_size(SSL *ssl, uint64_t *value);
  62. int SSL_get_stream_write_buf_avail(SSL *ssl, uint64_t *value);
  63. int SSL_get_stream_write_buf_used(SSL *ssl, uint64_t *value);
  64. =head1 DESCRIPTION
  65. SSL_get_value_uint() and SSL_set_value_uint() provide access to configurable
  66. parameters for a given SSL object. Amongst other things, they are used to
  67. provide control over the feature negotiation process during establishment of a
  68. connection, and access to statistics about that connection.
  69. SSL_get_value_uint() and SSL_set_value_uint() get and set configurable values
  70. within a given value class. The value classes are enumerated by
  71. B<SSL_VALUE_CLASS> and are as follows:
  72. =over 4
  73. =item B<SSL_VALUE_CLASS_GENERIC>
  74. Values in this class do not participate in the feature negotiation process. They
  75. may represent connection parameters which do not participate in explicit
  76. negotiation or provide connection statistics. Values in this class might be
  77. read-write or read-only.
  78. You can access values in this class using the convenience macros
  79. SSL_get_generic_value_uint() and SSL_set_generic_value_uint() for brevity.
  80. =item B<SSL_VALUE_CLASS_FEATURE_REQUEST>
  81. Values in this class are read-write, and represent what the local party is
  82. requesting during feature negotiation. Such a request will not necessarily be
  83. honoured; see B<SSL_VALUE_CLASS_FEATURE_NEGOTIATED>.
  84. A value in this class may become read-only in certain circumstances; for
  85. example, after a connection has been established, for a value which cannot be
  86. renegotiated after connection establishment. Setting a value in this class after
  87. connection establishment represents a request for online renegotiation of the
  88. specified feature.
  89. You can access values in this class using the convenience macros
  90. SSL_get_feature_request_uint() and SSL_set_feature_request_uint() for brevity.
  91. =item B<SSL_VALUE_CLASS_FEATURE_PEER_REQUEST>
  92. Values in this value class are read-only, and represent what was requested by a
  93. peer during feature negotiation. Such a request has not necessarily been
  94. honoured; see B<SSL_VALUE_CLASS_FEATURE_NEGOTIATED>.
  95. You can access values in this class using the convenience macro
  96. SSL_get_feature_peer_request_uint() for brevity.
  97. =item B<SSL_VALUE_CLASS_FEATURE_NEGOTIATED>
  98. Values in this value class are read-only, and represent the value which was
  99. actually negotiated based on both local and peer input during feature
  100. negotiation. This is the effective value in actual use.
  101. Attempting to read a value in this class will generally fail if the feature
  102. negotiation process has not yet completed and the value is therefore currently
  103. unknown, unless the nature of the feature in question causes a provisional value
  104. to be used prior to completion of feature negotiation, in which case that value
  105. may be returned. If an online (post-handshake) renegotiation of a feature is
  106. in progress, retrieving the negotiated value will continue to retrieve the
  107. previous negotiated value until that process is completed. See the documentation
  108. of specific values for full details of its behaviour.
  109. You can access values in this class using the convenience macro
  110. SSL_get_feature_negotiated_uint() for brevity.
  111. =back
  112. =head1 CONFIGURABLE VALUES FOR QUIC OBJECTS
  113. The following configurable values are supported for QUIC SSL objects. Whether a
  114. value is supported for a QUIC connection SSL object or a QUIC stream SSL object
  115. is indicated in the heading for each value. Values supported for QUIC stream SSL
  116. objects are also supported on QUIC connection SSL objects if they have a default
  117. stream attached.
  118. SSL_get_value() does not cause internal event processing to occur unless the
  119. documentation for a specific value specifies otherwise.
  120. =over 4
  121. =item B<SSL_VALUE_QUIC_IDLE_TIMEOUT> (connection object)
  122. Negotiated feature value. This configures the desired QUIC idle timeout in
  123. milliseconds, where 0 represents a lack of an idle timeout. This feature can
  124. only be configured prior to connection establishment and cannot be subsequently
  125. changed.
  126. This release of OpenSSL uses a default value of 30 seconds. This default value
  127. may change between releases of OpenSSL.
  128. =item B<SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL> (connection object)
  129. Generic read-only statistical value. The number of bidirectional,
  130. locally-initiated streams available to be created (but not yet created). For
  131. example, a value of 100 would mean that L<SSL_new_stream(3)> could be called 100
  132. times to create 100 bidirectional streams before L<SSL_new_stream(3)> would
  133. block or fail due to backpressure.
  134. Can be queried using the convenience macro
  135. SSL_get_quic_stream_bidi_local_avail().
  136. =item B<SSL_VALUE_QUIC_STREAM_UNI_LOCAL_AVAIL> (connection object)
  137. As above, but provides the number of unidirectional, locally-initiated streams
  138. available to be created (but not yet created).
  139. Can be queried using the convenience macro
  140. SSL_get_quic_stream_uni_local_avail().
  141. =item B<SSL_VALUE_QUIC_STREAM_BIDI_REMOTE_AVAIL> (connection object)
  142. As above, but provides the number of bidirectional, remotely-initiated streams
  143. available to be created (but not yet created) by the peer. This represents the
  144. number of streams the local endpoint has authorised the peer to create in terms
  145. of QUIC stream creation flow control.
  146. Can be queried using the convenience macro
  147. SSL_get_quic_stream_bidi_remote_avail().
  148. =item B<SSL_VALUE_QUIC_STREAM_UNI_REMOTE_AVAIL> (connection object)
  149. As above, but provides the number of unidirectional, remotely-initiated streams
  150. available to be created (but not yet created).
  151. Can be queried using the convenience macro
  152. SSL_get_quic_stream_uni_remote_avail().
  153. =item B<SSL_VALUE_EVENT_HANDLING_MODE> (connection or stream object)
  154. Generic value. This is an integer value which takes one of the following values,
  155. and determines the event handling mode in use:
  156. =over 4
  157. =item B<SSL_VALUE_EVENT_HANDLING_MODE_INHERIT>
  158. When set, the event handling mode used is inherited from the value set on the
  159. parent connection (for a stream), or, for a connection, defaults to the implicit
  160. event handling model.
  161. When a new connection is created, or a new stream is created or accepted, it
  162. defaults to this setting.
  163. =item B<SSL_VALUE_EVENT_HANDLING_MODE_IMPLICIT> (Implicit event handling)
  164. If set to this value, the implicit event handling model is used. Under this
  165. model, QUIC objects will automatically perform background event processing
  166. (equivalent to a call to L<SSL_handle_events(3)>) when calls to I/O functions
  167. such as L<SSL_read_ex(3)> or L<SSL_write_ex(3)> are made on a QUIC SSL object.
  168. This helps to maintain the health of the QUIC connection and ensures that
  169. incoming datagrams and timeout events are processed.
  170. =item B<SSL_VALUE_EVENT_HANDLING_MODE_EXPLICIT> (Explicit event handling)
  171. If set to this value, the explicit event handling model is used. Under this
  172. model, B<nonblocking> calls to I/O functions such as L<SSL_read_ex(3)> or
  173. L<SSL_write_ex(3)> do not result in the automatic processing of QUIC events. Any
  174. new incoming network traffic is not handled; no new outgoing network traffic is
  175. generated, and pending timeout events are not processed. This allows an
  176. application to obtain greater control over the circumstances in which QUIC event
  177. processing occurs. If this event handling model is used, it is the application's
  178. responsibility to call L<SSL_handle_events(3)> as and when called for by the
  179. QUIC implementation; see the L<SSL_get_rpoll_descriptor(3)> man page for more
  180. information.
  181. Selecting this model does not affect the operation of blocking I/O calls, which
  182. will continue to use the implicit event handling model. Therefore, applications
  183. using this model will generally want to disable blocking operation using
  184. L<SSL_set_blocking_mode(3)>.
  185. =back
  186. Can be configured using the convenience macros SSL_get_event_handling_mode() and
  187. SSL_set_event_handling_mode().
  188. A call to SSL_set_value_uint() which causes this value to switch back to the
  189. implicit event handling model does not in itself cause implicit event handling
  190. to occur; such handling will occur on the next I/O API call. Equally, a call to
  191. SSL_set_value_uint() which causes this value to switch to the explicit event
  192. handling model will not cause event handling to occur before making that
  193. transition.
  194. This value controls whether implicit event handling occurs when making an I/O
  195. API call on the SSL object it is set on. However, event processing is not
  196. confined to state which relates to only that object. For example, if you
  197. configure explicit event handling on QUIC stream SSL object "A" and configure
  198. implicit event handling on QUIC stream SSL object "B", a call to an I/O function
  199. on "B" may result in state changes to "A". In other words, if event handling
  200. does happen as a result of an API call to an object related to a connection,
  201. processing of background events (for example, received QUIC network traffic) may
  202. also affect the state of any other object related to a connection.
  203. =item B<SSL_VALUE_STREAM_WRITE_BUF_SIZE> (stream object)
  204. Generic read-only statistical value. The size of the write buffer allocated to
  205. hold data written to a stream with L<SSL_write_ex(3)> until it is transmitted
  206. and subsequently acknowledged by the peer. This value may change at any time, as
  207. buffer sizes are optimised in response to network conditions to optimise
  208. throughput.
  209. Can be queried using the convenience macro SSL_get_stream_write_buf_size().
  210. =item B<SSL_VALUE_STREAM_WRITE_BUF_USED> (stream object)
  211. Generic read-only statistical value. The number of bytes currently consumed
  212. in the write buffer which have yet to be acknowledged by the peer. Successful
  213. calls to L<SSL_write_ex(3)> which accept data cause this number to increase.
  214. This number will then decrease as data is acknowledged by the peer.
  215. Can be queried using the convenience macro SSL_get_stream_write_buf_used().
  216. =item B<SSL_VALUE_STREAM_WRITE_BUF_AVAIL> (stream object)
  217. Generic read-only statistical value. The number of bytes available in the write
  218. buffer which have yet to be consumed by calls to L<SSL_write_ex(3)>. Successful
  219. calls to L<SSL_write_ex(3)> which accept data cause this number to decrease.
  220. This number will increase as data is acknowledged by the peer. It may also
  221. change if the buffer is resized automatically to optimise throughput.
  222. Can be queried using the convenience macro SSL_get_stream_write_buf_avail().
  223. =back
  224. No configurable values are currently defined for non-QUIC SSL objects.
  225. =head1 RETURN VALUES
  226. Returns 1 on success or 0 on failure. This function can fail for a number of
  227. reasons:
  228. =over 4
  229. =item
  230. An argument is invalid (e.g. NULL pointer or invalid class).
  231. =item
  232. The given value is not supported by the SSL object on which it was called.
  233. =item
  234. The given operation (get or set) is not supported by the specified
  235. configurable value.
  236. =item
  237. You are trying to modify the given value and the value is not modifiable at this
  238. time.
  239. =back
  240. =head1 SEE ALSO
  241. L<SSL_ctrl(3)>, L<SSL_get_accept_stream_queue_len(3)>,
  242. L<SSL_get_stream_read_state(3)>, L<SSL_get_stream_write_state(3)>,
  243. L<SSL_get_stream_read_error_code(3)>, L<SSL_get_stream_write_error_code(3)>,
  244. L<SSL_set_default_stream_mode(3)>, L<SSL_set_incoming_stream_policy(3)>
  245. =head1 HISTORY
  246. These functions were added in OpenSSL 3.3.
  247. =head1 COPYRIGHT
  248. Copyright 2002-2024 The OpenSSL Project Authors. All Rights Reserved.
  249. Licensed under the Apache License 2.0 (the "License"). You may not use
  250. this file except in compliance with the License. You can obtain a copy
  251. in the file LICENSE in the source distribution or at
  252. L<https://www.openssl.org/source/license.html>.
  253. =cut