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