RT2964: Fix it via doc
[oweals/openssl.git] / doc / crypto / BIO_find_type.pod
1 =pod
2
3 =head1 NAME
4
5 BIO_TYPE_NONE, BIO_TYPE_MEM, BIO_TYPE_FILE, BIO_TYPE_FD, BIO_TYPE_SOCKET,
6 BIO_TYPE_NULL, BIO_TYPE_SSL, BIO_TYPE_MD, BIO_TYPE_BUFFER, BIO_TYPE_CIPHER,
7 BIO_TYPE_BASE64, BIO_TYPE_CONNECT, BIO_TYPE_ACCEPT, BIO_TYPE_PROXY_CLIENT,
8 BIO_TYPE_PROXY_SERVER, BIO_TYPE_NBIO_TEST, BIO_TYPE_NULL_FILTER,
9 BIO_TYPE_BER, BIO_TYPE_BIO, BIO_TYPE_DESCRIPTOR, BIO_TYPE_FILTER,
10 BIO_TYPE_SOURCE_SINK,
11 BIO_find_type, BIO_next, BIO_method_type - BIO chain traversal
12
13 =head1 SYNOPSIS
14
15  #include <openssl/bio.h>
16
17  BIO *  BIO_find_type(BIO *b,int bio_type);
18  BIO *  BIO_next(BIO *b);
19
20  #define BIO_method_type(b)             ((b)->method->type)
21
22  #define BIO_TYPE_NONE          0
23  #define BIO_TYPE_MEM           (1|0x0400)
24  #define BIO_TYPE_FILE          (2|0x0400)
25
26  #define BIO_TYPE_FD            (4|0x0400|0x0100)
27  #define BIO_TYPE_SOCKET                (5|0x0400|0x0100)
28  #define BIO_TYPE_NULL          (6|0x0400)
29  #define BIO_TYPE_SSL           (7|0x0200)
30  #define BIO_TYPE_MD            (8|0x0200)
31  #define BIO_TYPE_BUFFER                (9|0x0200)
32  #define BIO_TYPE_CIPHER                (10|0x0200)
33  #define BIO_TYPE_BASE64                (11|0x0200)
34  #define BIO_TYPE_CONNECT       (12|0x0400|0x0100)
35  #define BIO_TYPE_ACCEPT                (13|0x0400|0x0100)
36  #define BIO_TYPE_PROXY_CLIENT  (14|0x0200)
37  #define BIO_TYPE_PROXY_SERVER  (15|0x0200)
38  #define BIO_TYPE_NBIO_TEST     (16|0x0200)
39  #define BIO_TYPE_NULL_FILTER   (17|0x0200)
40  #define BIO_TYPE_BER           (18|0x0200)
41  #define BIO_TYPE_BIO           (19|0x0400)
42
43  #define BIO_TYPE_DESCRIPTOR    0x0100
44  #define BIO_TYPE_FILTER                0x0200
45  #define BIO_TYPE_SOURCE_SINK   0x0400
46
47 =head1 DESCRIPTION
48
49 The BIO_find_type() searches for a BIO of a given type in a chain, starting
50 at BIO B<b>. If B<type> is a specific type (such as BIO_TYPE_MEM) then a search
51 is made for a BIO of that type. If B<type> is a general type (such as
52 B<BIO_TYPE_SOURCE_SINK>) then the next matching BIO of the given general type is
53 searched for. BIO_find_type() returns the next matching BIO or NULL if none is
54 found.
55
56 Note: not all the B<BIO_TYPE_*> types above have corresponding BIO implementations.
57
58 BIO_next() returns the next BIO in a chain. It can be used to traverse all BIOs
59 in a chain or used in conjunction with BIO_find_type() to find all BIOs of a
60 certain type.
61
62 BIO_method_type() returns the type of a BIO.
63
64 =head1 RETURN VALUES
65
66 BIO_find_type() returns a matching BIO or NULL for no match.
67
68 BIO_next() returns the next BIO in a chain.
69
70 BIO_method_type() returns the type of the BIO B<b>.
71
72 =head1 EXAMPLE
73
74 Traverse a chain looking for digest BIOs:
75
76  BIO *btmp;
77  btmp = in_bio; /* in_bio is chain to search through */
78
79  do {
80         btmp = BIO_find_type(btmp, BIO_TYPE_MD);
81         if(btmp == NULL) break; /* Not found */
82         /* btmp is a digest BIO, do something with it ...*/
83         ...
84
85         btmp = BIO_next(btmp);
86  } while(btmp);
87
88
89 =head1 COPYRIGHT
90
91 Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
92
93 Licensed under the OpenSSL license (the "License").  You may not use
94 this file except in compliance with the License.  You can obtain a copy
95 in the file LICENSE in the source distribution or at
96 L<https://www.openssl.org/source/license.html>.
97
98 =cut