| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- .\" -*- mode: troff; coding: utf-8 -*-
- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
- .\"
- .\" Standard preamble:
- .\" ========================================================================
- .de Sp \" Vertical space (when we can't use .PP)
- .if t .sp .5v
- .if n .sp
- ..
- .de Vb \" Begin verbatim text
- .ft CW
- .nf
- .ne \\$1
- ..
- .de Ve \" End verbatim text
- .ft R
- .fi
- ..
- .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
- .ie n \{\
- . ds C` ""
- . ds C' ""
- 'br\}
- .el\{\
- . ds C`
- . ds C'
- 'br\}
- .\"
- .\" Escape single quotes in literal strings from groff's Unicode transform.
- .ie \n(.g .ds Aq \(aq
- .el .ds Aq '
- .\"
- .\" If the F register is >0, we'll generate index entries on stderr for
- .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
- .\" entries marked with X<> in POD. Of course, you'll have to process the
- .\" output yourself in some meaningful fashion.
- .\"
- .\" Avoid warning from groff about undefined register 'F'.
- .de IX
- ..
- .nr rF 0
- .if \n(.g .if rF .nr rF 1
- .if (\n(rF:(\n(.g==0)) \{\
- . if \nF \{\
- . de IX
- . tm Index:\\$1\t\\n%\t"\\$2"
- ..
- . if !\nF==2 \{\
- . nr % 0
- . nr F 2
- . \}
- . \}
- .\}
- .rr rF
- .\" ========================================================================
- .\"
- .IX Title "BIO_CTRL 3ossl"
- .TH BIO_CTRL 3ossl 2025-01-17 3.4.0 OpenSSL
- .\" For nroff, turn off justification. Always turn off hyphenation; it makes
- .\" way too many mistakes in technical documents.
- .if n .ad l
- .nh
- .SH NAME
- BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset,
- BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close,
- BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending,
- BIO_get_info_callback, BIO_set_info_callback, BIO_info_cb, BIO_get_ktls_send,
- BIO_get_ktls_recv, BIO_set_conn_mode, BIO_get_conn_mode, BIO_set_tfo
- \&\- BIO control operations
- .SH SYNOPSIS
- .IX Header "SYNOPSIS"
- .Vb 1
- \& #include <openssl/bio.h>
- \&
- \& typedef int BIO_info_cb(BIO *b, int state, int res);
- \&
- \& long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);
- \& long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *cb);
- \& void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg);
- \& long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg);
- \&
- \& int BIO_reset(BIO *b);
- \& int BIO_seek(BIO *b, int ofs);
- \& int BIO_tell(BIO *b);
- \& int BIO_flush(BIO *b);
- \& int BIO_eof(BIO *b);
- \& int BIO_set_close(BIO *b, long flag);
- \& int BIO_get_close(BIO *b);
- \& int BIO_pending(BIO *b);
- \& int BIO_wpending(BIO *b);
- \& size_t BIO_ctrl_pending(BIO *b);
- \& size_t BIO_ctrl_wpending(BIO *b);
- \&
- \& int BIO_get_info_callback(BIO *b, BIO_info_cb **cbp);
- \& int BIO_set_info_callback(BIO *b, BIO_info_cb *cb);
- \&
- \& int BIO_get_ktls_send(BIO *b);
- \& int BIO_get_ktls_recv(BIO *b);
- \&
- \& int BIO_set_conn_mode(BIO *b, int mode);
- \& int BIO_get_conn_mode(BIO *b);
- \&
- \& int BIO_set_tfo(BIO *b, int onoff);
- .Ve
- .SH DESCRIPTION
- .IX Header "DESCRIPTION"
- \&\fBBIO_ctrl()\fR, \fBBIO_callback_ctrl()\fR, \fBBIO_ptr_ctrl()\fR and \fBBIO_int_ctrl()\fR
- are BIO "control" operations taking arguments of various types.
- These functions are not normally called directly, various macros
- are used instead. The standard macros are described below, macros
- specific to a particular type of BIO are described in the specific
- BIOs manual page as well as any special features of the standard
- calls.
- .PP
- \&\fBBIO_reset()\fR typically resets a BIO to some initial state, in the case
- of file related BIOs for example it rewinds the file pointer to the
- start of the file.
- .PP
- \&\fBBIO_seek()\fR resets a file related BIO's (that is file descriptor and
- FILE BIOs) file position pointer to \fBofs\fR bytes from start of file.
- .PP
- \&\fBBIO_tell()\fR returns the current file position of a file related BIO.
- .PP
- \&\fBBIO_flush()\fR normally writes out any internally buffered data, in some
- cases it is used to signal EOF and that no more data will be written.
- .PP
- \&\fBBIO_eof()\fR returns 1 if the BIO has read EOF, the precise meaning of
- "EOF" varies according to the BIO type.
- .PP
- \&\fBBIO_set_close()\fR sets the BIO \fBb\fR close flag to \fBflag\fR. \fBflag\fR can
- take the value BIO_CLOSE or BIO_NOCLOSE. Typically BIO_CLOSE is used
- in a source/sink BIO to indicate that the underlying I/O stream should
- be closed when the BIO is freed.
- .PP
- \&\fBBIO_get_close()\fR returns the BIOs close flag.
- .PP
- \&\fBBIO_pending()\fR, \fBBIO_ctrl_pending()\fR, \fBBIO_wpending()\fR and \fBBIO_ctrl_wpending()\fR
- return the number of pending characters in the BIOs read and write buffers.
- Not all BIOs support these calls. \fBBIO_ctrl_pending()\fR and \fBBIO_ctrl_wpending()\fR
- return a size_t type and are functions, \fBBIO_pending()\fR and \fBBIO_wpending()\fR are
- macros which call \fBBIO_ctrl()\fR.
- .PP
- \&\fBBIO_get_ktls_send()\fR returns 1 if the BIO is using the Kernel TLS data-path for
- sending. Otherwise, it returns zero.
- \&\fBBIO_get_ktls_recv()\fR returns 1 if the BIO is using the Kernel TLS data-path for
- receiving. Otherwise, it returns zero.
- .PP
- \&\fBBIO_get_conn_mode()\fR returns the BIO connection mode. \fBBIO_set_conn_mode()\fR sets
- the BIO connection mode.
- .PP
- \&\fBBIO_set_tfo()\fR disables TCP Fast Open when \fBonoff\fR is 0, and enables TCP Fast
- Open when \fBonoff\fR is nonzero. Setting the value to 1 is equivalent to setting
- \&\fBBIO_SOCK_TFO\fR in \fBBIO_set_conn_mode()\fR.
- .SH "RETURN VALUES"
- .IX Header "RETURN VALUES"
- \&\fBBIO_reset()\fR normally returns 1 for success and <=0 for failure. File
- BIOs are an exception, they return 0 for success and \-1 for failure.
- .PP
- \&\fBBIO_seek()\fR and \fBBIO_tell()\fR both return the current file position on success
- and \-1 for failure, except file BIOs which for \fBBIO_seek()\fR always return 0
- for success and \-1 for failure.
- .PP
- \&\fBBIO_flush()\fR returns 1 for success and <=0 for failure.
- .PP
- \&\fBBIO_eof()\fR returns 1 if EOF has been reached, 0 if not, or negative values for failure.
- .PP
- \&\fBBIO_set_close()\fR returns 1 on success or <=0 for failure.
- .PP
- \&\fBBIO_get_close()\fR returns the close flag value: BIO_CLOSE or BIO_NOCLOSE. It also
- returns other negative values if an error occurs.
- .PP
- \&\fBBIO_pending()\fR, \fBBIO_ctrl_pending()\fR, \fBBIO_wpending()\fR and \fBBIO_ctrl_wpending()\fR
- return the amount of pending data. \fBBIO_pending()\fR and \fBBIO_wpending()\fR return
- negative value or 0 on error. \fBBIO_ctrl_pending()\fR and \fBBIO_ctrl_wpending()\fR return
- 0 on error.
- .PP
- \&\fBBIO_get_ktls_send()\fR returns 1 if the BIO is using the Kernel TLS data-path for
- sending. Otherwise, it returns zero.
- \&\fBBIO_get_ktls_recv()\fR returns 1 if the BIO is using the Kernel TLS data-path for
- receiving. Otherwise, it returns zero.
- .PP
- \&\fBBIO_set_conn_mode()\fR returns 1 for success and 0 for failure. \fBBIO_get_conn_mode()\fR
- returns the current connection mode. Which may contain the bitwise-or of the
- following flags:
- .PP
- .Vb 6
- \& BIO_SOCK_REUSEADDR
- \& BIO_SOCK_V6_ONLY
- \& BIO_SOCK_KEEPALIVE
- \& BIO_SOCK_NONBLOCK
- \& BIO_SOCK_NODELAY
- \& BIO_SOCK_TFO
- .Ve
- .PP
- \&\fBBIO_set_tfo()\fR returns 1 for success, and 0 for failure.
- .SH NOTES
- .IX Header "NOTES"
- \&\fBBIO_flush()\fR, because it can write data may return 0 or \-1 indicating
- that the call should be retried later in a similar manner to \fBBIO_write_ex()\fR.
- The \fBBIO_should_retry()\fR call should be used and appropriate action taken
- is the call fails.
- .PP
- The return values of \fBBIO_pending()\fR and \fBBIO_wpending()\fR may not reliably
- determine the amount of pending data in all cases. For example in the
- case of a file BIO some data may be available in the FILE structures
- internal buffers but it is not possible to determine this in a
- portably way. For other types of BIO they may not be supported.
- .PP
- Filter BIOs if they do not internally handle a particular \fBBIO_ctrl()\fR
- operation usually pass the operation to the next BIO in the chain.
- This often means there is no need to locate the required BIO for
- a particular operation, it can be called on a chain and it will
- be automatically passed to the relevant BIO. However, this can cause
- unexpected results: for example no current filter BIOs implement
- \&\fBBIO_seek()\fR, but this may still succeed if the chain ends in a FILE
- or file descriptor BIO.
- .PP
- Source/sink BIOs return an 0 if they do not recognize the \fBBIO_ctrl()\fR
- operation.
- .SH BUGS
- .IX Header "BUGS"
- Some of the return values are ambiguous and care should be taken. In
- particular a return value of 0 can be returned if an operation is not
- supported, if an error occurred, if EOF has not been reached and in
- the case of \fBBIO_seek()\fR on a file BIO for a successful operation.
- .PP
- In older versions of OpenSSL the \fBBIO_ctrl_pending()\fR and
- \&\fBBIO_ctrl_wpending()\fR could return values greater than INT_MAX on error.
- .SH HISTORY
- .IX Header "HISTORY"
- The \fBBIO_get_ktls_send()\fR and \fBBIO_get_ktls_recv()\fR macros were added in
- OpenSSL 3.0. They were modified to never return \-1 in OpenSSL 3.0.4.
- .PP
- The \fBBIO_get_conn_mode()\fR, \fBBIO_set_conn_mode()\fR and \fBBIO_set_tfo()\fR functions
- were added in OpenSSL 3.2.
- .SH COPYRIGHT
- .IX Header "COPYRIGHT"
- Copyright 2000\-2022 The OpenSSL Project Authors. All Rights Reserved.
- .PP
- 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>.
|