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