SSL_get_value_uint.3ossl 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "SSL_GET_VALUE_UINT 3ossl"
  58. .TH SSL_GET_VALUE_UINT 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. SSL_get_value_uint, SSL_set_value_uint, SSL_get_generic_value_uint,
  65. SSL_set_generic_value_uint, SSL_get_feature_request_uint,
  66. SSL_set_feature_request_uint, SSL_get_feature_peer_request_uint,
  67. SSL_get_feature_negotiated_uint, SSL_get_quic_stream_bidi_local_avail,
  68. SSL_get_quic_stream_bidi_remote_avail, SSL_get_quic_stream_uni_local_avail,
  69. SSL_get_quic_stream_uni_remote_avail, SSL_VALUE_CLASS_GENERIC,
  70. SSL_VALUE_CLASS_FEATURE_REQUEST, SSL_VALUE_CLASS_FEATURE_PEER_REQUEST,
  71. SSL_VALUE_CLASS_FEATURE_NEGOTIATED, SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL,
  72. SSL_VALUE_QUIC_STREAM_BIDI_REMOTE_AVAIL, SSL_VALUE_QUIC_STREAM_UNI_LOCAL_AVAIL,
  73. SSL_VALUE_QUIC_STREAM_UNI_REMOTE_AVAIL, SSL_VALUE_QUIC_IDLE_TIMEOUT,
  74. SSL_VALUE_EVENT_HANDLING_MODE,
  75. SSL_VALUE_EVENT_HANDLING_MODE_INHERIT,
  76. SSL_VALUE_EVENT_HANDLING_MODE_EXPLICIT,
  77. SSL_VALUE_EVENT_HANDLING_MODE_IMPLICIT,
  78. SSL_get_event_handling_mode,
  79. SSL_set_event_handling_mode,
  80. SSL_VALUE_STREAM_WRITE_BUF_SIZE,
  81. SSL_get_stream_write_buf_size,
  82. SSL_VALUE_STREAM_WRITE_BUF_USED,
  83. SSL_get_stream_write_buf_used,
  84. SSL_VALUE_STREAM_WRITE_BUF_AVAIL,
  85. SSL_get_stream_write_buf_avail \-
  86. manage negotiable features and configuration values for a SSL object
  87. .SH SYNOPSIS
  88. .IX Header "SYNOPSIS"
  89. .Vb 1
  90. \& #include <openssl/ssl.h>
  91. \&
  92. \& int SSL_get_value_uint(SSL *ssl, uint32_t class_, uint32_t id,
  93. \& uint64_t *value);
  94. \& int SSL_set_value_uint(SSL *ssl, uint32_t class_, uint32_t id,
  95. \& uint64_t value);
  96. \&
  97. \& #define SSL_VALUE_CLASS_GENERIC
  98. \& #define SSL_VALUE_CLASS_FEATURE_REQUEST
  99. \& #define SSL_VALUE_CLASS_FEATURE_PEER_REQUEST
  100. \& #define SSL_VALUE_CLASS_FEATURE_NEGOTIATED
  101. \&
  102. \& #define SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL
  103. \& #define SSL_VALUE_QUIC_STREAM_BIDI_REMOTE_AVAIL
  104. \& #define SSL_VALUE_QUIC_STREAM_UNI_LOCAL_AVAIL
  105. \& #define SSL_VALUE_QUIC_STREAM_UNI_REMOTE_AVAIL
  106. \& #define SSL_VALUE_QUIC_IDLE_TIMEOUT
  107. \&
  108. \& #define SSL_VALUE_EVENT_HANDLING_MODE
  109. \& #define SSL_VALUE_EVENT_HANDLING_MODE_INHERIT
  110. \& #define SSL_VALUE_EVENT_HANDLING_MODE_EXPLICIT
  111. \& #define SSL_VALUE_EVENT_HANDLING_MODE_IMPLICIT
  112. \&
  113. \& #define SSL_VALUE_STREAM_WRITE_BUF_SIZE
  114. \& #define SSL_VALUE_STREAM_WRITE_BUF_USED
  115. \& #define SSL_VALUE_STREAM_WRITE_BUF_AVAIL
  116. .Ve
  117. .PP
  118. The following convenience macros can also be used:
  119. .PP
  120. .Vb 2
  121. \& int SSL_get_generic_value_uint(SSL *ssl, uint32_t id, uint64_t *value);
  122. \& int SSL_set_generic_value_uint(SSL *ssl, uint32_t id, uint64_t value);
  123. \&
  124. \& int SSL_get_feature_request_uint(SSL *ssl, uint32_t id, uint64_t *value);
  125. \& int SSL_set_feature_request_uint(SSL *ssl, uint32_t id, uint64_t value);
  126. \&
  127. \& int SSL_get_feature_peer_request_uint(SSL *ssl, uint32_t id, uint64_t *value);
  128. \& int SSL_get_feature_negotiated_uint(SSL *ssl, uint32_t id, uint64_t *value);
  129. \&
  130. \& int SSL_get_quic_stream_bidi_local_avail(SSL *ssl, uint64_t *value);
  131. \& int SSL_get_quic_stream_bidi_remote_avail(SSL *ssl, uint64_t *value);
  132. \& int SSL_get_quic_stream_uni_local_avail(SSL *ssl, uint64_t *value);
  133. \& int SSL_get_quic_stream_uni_remote_avail(SSL *ssl, uint64_t *value);
  134. \&
  135. \& int SSL_get_event_handling_mode(SSL *ssl, uint64_t *value);
  136. \& int SSL_set_event_handling_mode(SSL *ssl, uint64_t value);
  137. \&
  138. \& int SSL_get_stream_write_buf_size(SSL *ssl, uint64_t *value);
  139. \& int SSL_get_stream_write_buf_avail(SSL *ssl, uint64_t *value);
  140. \& int SSL_get_stream_write_buf_used(SSL *ssl, uint64_t *value);
  141. .Ve
  142. .SH DESCRIPTION
  143. .IX Header "DESCRIPTION"
  144. \&\fBSSL_get_value_uint()\fR and \fBSSL_set_value_uint()\fR provide access to configurable
  145. parameters for a given SSL object. Amongst other things, they are used to
  146. provide control over the feature negotiation process during establishment of a
  147. connection, and access to statistics about that connection.
  148. .PP
  149. \&\fBSSL_get_value_uint()\fR and \fBSSL_set_value_uint()\fR get and set configurable values
  150. within a given value class. The value classes are enumerated by
  151. \&\fBSSL_VALUE_CLASS\fR and are as follows:
  152. .IP \fBSSL_VALUE_CLASS_GENERIC\fR 4
  153. .IX Item "SSL_VALUE_CLASS_GENERIC"
  154. Values in this class do not participate in the feature negotiation process. They
  155. may represent connection parameters which do not participate in explicit
  156. negotiation or provide connection statistics. Values in this class might be
  157. read-write or read-only.
  158. .Sp
  159. You can access values in this class using the convenience macros
  160. \&\fBSSL_get_generic_value_uint()\fR and \fBSSL_set_generic_value_uint()\fR for brevity.
  161. .IP \fBSSL_VALUE_CLASS_FEATURE_REQUEST\fR 4
  162. .IX Item "SSL_VALUE_CLASS_FEATURE_REQUEST"
  163. Values in this class are read-write, and represent what the local party is
  164. requesting during feature negotiation. Such a request will not necessarily be
  165. honoured; see \fBSSL_VALUE_CLASS_FEATURE_NEGOTIATED\fR.
  166. .Sp
  167. A value in this class may become read-only in certain circumstances; for
  168. example, after a connection has been established, for a value which cannot be
  169. renegotiated after connection establishment. Setting a value in this class after
  170. connection establishment represents a request for online renegotiation of the
  171. specified feature.
  172. .Sp
  173. You can access values in this class using the convenience macros
  174. \&\fBSSL_get_feature_request_uint()\fR and \fBSSL_set_feature_request_uint()\fR for brevity.
  175. .IP \fBSSL_VALUE_CLASS_FEATURE_PEER_REQUEST\fR 4
  176. .IX Item "SSL_VALUE_CLASS_FEATURE_PEER_REQUEST"
  177. Values in this value class are read-only, and represent what was requested by a
  178. peer during feature negotiation. Such a request has not necessarily been
  179. honoured; see \fBSSL_VALUE_CLASS_FEATURE_NEGOTIATED\fR.
  180. .Sp
  181. You can access values in this class using the convenience macro
  182. \&\fBSSL_get_feature_peer_request_uint()\fR for brevity.
  183. .IP \fBSSL_VALUE_CLASS_FEATURE_NEGOTIATED\fR 4
  184. .IX Item "SSL_VALUE_CLASS_FEATURE_NEGOTIATED"
  185. Values in this value class are read-only, and represent the value which was
  186. actually negotiated based on both local and peer input during feature
  187. negotiation. This is the effective value in actual use.
  188. .Sp
  189. Attempting to read a value in this class will generally fail if the feature
  190. negotiation process has not yet completed and the value is therefore currently
  191. unknown, unless the nature of the feature in question causes a provisional value
  192. to be used prior to completion of feature negotiation, in which case that value
  193. may be returned. If an online (post-handshake) renegotiation of a feature is
  194. in progress, retrieving the negotiated value will continue to retrieve the
  195. previous negotiated value until that process is completed. See the documentation
  196. of specific values for full details of its behaviour.
  197. .Sp
  198. You can access values in this class using the convenience macro
  199. \&\fBSSL_get_feature_negotiated_uint()\fR for brevity.
  200. .SH "CONFIGURABLE VALUES FOR QUIC OBJECTS"
  201. .IX Header "CONFIGURABLE VALUES FOR QUIC OBJECTS"
  202. The following configurable values are supported for QUIC SSL objects. Whether a
  203. value is supported for a QUIC connection SSL object or a QUIC stream SSL object
  204. is indicated in the heading for each value. Values supported for QUIC stream SSL
  205. objects are also supported on QUIC connection SSL objects if they have a default
  206. stream attached.
  207. .PP
  208. \&\fBSSL_get_value()\fR does not cause internal event processing to occur unless the
  209. documentation for a specific value specifies otherwise.
  210. .IP "\fBSSL_VALUE_QUIC_IDLE_TIMEOUT\fR (connection object)" 4
  211. .IX Item "SSL_VALUE_QUIC_IDLE_TIMEOUT (connection object)"
  212. Negotiated feature value. This configures the desired QUIC idle timeout in
  213. milliseconds, where 0 represents a lack of an idle timeout. This feature can
  214. only be configured prior to connection establishment and cannot be subsequently
  215. changed.
  216. .Sp
  217. This release of OpenSSL uses a default value of 30 seconds. This default value
  218. may change between releases of OpenSSL.
  219. .IP "\fBSSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL\fR (connection object)" 4
  220. .IX Item "SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL (connection object)"
  221. Generic read-only statistical value. The number of bidirectional,
  222. locally-initiated streams available to be created (but not yet created). For
  223. example, a value of 100 would mean that \fBSSL_new_stream\fR\|(3) could be called 100
  224. times to create 100 bidirectional streams before \fBSSL_new_stream\fR\|(3) would
  225. block or fail due to backpressure.
  226. .Sp
  227. Can be queried using the convenience macro
  228. \&\fBSSL_get_quic_stream_bidi_local_avail()\fR.
  229. .IP "\fBSSL_VALUE_QUIC_STREAM_UNI_LOCAL_AVAIL\fR (connection object)" 4
  230. .IX Item "SSL_VALUE_QUIC_STREAM_UNI_LOCAL_AVAIL (connection object)"
  231. As above, but provides the number of unidirectional, locally-initiated streams
  232. available to be created (but not yet created).
  233. .Sp
  234. Can be queried using the convenience macro
  235. \&\fBSSL_get_quic_stream_uni_local_avail()\fR.
  236. .IP "\fBSSL_VALUE_QUIC_STREAM_BIDI_REMOTE_AVAIL\fR (connection object)" 4
  237. .IX Item "SSL_VALUE_QUIC_STREAM_BIDI_REMOTE_AVAIL (connection object)"
  238. As above, but provides the number of bidirectional, remotely-initiated streams
  239. available to be created (but not yet created) by the peer. This represents the
  240. number of streams the local endpoint has authorised the peer to create in terms
  241. of QUIC stream creation flow control.
  242. .Sp
  243. Can be queried using the convenience macro
  244. \&\fBSSL_get_quic_stream_bidi_remote_avail()\fR.
  245. .IP "\fBSSL_VALUE_QUIC_STREAM_UNI_REMOTE_AVAIL\fR (connection object)" 4
  246. .IX Item "SSL_VALUE_QUIC_STREAM_UNI_REMOTE_AVAIL (connection object)"
  247. As above, but provides the number of unidirectional, remotely-initiated streams
  248. available to be created (but not yet created).
  249. .Sp
  250. Can be queried using the convenience macro
  251. \&\fBSSL_get_quic_stream_uni_remote_avail()\fR.
  252. .IP "\fBSSL_VALUE_EVENT_HANDLING_MODE\fR (connection or stream object)" 4
  253. .IX Item "SSL_VALUE_EVENT_HANDLING_MODE (connection or stream object)"
  254. Generic value. This is an integer value which takes one of the following values,
  255. and determines the event handling mode in use:
  256. .RS 4
  257. .IP \fBSSL_VALUE_EVENT_HANDLING_MODE_INHERIT\fR 4
  258. .IX Item "SSL_VALUE_EVENT_HANDLING_MODE_INHERIT"
  259. When set, the event handling mode used is inherited from the value set on the
  260. parent connection (for a stream), or, for a connection, defaults to the implicit
  261. event handling model.
  262. .Sp
  263. When a new connection is created, or a new stream is created or accepted, it
  264. defaults to this setting.
  265. .IP "\fBSSL_VALUE_EVENT_HANDLING_MODE_IMPLICIT\fR (Implicit event handling)" 4
  266. .IX Item "SSL_VALUE_EVENT_HANDLING_MODE_IMPLICIT (Implicit event handling)"
  267. If set to this value, the implicit event handling model is used. Under this
  268. model, QUIC objects will automatically perform background event processing
  269. (equivalent to a call to \fBSSL_handle_events\fR\|(3)) when calls to I/O functions
  270. such as \fBSSL_read_ex\fR\|(3) or \fBSSL_write_ex\fR\|(3) are made on a QUIC SSL object.
  271. This helps to maintain the health of the QUIC connection and ensures that
  272. incoming datagrams and timeout events are processed.
  273. .IP "\fBSSL_VALUE_EVENT_HANDLING_MODE_EXPLICIT\fR (Explicit event handling)" 4
  274. .IX Item "SSL_VALUE_EVENT_HANDLING_MODE_EXPLICIT (Explicit event handling)"
  275. If set to this value, the explicit event handling model is used. Under this
  276. model, \fBnonblocking\fR calls to I/O functions such as \fBSSL_read_ex\fR\|(3) or
  277. \&\fBSSL_write_ex\fR\|(3) do not result in the automatic processing of QUIC events. Any
  278. new incoming network traffic is not handled; no new outgoing network traffic is
  279. generated, and pending timeout events are not processed. This allows an
  280. application to obtain greater control over the circumstances in which QUIC event
  281. processing occurs. If this event handling model is used, it is the application's
  282. responsibility to call \fBSSL_handle_events\fR\|(3) as and when called for by the
  283. QUIC implementation; see the \fBSSL_get_rpoll_descriptor\fR\|(3) man page for more
  284. information.
  285. .Sp
  286. Selecting this model does not affect the operation of blocking I/O calls, which
  287. will continue to use the implicit event handling model. Therefore, applications
  288. using this model will generally want to disable blocking operation using
  289. \&\fBSSL_set_blocking_mode\fR\|(3).
  290. .RE
  291. .RS 4
  292. .Sp
  293. Can be configured using the convenience macros \fBSSL_get_event_handling_mode()\fR and
  294. \&\fBSSL_set_event_handling_mode()\fR.
  295. .Sp
  296. A call to \fBSSL_set_value_uint()\fR which causes this value to switch back to the
  297. implicit event handling model does not in itself cause implicit event handling
  298. to occur; such handling will occur on the next I/O API call. Equally, a call to
  299. \&\fBSSL_set_value_uint()\fR which causes this value to switch to the explicit event
  300. handling model will not cause event handling to occur before making that
  301. transition.
  302. .Sp
  303. This value controls whether implicit event handling occurs when making an I/O
  304. API call on the SSL object it is set on. However, event processing is not
  305. confined to state which relates to only that object. For example, if you
  306. configure explicit event handling on QUIC stream SSL object "A" and configure
  307. implicit event handling on QUIC stream SSL object "B", a call to an I/O function
  308. on "B" may result in state changes to "A". In other words, if event handling
  309. does happen as a result of an API call to an object related to a connection,
  310. processing of background events (for example, received QUIC network traffic) may
  311. also affect the state of any other object related to a connection.
  312. .RE
  313. .IP "\fBSSL_VALUE_STREAM_WRITE_BUF_SIZE\fR (stream object)" 4
  314. .IX Item "SSL_VALUE_STREAM_WRITE_BUF_SIZE (stream object)"
  315. Generic read-only statistical value. The size of the write buffer allocated to
  316. hold data written to a stream with \fBSSL_write_ex\fR\|(3) until it is transmitted
  317. and subsequently acknowledged by the peer. This value may change at any time, as
  318. buffer sizes are optimised in response to network conditions to optimise
  319. throughput.
  320. .Sp
  321. Can be queried using the convenience macro \fBSSL_get_stream_write_buf_size()\fR.
  322. .IP "\fBSSL_VALUE_STREAM_WRITE_BUF_USED\fR (stream object)" 4
  323. .IX Item "SSL_VALUE_STREAM_WRITE_BUF_USED (stream object)"
  324. Generic read-only statistical value. The number of bytes currently consumed
  325. in the write buffer which have yet to be acknowledged by the peer. Successful
  326. calls to \fBSSL_write_ex\fR\|(3) which accept data cause this number to increase.
  327. This number will then decrease as data is acknowledged by the peer.
  328. .Sp
  329. Can be queried using the convenience macro \fBSSL_get_stream_write_buf_used()\fR.
  330. .IP "\fBSSL_VALUE_STREAM_WRITE_BUF_AVAIL\fR (stream object)" 4
  331. .IX Item "SSL_VALUE_STREAM_WRITE_BUF_AVAIL (stream object)"
  332. Generic read-only statistical value. The number of bytes available in the write
  333. buffer which have yet to be consumed by calls to \fBSSL_write_ex\fR\|(3). Successful
  334. calls to \fBSSL_write_ex\fR\|(3) which accept data cause this number to decrease.
  335. This number will increase as data is acknowledged by the peer. It may also
  336. change if the buffer is resized automatically to optimise throughput.
  337. .Sp
  338. Can be queried using the convenience macro \fBSSL_get_stream_write_buf_avail()\fR.
  339. .PP
  340. No configurable values are currently defined for non-QUIC SSL objects.
  341. .SH "RETURN VALUES"
  342. .IX Header "RETURN VALUES"
  343. Returns 1 on success or 0 on failure. This function can fail for a number of
  344. reasons:
  345. .IP \(bu 4
  346. An argument is invalid (e.g. NULL pointer or invalid class).
  347. .IP \(bu 4
  348. The given value is not supported by the SSL object on which it was called.
  349. .IP \(bu 4
  350. The given operation (get or set) is not supported by the specified
  351. configurable value.
  352. .IP \(bu 4
  353. You are trying to modify the given value and the value is not modifiable at this
  354. time.
  355. .SH "SEE ALSO"
  356. .IX Header "SEE ALSO"
  357. \&\fBSSL_ctrl\fR\|(3), \fBSSL_get_accept_stream_queue_len\fR\|(3),
  358. \&\fBSSL_get_stream_read_state\fR\|(3), \fBSSL_get_stream_write_state\fR\|(3),
  359. \&\fBSSL_get_stream_read_error_code\fR\|(3), \fBSSL_get_stream_write_error_code\fR\|(3),
  360. \&\fBSSL_set_default_stream_mode\fR\|(3), \fBSSL_set_incoming_stream_policy\fR\|(3)
  361. .SH HISTORY
  362. .IX Header "HISTORY"
  363. These functions were added in OpenSSL 3.3.
  364. .SH COPYRIGHT
  365. .IX Header "COPYRIGHT"
  366. Copyright 2002\-2024 The OpenSSL Project Authors. All Rights Reserved.
  367. .PP
  368. Licensed under the Apache License 2.0 (the "License"). You may not use
  369. this file except in compliance with the License. You can obtain a copy
  370. in the file LICENSE in the source distribution or at
  371. <https://www.openssl.org/source/license.html>.