xref: /netbsd-src/crypto/external/bsd/openssl.old/dist/doc/man3/BIO_new.pod (revision 4724848cf0da353df257f730694b7882798e5daf)
1*4724848cSchristos=pod
2*4724848cSchristos
3*4724848cSchristos=head1 NAME
4*4724848cSchristos
5*4724848cSchristosBIO_new, BIO_up_ref, BIO_free, BIO_vfree, BIO_free_all
6*4724848cSchristos- BIO allocation and freeing functions
7*4724848cSchristos
8*4724848cSchristos=head1 SYNOPSIS
9*4724848cSchristos
10*4724848cSchristos #include <openssl/bio.h>
11*4724848cSchristos
12*4724848cSchristos BIO *  BIO_new(const BIO_METHOD *type);
13*4724848cSchristos int    BIO_up_ref(BIO *a);
14*4724848cSchristos int    BIO_free(BIO *a);
15*4724848cSchristos void   BIO_vfree(BIO *a);
16*4724848cSchristos void   BIO_free_all(BIO *a);
17*4724848cSchristos
18*4724848cSchristos=head1 DESCRIPTION
19*4724848cSchristos
20*4724848cSchristosThe BIO_new() function returns a new BIO using method B<type>.
21*4724848cSchristos
22*4724848cSchristosBIO_up_ref() increments the reference count associated with the BIO object.
23*4724848cSchristos
24*4724848cSchristosBIO_free() frees up a single BIO, BIO_vfree() also frees up a single BIO
25*4724848cSchristosbut it does not return a value.
26*4724848cSchristosIf B<a> is NULL nothing is done.
27*4724848cSchristosCalling BIO_free() may also have some effect
28*4724848cSchristoson the underlying I/O structure, for example it may close the file being
29*4724848cSchristosreferred to under certain circumstances. For more details see the individual
30*4724848cSchristosBIO_METHOD descriptions.
31*4724848cSchristos
32*4724848cSchristosBIO_free_all() frees up an entire BIO chain, it does not halt if an error
33*4724848cSchristosoccurs freeing up an individual BIO in the chain.
34*4724848cSchristosIf B<a> is NULL nothing is done.
35*4724848cSchristos
36*4724848cSchristos=head1 RETURN VALUES
37*4724848cSchristos
38*4724848cSchristosBIO_new() returns a newly created BIO or NULL if the call fails.
39*4724848cSchristos
40*4724848cSchristosBIO_up_ref() and BIO_free() return 1 for success and 0 for failure.
41*4724848cSchristos
42*4724848cSchristosBIO_free_all() and BIO_vfree() do not return values.
43*4724848cSchristos
44*4724848cSchristos=head1 NOTES
45*4724848cSchristos
46*4724848cSchristosIf BIO_free() is called on a BIO chain it will only free one BIO resulting
47*4724848cSchristosin a memory leak.
48*4724848cSchristos
49*4724848cSchristosCalling BIO_free_all() on a single BIO has the same effect as calling BIO_free()
50*4724848cSchristoson it other than the discarded return value.
51*4724848cSchristos
52*4724848cSchristos=head1 HISTORY
53*4724848cSchristos
54*4724848cSchristosBIO_set() was removed in OpenSSL 1.1.0 as BIO type is now opaque.
55*4724848cSchristos
56*4724848cSchristos=head1 EXAMPLES
57*4724848cSchristos
58*4724848cSchristosCreate a memory BIO:
59*4724848cSchristos
60*4724848cSchristos BIO *mem = BIO_new(BIO_s_mem());
61*4724848cSchristos
62*4724848cSchristos=head1 COPYRIGHT
63*4724848cSchristos
64*4724848cSchristosCopyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
65*4724848cSchristos
66*4724848cSchristosLicensed under the OpenSSL license (the "License").  You may not use
67*4724848cSchristosthis file except in compliance with the License.  You can obtain a copy
68*4724848cSchristosin the file LICENSE in the source distribution or at
69*4724848cSchristosL<https://www.openssl.org/source/license.html>.
70*4724848cSchristos
71*4724848cSchristos=cut
72