1*4724848cSchristos=pod 2*4724848cSchristos 3*4724848cSchristos=head1 NAME 4*4724848cSchristos 5*4724848cSchristosbio - Basic I/O abstraction 6*4724848cSchristos 7*4724848cSchristos=head1 SYNOPSIS 8*4724848cSchristos 9*4724848cSchristos=for comment generic 10*4724848cSchristos 11*4724848cSchristos #include <openssl/bio.h> 12*4724848cSchristos 13*4724848cSchristos=head1 DESCRIPTION 14*4724848cSchristos 15*4724848cSchristosA BIO is an I/O abstraction, it hides many of the underlying I/O 16*4724848cSchristosdetails from an application. If an application uses a BIO for its 17*4724848cSchristosI/O it can transparently handle SSL connections, unencrypted network 18*4724848cSchristosconnections and file I/O. 19*4724848cSchristos 20*4724848cSchristosThere are two type of BIO, a source/sink BIO and a filter BIO. 21*4724848cSchristos 22*4724848cSchristosAs its name implies a source/sink BIO is a source and/or sink of data, 23*4724848cSchristosexamples include a socket BIO and a file BIO. 24*4724848cSchristos 25*4724848cSchristosA filter BIO takes data from one BIO and passes it through to 26*4724848cSchristosanother, or the application. The data may be left unmodified (for 27*4724848cSchristosexample a message digest BIO) or translated (for example an 28*4724848cSchristosencryption BIO). The effect of a filter BIO may change according 29*4724848cSchristosto the I/O operation it is performing: for example an encryption 30*4724848cSchristosBIO will encrypt data if it is being written to and decrypt data 31*4724848cSchristosif it is being read from. 32*4724848cSchristos 33*4724848cSchristosBIOs can be joined together to form a chain (a single BIO is a chain 34*4724848cSchristoswith one component). A chain normally consist of one source/sink 35*4724848cSchristosBIO and one or more filter BIOs. Data read from or written to the 36*4724848cSchristosfirst BIO then traverses the chain to the end (normally a source/sink 37*4724848cSchristosBIO). 38*4724848cSchristos 39*4724848cSchristos 40*4724848cSchristosSome BIOs (such as memory BIOs) can be used immediately after calling 41*4724848cSchristosBIO_new(). Others (such as file BIOs) need some additional initialization, 42*4724848cSchristosand frequently a utility function exists to create and initialize such BIOs. 43*4724848cSchristos 44*4724848cSchristosIf BIO_free() is called on a BIO chain it will only free one BIO resulting 45*4724848cSchristosin a memory leak. 46*4724848cSchristos 47*4724848cSchristosCalling BIO_free_all() on a single BIO has the same effect as calling 48*4724848cSchristosBIO_free() on it other than the discarded return value. 49*4724848cSchristos 50*4724848cSchristosNormally the B<type> argument is supplied by a function which returns a 51*4724848cSchristospointer to a BIO_METHOD. There is a naming convention for such functions: 52*4724848cSchristosa source/sink BIO is normally called BIO_s_*() and a filter BIO 53*4724848cSchristosBIO_f_*(); 54*4724848cSchristos 55*4724848cSchristos=head1 EXAMPLES 56*4724848cSchristos 57*4724848cSchristosCreate a memory BIO: 58*4724848cSchristos 59*4724848cSchristos BIO *mem = BIO_new(BIO_s_mem()); 60*4724848cSchristos 61*4724848cSchristos=head1 SEE ALSO 62*4724848cSchristos 63*4724848cSchristosL<BIO_ctrl(3)>, 64*4724848cSchristosL<BIO_f_base64(3)>, L<BIO_f_buffer(3)>, 65*4724848cSchristosL<BIO_f_cipher(3)>, L<BIO_f_md(3)>, 66*4724848cSchristosL<BIO_f_null(3)>, L<BIO_f_ssl(3)>, 67*4724848cSchristosL<BIO_find_type(3)>, L<BIO_new(3)>, 68*4724848cSchristosL<BIO_new_bio_pair(3)>, 69*4724848cSchristosL<BIO_push(3)>, L<BIO_read_ex(3)>, 70*4724848cSchristosL<BIO_s_accept(3)>, L<BIO_s_bio(3)>, 71*4724848cSchristosL<BIO_s_connect(3)>, L<BIO_s_fd(3)>, 72*4724848cSchristosL<BIO_s_file(3)>, L<BIO_s_mem(3)>, 73*4724848cSchristosL<BIO_s_null(3)>, L<BIO_s_socket(3)>, 74*4724848cSchristosL<BIO_set_callback(3)>, 75*4724848cSchristosL<BIO_should_retry(3)> 76*4724848cSchristos 77*4724848cSchristos=head1 COPYRIGHT 78*4724848cSchristos 79*4724848cSchristosCopyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved. 80*4724848cSchristos 81*4724848cSchristosLicensed under the OpenSSL license (the "License"). You may not use 82*4724848cSchristosthis file except in compliance with the License. You can obtain a copy 83*4724848cSchristosin the file LICENSE in the source distribution or at 84*4724848cSchristosL<https://www.openssl.org/source/license.html>. 85*4724848cSchristos 86*4724848cSchristos=cut 87*4724848cSchristos 88