1 .\" $OpenBSD: BIO_find_type.3,v 1.6 2016/12/06 14:45:08 schwarze Exp $
2 .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
4 .\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5 .\" Copyright (c) 2000, 2013, 2016 The OpenSSL Project. All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in
16 .\" the documentation and/or other materials provided with the
19 .\" 3. All advertising materials mentioning features or use of this
20 .\" software must display the following acknowledgment:
21 .\" "This product includes software developed by the OpenSSL Project
22 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25 .\" endorse or promote products derived from this software without
26 .\" prior written permission. For written permission, please contact
27 .\" openssl-core@openssl.org.
29 .\" 5. Products derived from this software may not be called "OpenSSL"
30 .\" nor may "OpenSSL" appear in their names without prior written
31 .\" permission of the OpenSSL Project.
33 .\" 6. Redistributions of any form whatsoever must retain the following
35 .\" "This product includes software developed by the OpenSSL Project
36 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
51 .Dd $Mdocdate: December 6 2016 $
58 .Nd BIO chain traversal
74 .Fd #define BIO_TYPE_NONE 0
75 .Fd #define BIO_TYPE_MEM (1|0x0400)
76 .Fd #define BIO_TYPE_FILE (2|0x0400)
77 .Fd #define BIO_TYPE_FD (4|0x0400|0x0100)
78 .Fd #define BIO_TYPE_SOCKET (5|0x0400|0x0100)
79 .Fd #define BIO_TYPE_NULL (6|0x0400)
80 .Fd #define BIO_TYPE_SSL (7|0x0200)
81 .Fd #define BIO_TYPE_MD (8|0x0200)
82 .Fd #define BIO_TYPE_BUFFER (9|0x0200)
83 .Fd #define BIO_TYPE_CIPHER (10|0x0200)
84 .Fd #define BIO_TYPE_BASE64 (11|0x0200)
85 .Fd #define BIO_TYPE_CONNECT (12|0x0400|0x0100)
86 .Fd #define BIO_TYPE_ACCEPT (13|0x0400|0x0100)
87 .Fd #define BIO_TYPE_PROXY_CLIENT (14|0x0200)
88 .Fd #define BIO_TYPE_PROXY_SERVER (15|0x0200)
89 .Fd #define BIO_TYPE_NBIO_TEST (16|0x0200)
90 .Fd #define BIO_TYPE_NULL_FILTER (17|0x0200)
91 .Fd #define BIO_TYPE_BER (18|0x0200)
92 .Fd #define BIO_TYPE_BIO (19|0x0400)
93 .Fd #define BIO_TYPE_DESCRIPTOR 0x0100
94 .Fd #define BIO_TYPE_FILTER 0x0200
95 .Fd #define BIO_TYPE_SOURCE_SINK 0x0400
99 searches for a BIO of a given type in a chain, starting at BIO
103 is a specific type (such as
105 then a search is made for a BIO of that type.
108 is a general type (such as
109 .Dv BIO_TYPE_SOURCE_SINK ) ,
110 then the next matching BIO of the given general type is searched for.
112 returns the next matching BIO or
118 types above have corresponding BIO implementations.
121 returns the next BIO in a chain.
122 It can be used to traverse all BIOs in a chain or used in conjunction with
124 to find all BIOs of a certain type.
127 returns the type of a BIO.
130 returns a matching BIO or
135 returns the next BIO in a chain.
138 returns the type of the BIO
141 Traverse a chain looking for digest BIOs:
142 .Bd -literal -offset 2n
144 btmp = in_bio; /* in_bio is chain to search through */
147 btmp = BIO_find_type(btmp, BIO_TYPE_MD);
149 break; /* Not found */
150 /* btmp is a digest BIO, do something with it ...*/
153 btmp = BIO_next(btmp);
160 in OpenSSL 0.9.5a and earlier could not be safely passed a