import libcrypto (LibreSSL 2.5.2)
[unleashed.git] / lib / libcrypto / man / BIO_find_type.3
blobba1abc6ba47eca729b311a80f4edca970ba6b92b
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
3 .\"
4 .\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5 .\" Copyright (c) 2000, 2013, 2016 The OpenSSL Project.  All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\"
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\"
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
17 .\"    distribution.
18 .\"
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/)"
23 .\"
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.
28 .\"
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.
32 .\"
33 .\" 6. Redistributions of any form whatsoever must retain the following
34 .\"    acknowledgment:
35 .\"    "This product includes software developed by the OpenSSL Project
36 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37 .\"
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.
50 .\"
51 .Dd $Mdocdate: December 6 2016 $
52 .Dt BIO_FIND_TYPE 3
53 .Os
54 .Sh NAME
55 .Nm BIO_find_type ,
56 .Nm BIO_next ,
57 .Nm BIO_method_type
58 .Nd BIO chain traversal
59 .Sh SYNOPSIS
60 .In openssl/bio.h
61 .Ft BIO *
62 .Fo BIO_find_type
63 .Fa "BIO *b"
64 .Fa "int bio_type"
65 .Fc
66 .Ft BIO *
67 .Fo BIO_next
68 .Fa "BIO *b"
69 .Fc
70 .Ft int
71 .Fo BIO_method_type
72 .Fa "const BIO *b"
73 .Fc
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
96 .Sh DESCRIPTION
97 The function
98 .Fn BIO_find_type
99 searches for a BIO of a given type in a chain, starting at BIO
100 .Fa b .
102 .Fa bio_type
103 is a specific type (such as
104 .Dv BIO_TYPE_MEM ) ,
105 then a search is made for a BIO of that type.
107 .Fa bio_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.
111 .Fn BIO_find_type
112 returns the next matching BIO or
113 .Dv NULL
114 if none is found.
116 Note: not all the
117 .Dv BIO_TYPE_*
118 types above have corresponding BIO implementations.
120 .Fn BIO_next
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
123 .Fn BIO_find_type
124 to find all BIOs of a certain type.
126 .Fn BIO_method_type
127 returns the type of a BIO.
128 .Sh RETURN VALUES
129 .Fn BIO_find_type
130 returns a matching BIO or
131 .Dv NULL
132 for no match.
134 .Fn BIO_next
135 returns the next BIO in a chain.
137 .Fn BIO_method_type
138 returns the type of the BIO
139 .Fa b .
140 .Sh EXAMPLES
141 Traverse a chain looking for digest BIOs:
142 .Bd -literal -offset 2n
143 BIO *btmp;
144 btmp = in_bio;  /* in_bio is chain to search through */
146 do {
147         btmp = BIO_find_type(btmp, BIO_TYPE_MD);
148         if (btmp == NULL)
149                 break;  /* Not found */
150         /* btmp is a digest BIO, do something with it ...*/
151         ...
153         btmp = BIO_next(btmp);
154 } while(btmp);
156 .Sh SEE ALSO
157 .Xr BIO_new 3
158 .Sh BUGS
159 .Fn BIO_find_type
160 in OpenSSL 0.9.5a and earlier could not be safely passed a
161 .Dv NULL
162 pointer for the
163 .Fa b
164 argument.