]>
Commit | Line | Data |
---|---|---|
cfd3bb17 DSH |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
aafbe1cc | 5 | BIO_find_type, BIO_next, BIO_method_type - BIO chain traversal |
cfd3bb17 DSH |
6 | |
7 | =head1 SYNOPSIS | |
8 | ||
9 | #include <openssl/bio.h> | |
10 | ||
aebb9aac | 11 | BIO *BIO_find_type(BIO *b, int bio_type); |
91da5e77 RS |
12 | BIO *BIO_next(BIO *b); |
13 | int BIO_method_type(const BIO *b); | |
cfd3bb17 DSH |
14 | |
15 | =head1 DESCRIPTION | |
16 | ||
17 | The BIO_find_type() searches for a BIO of a given type in a chain, starting | |
91da5e77 | 18 | at BIO B<b>. If B<type> is a specific type (such as B<BIO_TYPE_MEM>) then a search |
cfd3bb17 DSH |
19 | is made for a BIO of that type. If B<type> is a general type (such as |
20 | B<BIO_TYPE_SOURCE_SINK>) then the next matching BIO of the given general type is | |
21 | searched for. BIO_find_type() returns the next matching BIO or NULL if none is | |
22 | found. | |
23 | ||
91da5e77 RS |
24 | The following general types are defined: |
25 | B<BIO_TYPE_DESCRIPTOR>, B<BIO_TYPE_FILTER>, and B<BIO_TYPE_SOURCE_SINK>. | |
26 | ||
aebb9aac | 27 | For a list of the specific types, see the B<openssl/bio.h> header file. |
cfd3bb17 DSH |
28 | |
29 | BIO_next() returns the next BIO in a chain. It can be used to traverse all BIOs | |
30 | in a chain or used in conjunction with BIO_find_type() to find all BIOs of a | |
31 | certain type. | |
32 | ||
33 | BIO_method_type() returns the type of a BIO. | |
34 | ||
35 | =head1 RETURN VALUES | |
36 | ||
37 | BIO_find_type() returns a matching BIO or NULL for no match. | |
38 | ||
39 | BIO_next() returns the next BIO in a chain. | |
40 | ||
41 | BIO_method_type() returns the type of the BIO B<b>. | |
42 | ||
cfd3bb17 DSH |
43 | =head1 EXAMPLE |
44 | ||
45 | Traverse a chain looking for digest BIOs: | |
46 | ||
47 | BIO *btmp; | |
cfd3bb17 | 48 | |
e9b77246 | 49 | btmp = in_bio; /* in_bio is chain to search through */ |
f50c11ca | 50 | do { |
2947af32 BB |
51 | btmp = BIO_find_type(btmp, BIO_TYPE_MD); |
52 | if (btmp == NULL) | |
53 | break; /* Not found */ | |
54 | /* btmp is a digest BIO, do something with it ...*/ | |
55 | ... | |
cfd3bb17 | 56 | |
2947af32 | 57 | btmp = BIO_next(btmp); |
2f8e53d7 | 58 | } while (btmp); |
cfd3bb17 DSH |
59 | |
60 | ||
e2f92610 RS |
61 | =head1 COPYRIGHT |
62 | ||
63 | Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. | |
64 | ||
4746f25a | 65 | Licensed under the Apache License 2.0 (the "License"). You may not use |
e2f92610 RS |
66 | this file except in compliance with the License. You can obtain a copy |
67 | in the file LICENSE in the source distribution or at | |
68 | L<https://www.openssl.org/source/license.html>. | |
69 | ||
70 | =cut |