xref: /minix3/crypto/external/bsd/openssl/dist/crypto/bio/bio.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1ebfedea0SLionel Sambuc /* crypto/bio/bio.h */
2ebfedea0SLionel Sambuc /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3ebfedea0SLionel Sambuc  * All rights reserved.
4ebfedea0SLionel Sambuc  *
5ebfedea0SLionel Sambuc  * This package is an SSL implementation written
6ebfedea0SLionel Sambuc  * by Eric Young (eay@cryptsoft.com).
7ebfedea0SLionel Sambuc  * The implementation was written so as to conform with Netscapes SSL.
8ebfedea0SLionel Sambuc  *
9ebfedea0SLionel Sambuc  * This library is free for commercial and non-commercial use as long as
10ebfedea0SLionel Sambuc  * the following conditions are aheared to.  The following conditions
11ebfedea0SLionel Sambuc  * apply to all code found in this distribution, be it the RC4, RSA,
12ebfedea0SLionel Sambuc  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
13ebfedea0SLionel Sambuc  * included with this distribution is covered by the same copyright terms
14ebfedea0SLionel Sambuc  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15ebfedea0SLionel Sambuc  *
16ebfedea0SLionel Sambuc  * Copyright remains Eric Young's, and as such any Copyright notices in
17ebfedea0SLionel Sambuc  * the code are not to be removed.
18ebfedea0SLionel Sambuc  * If this package is used in a product, Eric Young should be given attribution
19ebfedea0SLionel Sambuc  * as the author of the parts of the library used.
20ebfedea0SLionel Sambuc  * This can be in the form of a textual message at program startup or
21ebfedea0SLionel Sambuc  * in documentation (online or textual) provided with the package.
22ebfedea0SLionel Sambuc  *
23ebfedea0SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
24ebfedea0SLionel Sambuc  * modification, are permitted provided that the following conditions
25ebfedea0SLionel Sambuc  * are met:
26ebfedea0SLionel Sambuc  * 1. Redistributions of source code must retain the copyright
27ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
28ebfedea0SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
29ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
30ebfedea0SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
31ebfedea0SLionel Sambuc  * 3. All advertising materials mentioning features or use of this software
32ebfedea0SLionel Sambuc  *    must display the following acknowledgement:
33ebfedea0SLionel Sambuc  *    "This product includes cryptographic software written by
34ebfedea0SLionel Sambuc  *     Eric Young (eay@cryptsoft.com)"
35ebfedea0SLionel Sambuc  *    The word 'cryptographic' can be left out if the rouines from the library
36ebfedea0SLionel Sambuc  *    being used are not cryptographic related :-).
37ebfedea0SLionel Sambuc  * 4. If you include any Windows specific code (or a derivative thereof) from
38ebfedea0SLionel Sambuc  *    the apps directory (application code) you must include an acknowledgement:
39ebfedea0SLionel Sambuc  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40ebfedea0SLionel Sambuc  *
41ebfedea0SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42ebfedea0SLionel Sambuc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43ebfedea0SLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44ebfedea0SLionel Sambuc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45ebfedea0SLionel Sambuc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46ebfedea0SLionel Sambuc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47ebfedea0SLionel Sambuc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48ebfedea0SLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49ebfedea0SLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50ebfedea0SLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51ebfedea0SLionel Sambuc  * SUCH DAMAGE.
52ebfedea0SLionel Sambuc  *
53ebfedea0SLionel Sambuc  * The licence and distribution terms for any publically available version or
54ebfedea0SLionel Sambuc  * derivative of this code cannot be changed.  i.e. this code cannot simply be
55ebfedea0SLionel Sambuc  * copied and put under another distribution licence
56ebfedea0SLionel Sambuc  * [including the GNU Public Licence.]
57ebfedea0SLionel Sambuc  */
58ebfedea0SLionel Sambuc 
59ebfedea0SLionel Sambuc #ifndef HEADER_BIO_H
60ebfedea0SLionel Sambuc # define HEADER_BIO_H
61ebfedea0SLionel Sambuc 
62ebfedea0SLionel Sambuc # include <openssl/e_os2.h>
63ebfedea0SLionel Sambuc 
64ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_FP_API
65ebfedea0SLionel Sambuc #  include <stdio.h>
66ebfedea0SLionel Sambuc # endif
67ebfedea0SLionel Sambuc # include <stdarg.h>
68ebfedea0SLionel Sambuc 
69ebfedea0SLionel Sambuc # include <openssl/crypto.h>
70ebfedea0SLionel Sambuc 
71ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_SCTP
72ebfedea0SLionel Sambuc #  ifndef OPENSSL_SYS_VMS
73ebfedea0SLionel Sambuc #   include <stdint.h>
74ebfedea0SLionel Sambuc #  else
75ebfedea0SLionel Sambuc #   include <inttypes.h>
76ebfedea0SLionel Sambuc #  endif
77ebfedea0SLionel Sambuc # endif
78ebfedea0SLionel Sambuc 
79ebfedea0SLionel Sambuc #ifdef  __cplusplus
80ebfedea0SLionel Sambuc extern "C" {
81ebfedea0SLionel Sambuc #endif
82ebfedea0SLionel Sambuc 
83ebfedea0SLionel Sambuc /* These are the 'types' of BIOs */
84ebfedea0SLionel Sambuc # define BIO_TYPE_NONE           0
85ebfedea0SLionel Sambuc # define BIO_TYPE_MEM            (1|0x0400)
86ebfedea0SLionel Sambuc # define BIO_TYPE_FILE           (2|0x0400)
87ebfedea0SLionel Sambuc 
88ebfedea0SLionel Sambuc # define BIO_TYPE_FD             (4|0x0400|0x0100)
89ebfedea0SLionel Sambuc # define BIO_TYPE_SOCKET         (5|0x0400|0x0100)
90ebfedea0SLionel Sambuc # define BIO_TYPE_NULL           (6|0x0400)
91ebfedea0SLionel Sambuc # define BIO_TYPE_SSL            (7|0x0200)
92ebfedea0SLionel Sambuc # define BIO_TYPE_MD             (8|0x0200)/* passive filter */
93ebfedea0SLionel Sambuc # define BIO_TYPE_BUFFER         (9|0x0200)/* filter */
94ebfedea0SLionel Sambuc # define BIO_TYPE_CIPHER         (10|0x0200)/* filter */
95ebfedea0SLionel Sambuc # define BIO_TYPE_BASE64         (11|0x0200)/* filter */
96ebfedea0SLionel Sambuc # define BIO_TYPE_CONNECT        (12|0x0400|0x0100)/* socket - connect */
97ebfedea0SLionel Sambuc # define BIO_TYPE_ACCEPT         (13|0x0400|0x0100)/* socket for accept */
98ebfedea0SLionel Sambuc # define BIO_TYPE_PROXY_CLIENT   (14|0x0200)/* client proxy BIO */
99ebfedea0SLionel Sambuc # define BIO_TYPE_PROXY_SERVER   (15|0x0200)/* server proxy BIO */
100ebfedea0SLionel Sambuc # define BIO_TYPE_NBIO_TEST      (16|0x0200)/* server proxy BIO */
101ebfedea0SLionel Sambuc # define BIO_TYPE_NULL_FILTER    (17|0x0200)
102ebfedea0SLionel Sambuc # define BIO_TYPE_BER            (18|0x0200)/* BER -> bin filter */
103ebfedea0SLionel Sambuc # define BIO_TYPE_BIO            (19|0x0400)/* (half a) BIO pair */
104ebfedea0SLionel Sambuc # define BIO_TYPE_LINEBUFFER     (20|0x0200)/* filter */
105ebfedea0SLionel Sambuc # define BIO_TYPE_DGRAM          (21|0x0400|0x0100)
106ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_SCTP
107ebfedea0SLionel Sambuc #  define BIO_TYPE_DGRAM_SCTP     (24|0x0400|0x0100)
108ebfedea0SLionel Sambuc # endif
109ebfedea0SLionel Sambuc # define BIO_TYPE_ASN1           (22|0x0200)/* filter */
110ebfedea0SLionel Sambuc # define BIO_TYPE_COMP           (23|0x0200)/* filter */
111ebfedea0SLionel Sambuc 
112ebfedea0SLionel Sambuc # define BIO_TYPE_DESCRIPTOR     0x0100/* socket, fd, connect or accept */
113ebfedea0SLionel Sambuc # define BIO_TYPE_FILTER         0x0200
114ebfedea0SLionel Sambuc # define BIO_TYPE_SOURCE_SINK    0x0400
115ebfedea0SLionel Sambuc 
116*0a6a1f1dSLionel Sambuc /*
117*0a6a1f1dSLionel Sambuc  * BIO_FILENAME_READ|BIO_CLOSE to open or close on free.
118*0a6a1f1dSLionel Sambuc  * BIO_set_fp(in,stdin,BIO_NOCLOSE);
119*0a6a1f1dSLionel Sambuc  */
120ebfedea0SLionel Sambuc # define BIO_NOCLOSE             0x00
121ebfedea0SLionel Sambuc # define BIO_CLOSE               0x01
122ebfedea0SLionel Sambuc 
123*0a6a1f1dSLionel Sambuc /*
124*0a6a1f1dSLionel Sambuc  * These are used in the following macros and are passed to BIO_ctrl()
125*0a6a1f1dSLionel Sambuc  */
126ebfedea0SLionel Sambuc # define BIO_CTRL_RESET          1/* opt - rewind/zero etc */
127ebfedea0SLionel Sambuc # define BIO_CTRL_EOF            2/* opt - are we at the eof */
128ebfedea0SLionel Sambuc # define BIO_CTRL_INFO           3/* opt - extra tit-bits */
129ebfedea0SLionel Sambuc # define BIO_CTRL_SET            4/* man - set the 'IO' type */
130ebfedea0SLionel Sambuc # define BIO_CTRL_GET            5/* man - get the 'IO' type */
131ebfedea0SLionel Sambuc # define BIO_CTRL_PUSH           6/* opt - internal, used to signify change */
132ebfedea0SLionel Sambuc # define BIO_CTRL_POP            7/* opt - internal, used to signify change */
133ebfedea0SLionel Sambuc # define BIO_CTRL_GET_CLOSE      8/* man - set the 'close' on free */
134ebfedea0SLionel Sambuc # define BIO_CTRL_SET_CLOSE      9/* man - set the 'close' on free */
135ebfedea0SLionel Sambuc # define BIO_CTRL_PENDING        10/* opt - is their more data buffered */
136ebfedea0SLionel Sambuc # define BIO_CTRL_FLUSH          11/* opt - 'flush' buffered output */
137ebfedea0SLionel Sambuc # define BIO_CTRL_DUP            12/* man - extra stuff for 'duped' BIO */
138ebfedea0SLionel Sambuc # define BIO_CTRL_WPENDING       13/* opt - number of bytes still to write */
139ebfedea0SLionel Sambuc /* callback is int cb(BIO *bio,state,ret); */
140ebfedea0SLionel Sambuc # define BIO_CTRL_SET_CALLBACK   14/* opt - set callback function */
141ebfedea0SLionel Sambuc # define BIO_CTRL_GET_CALLBACK   15/* opt - set callback function */
142ebfedea0SLionel Sambuc 
143ebfedea0SLionel Sambuc # define BIO_CTRL_SET_FILENAME   30/* BIO_s_file special */
144ebfedea0SLionel Sambuc 
145ebfedea0SLionel Sambuc /* dgram BIO stuff */
146ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_CONNECT       31/* BIO dgram special */
147*0a6a1f1dSLionel Sambuc # define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected
148*0a6a1f1dSLionel Sambuc                                          * socket to be passed in */
149ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */
150ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */
151ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */
152ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */
153ebfedea0SLionel Sambuc 
154ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */
155ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */
156ebfedea0SLionel Sambuc 
157ebfedea0SLionel Sambuc /* #ifdef IP_MTU_DISCOVER */
158ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_MTU_DISCOVER       39/* set DF bit on egress packets */
159ebfedea0SLionel Sambuc /* #endif */
160ebfedea0SLionel Sambuc 
161ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_QUERY_MTU          40/* as kernel for current MTU */
162ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_GET_FALLBACK_MTU   47
163ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_GET_MTU            41/* get cached value for MTU */
164*0a6a1f1dSLionel Sambuc # define BIO_CTRL_DGRAM_SET_MTU            42/* set cached value for MTU.
165*0a6a1f1dSLionel Sambuc                                               * want to use this if asking
166*0a6a1f1dSLionel Sambuc                                               * the kernel fails */
167ebfedea0SLionel Sambuc 
168*0a6a1f1dSLionel Sambuc # define BIO_CTRL_DGRAM_MTU_EXCEEDED       43/* check whether the MTU was
169*0a6a1f1dSLionel Sambuc                                               * exceed in the previous write
170ebfedea0SLionel Sambuc                                               * operation */
171ebfedea0SLionel Sambuc 
172ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_GET_PEER           46
173ebfedea0SLionel Sambuc # define BIO_CTRL_DGRAM_SET_PEER           44/* Destination for the data */
174ebfedea0SLionel Sambuc 
175*0a6a1f1dSLionel Sambuc # define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT   45/* Next DTLS handshake timeout
176*0a6a1f1dSLionel Sambuc                                               * to adjust socket timeouts */
177*0a6a1f1dSLionel Sambuc 
178*0a6a1f1dSLionel Sambuc # define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD   49
179ebfedea0SLionel Sambuc 
180ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_SCTP
181ebfedea0SLionel Sambuc /* SCTP stuff */
182ebfedea0SLionel Sambuc #  define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE    50
183ebfedea0SLionel Sambuc #  define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY                51
184ebfedea0SLionel Sambuc #  define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY               52
185ebfedea0SLionel Sambuc #  define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD               53
186ebfedea0SLionel Sambuc #  define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO         60
187ebfedea0SLionel Sambuc #  define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO         61
188ebfedea0SLionel Sambuc #  define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO         62
189ebfedea0SLionel Sambuc #  define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO         63
190ebfedea0SLionel Sambuc #  define BIO_CTRL_DGRAM_SCTP_GET_PRINFO                  64
191ebfedea0SLionel Sambuc #  define BIO_CTRL_DGRAM_SCTP_SET_PRINFO                  65
192ebfedea0SLionel Sambuc #  define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN               70
193ebfedea0SLionel Sambuc # endif
194ebfedea0SLionel Sambuc 
195ebfedea0SLionel Sambuc /* modifiers */
196ebfedea0SLionel Sambuc # define BIO_FP_READ             0x02
197ebfedea0SLionel Sambuc # define BIO_FP_WRITE            0x04
198ebfedea0SLionel Sambuc # define BIO_FP_APPEND           0x08
199ebfedea0SLionel Sambuc # define BIO_FP_TEXT             0x10
200ebfedea0SLionel Sambuc 
201ebfedea0SLionel Sambuc # define BIO_FLAGS_READ          0x01
202ebfedea0SLionel Sambuc # define BIO_FLAGS_WRITE         0x02
203ebfedea0SLionel Sambuc # define BIO_FLAGS_IO_SPECIAL    0x04
204ebfedea0SLionel Sambuc # define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
205ebfedea0SLionel Sambuc # define BIO_FLAGS_SHOULD_RETRY  0x08
206ebfedea0SLionel Sambuc # ifndef BIO_FLAGS_UPLINK
207*0a6a1f1dSLionel Sambuc /*
208*0a6a1f1dSLionel Sambuc  * "UPLINK" flag denotes file descriptors provided by application. It
209*0a6a1f1dSLionel Sambuc  * defaults to 0, as most platforms don't require UPLINK interface.
210*0a6a1f1dSLionel Sambuc  */
211ebfedea0SLionel Sambuc #  define BIO_FLAGS_UPLINK        0
212ebfedea0SLionel Sambuc # endif
213ebfedea0SLionel Sambuc 
214ebfedea0SLionel Sambuc /* Used in BIO_gethostbyname() */
215ebfedea0SLionel Sambuc # define BIO_GHBN_CTRL_HITS              1
216ebfedea0SLionel Sambuc # define BIO_GHBN_CTRL_MISSES            2
217ebfedea0SLionel Sambuc # define BIO_GHBN_CTRL_CACHE_SIZE        3
218ebfedea0SLionel Sambuc # define BIO_GHBN_CTRL_GET_ENTRY         4
219ebfedea0SLionel Sambuc # define BIO_GHBN_CTRL_FLUSH             5
220ebfedea0SLionel Sambuc 
221ebfedea0SLionel Sambuc /* Mostly used in the SSL BIO */
222*0a6a1f1dSLionel Sambuc /*-
223*0a6a1f1dSLionel Sambuc  * Not used anymore
224ebfedea0SLionel Sambuc  * #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10
225ebfedea0SLionel Sambuc  * #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20
226ebfedea0SLionel Sambuc  * #define BIO_FLAGS_PROTOCOL_STARTUP   0x40
227ebfedea0SLionel Sambuc  */
228ebfedea0SLionel Sambuc 
229ebfedea0SLionel Sambuc # define BIO_FLAGS_BASE64_NO_NL  0x100
230ebfedea0SLionel Sambuc 
231*0a6a1f1dSLionel Sambuc /*
232*0a6a1f1dSLionel Sambuc  * This is used with memory BIOs: it means we shouldn't free up or change the
233ebfedea0SLionel Sambuc  * data in any way.
234ebfedea0SLionel Sambuc  */
235ebfedea0SLionel Sambuc # define BIO_FLAGS_MEM_RDONLY    0x200
236ebfedea0SLionel Sambuc 
237ebfedea0SLionel Sambuc typedef struct bio_st BIO;
238ebfedea0SLionel Sambuc 
239ebfedea0SLionel Sambuc void BIO_set_flags(BIO *b, int flags);
240ebfedea0SLionel Sambuc int BIO_test_flags(const BIO *b, int flags);
241ebfedea0SLionel Sambuc void BIO_clear_flags(BIO *b, int flags);
242ebfedea0SLionel Sambuc 
243ebfedea0SLionel Sambuc # define BIO_get_flags(b) BIO_test_flags(b, ~(0x0))
244ebfedea0SLionel Sambuc # define BIO_set_retry_special(b) \
245ebfedea0SLionel Sambuc                 BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY))
246ebfedea0SLionel Sambuc # define BIO_set_retry_read(b) \
247ebfedea0SLionel Sambuc                 BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
248ebfedea0SLionel Sambuc # define BIO_set_retry_write(b) \
249ebfedea0SLionel Sambuc                 BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))
250ebfedea0SLionel Sambuc 
251ebfedea0SLionel Sambuc /* These are normally used internally in BIOs */
252ebfedea0SLionel Sambuc # define BIO_clear_retry_flags(b) \
253ebfedea0SLionel Sambuc                 BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
254ebfedea0SLionel Sambuc # define BIO_get_retry_flags(b) \
255ebfedea0SLionel Sambuc                 BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
256ebfedea0SLionel Sambuc 
257ebfedea0SLionel Sambuc /* These should be used by the application to tell why we should retry */
258ebfedea0SLionel Sambuc # define BIO_should_read(a)              BIO_test_flags(a, BIO_FLAGS_READ)
259ebfedea0SLionel Sambuc # define BIO_should_write(a)             BIO_test_flags(a, BIO_FLAGS_WRITE)
260ebfedea0SLionel Sambuc # define BIO_should_io_special(a)        BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL)
261ebfedea0SLionel Sambuc # define BIO_retry_type(a)               BIO_test_flags(a, BIO_FLAGS_RWS)
262ebfedea0SLionel Sambuc # define BIO_should_retry(a)             BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY)
263ebfedea0SLionel Sambuc 
264*0a6a1f1dSLionel Sambuc /*
265*0a6a1f1dSLionel Sambuc  * The next three are used in conjunction with the BIO_should_io_special()
266*0a6a1f1dSLionel Sambuc  * condition.  After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int
267*0a6a1f1dSLionel Sambuc  * *reason); will walk the BIO stack and return the 'reason' for the special
268*0a6a1f1dSLionel Sambuc  * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return
269*0a6a1f1dSLionel Sambuc  * the code.
270*0a6a1f1dSLionel Sambuc  */
271*0a6a1f1dSLionel Sambuc /*
272*0a6a1f1dSLionel Sambuc  * Returned from the SSL bio when the certificate retrieval code had an error
273*0a6a1f1dSLionel Sambuc  */
274ebfedea0SLionel Sambuc # define BIO_RR_SSL_X509_LOOKUP          0x01
275ebfedea0SLionel Sambuc /* Returned from the connect BIO when a connect would have blocked */
276ebfedea0SLionel Sambuc # define BIO_RR_CONNECT                  0x02
277ebfedea0SLionel Sambuc /* Returned from the accept BIO when an accept would have blocked */
278ebfedea0SLionel Sambuc # define BIO_RR_ACCEPT                   0x03
279ebfedea0SLionel Sambuc 
280ebfedea0SLionel Sambuc /* These are passed by the BIO callback */
281ebfedea0SLionel Sambuc # define BIO_CB_FREE     0x01
282ebfedea0SLionel Sambuc # define BIO_CB_READ     0x02
283ebfedea0SLionel Sambuc # define BIO_CB_WRITE    0x03
284ebfedea0SLionel Sambuc # define BIO_CB_PUTS     0x04
285ebfedea0SLionel Sambuc # define BIO_CB_GETS     0x05
286ebfedea0SLionel Sambuc # define BIO_CB_CTRL     0x06
287ebfedea0SLionel Sambuc 
288*0a6a1f1dSLionel Sambuc /*
289*0a6a1f1dSLionel Sambuc  * The callback is called before and after the underling operation, The
290*0a6a1f1dSLionel Sambuc  * BIO_CB_RETURN flag indicates if it is after the call
291*0a6a1f1dSLionel Sambuc  */
292ebfedea0SLionel Sambuc # define BIO_CB_RETURN   0x80
293*0a6a1f1dSLionel Sambuc # define BIO_CB_return(a) ((a)|BIO_CB_RETURN)
294ebfedea0SLionel Sambuc # define BIO_cb_pre(a)   (!((a)&BIO_CB_RETURN))
295ebfedea0SLionel Sambuc # define BIO_cb_post(a)  ((a)&BIO_CB_RETURN)
296ebfedea0SLionel Sambuc 
297*0a6a1f1dSLionel Sambuc long (*BIO_get_callback(const BIO *b)) (struct bio_st *, int, const char *,
298*0a6a1f1dSLionel Sambuc                                         int, long, long);
299ebfedea0SLionel Sambuc void BIO_set_callback(BIO *b,
300*0a6a1f1dSLionel Sambuc                       long (*callback) (struct bio_st *, int, const char *,
301*0a6a1f1dSLionel Sambuc                                         int, long, long));
302ebfedea0SLionel Sambuc char *BIO_get_callback_arg(const BIO *b);
303ebfedea0SLionel Sambuc void BIO_set_callback_arg(BIO *b, char *arg);
304ebfedea0SLionel Sambuc 
305ebfedea0SLionel Sambuc const char *BIO_method_name(const BIO *b);
306ebfedea0SLionel Sambuc int BIO_method_type(const BIO *b);
307ebfedea0SLionel Sambuc 
308*0a6a1f1dSLionel Sambuc typedef void bio_info_cb (struct bio_st *, int, const char *, int, long,
309*0a6a1f1dSLionel Sambuc                           long);
310ebfedea0SLionel Sambuc 
311*0a6a1f1dSLionel Sambuc typedef struct bio_method_st {
312ebfedea0SLionel Sambuc     int type;
313ebfedea0SLionel Sambuc     const char *name;
314ebfedea0SLionel Sambuc     int (*bwrite) (BIO *, const char *, int);
315ebfedea0SLionel Sambuc     int (*bread) (BIO *, char *, int);
316ebfedea0SLionel Sambuc     int (*bputs) (BIO *, const char *);
317ebfedea0SLionel Sambuc     int (*bgets) (BIO *, char *, int);
318ebfedea0SLionel Sambuc     long (*ctrl) (BIO *, int, long, void *);
319ebfedea0SLionel Sambuc     int (*create) (BIO *);
320ebfedea0SLionel Sambuc     int (*destroy) (BIO *);
321ebfedea0SLionel Sambuc     long (*callback_ctrl) (BIO *, int, bio_info_cb *);
322ebfedea0SLionel Sambuc } BIO_METHOD;
323ebfedea0SLionel Sambuc 
324*0a6a1f1dSLionel Sambuc struct bio_st {
325ebfedea0SLionel Sambuc     BIO_METHOD *method;
326ebfedea0SLionel Sambuc     /* bio, mode, argp, argi, argl, ret */
327ebfedea0SLionel Sambuc     long (*callback) (struct bio_st *, int, const char *, int, long, long);
328ebfedea0SLionel Sambuc     char *cb_arg;               /* first argument for the callback */
329ebfedea0SLionel Sambuc     int init;
330ebfedea0SLionel Sambuc     int shutdown;
331ebfedea0SLionel Sambuc     int flags;                  /* extra storage */
332ebfedea0SLionel Sambuc     int retry_reason;
333ebfedea0SLionel Sambuc     int num;
334ebfedea0SLionel Sambuc     void *ptr;
335ebfedea0SLionel Sambuc     struct bio_st *next_bio;    /* used by filter BIOs */
336ebfedea0SLionel Sambuc     struct bio_st *prev_bio;    /* used by filter BIOs */
337ebfedea0SLionel Sambuc     int references;
338ebfedea0SLionel Sambuc     unsigned long num_read;
339ebfedea0SLionel Sambuc     unsigned long num_write;
340ebfedea0SLionel Sambuc     CRYPTO_EX_DATA ex_data;
341ebfedea0SLionel Sambuc };
342ebfedea0SLionel Sambuc 
343ebfedea0SLionel Sambuc DECLARE_STACK_OF(BIO)
344ebfedea0SLionel Sambuc 
345*0a6a1f1dSLionel Sambuc typedef struct bio_f_buffer_ctx_struct {
346*0a6a1f1dSLionel Sambuc     /*-
347*0a6a1f1dSLionel Sambuc      * Buffers are setup like this:
348ebfedea0SLionel Sambuc      *
349ebfedea0SLionel Sambuc      * <---------------------- size ----------------------->
350ebfedea0SLionel Sambuc      * +---------------------------------------------------+
351ebfedea0SLionel Sambuc      * | consumed | remaining          | free space        |
352ebfedea0SLionel Sambuc      * +---------------------------------------------------+
353ebfedea0SLionel Sambuc      * <-- off --><------- len ------->
354ebfedea0SLionel Sambuc      */
355*0a6a1f1dSLionel Sambuc     /*- BIO *bio; *//*
356*0a6a1f1dSLionel Sambuc      * this is now in the BIO struct
357*0a6a1f1dSLionel Sambuc      */
358ebfedea0SLionel Sambuc     int ibuf_size;              /* how big is the input buffer */
359ebfedea0SLionel Sambuc     int obuf_size;              /* how big is the output buffer */
360ebfedea0SLionel Sambuc     char *ibuf;                 /* the char array */
361ebfedea0SLionel Sambuc     int ibuf_len;               /* how many bytes are in it */
362ebfedea0SLionel Sambuc     int ibuf_off;               /* write/read offset */
363ebfedea0SLionel Sambuc     char *obuf;                 /* the char array */
364ebfedea0SLionel Sambuc     int obuf_len;               /* how many bytes are in it */
365ebfedea0SLionel Sambuc     int obuf_off;               /* write/read offset */
366ebfedea0SLionel Sambuc } BIO_F_BUFFER_CTX;
367ebfedea0SLionel Sambuc 
368ebfedea0SLionel Sambuc /* Prefix and suffix callback in ASN1 BIO */
369*0a6a1f1dSLionel Sambuc typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen,
370*0a6a1f1dSLionel Sambuc                           void *parg);
371ebfedea0SLionel Sambuc 
372ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_SCTP
373ebfedea0SLionel Sambuc /* SCTP parameter structs */
374*0a6a1f1dSLionel Sambuc struct bio_dgram_sctp_sndinfo {
375ebfedea0SLionel Sambuc     uint16_t snd_sid;
376ebfedea0SLionel Sambuc     uint16_t snd_flags;
377ebfedea0SLionel Sambuc     uint32_t snd_ppid;
378ebfedea0SLionel Sambuc     uint32_t snd_context;
379ebfedea0SLionel Sambuc };
380ebfedea0SLionel Sambuc 
381*0a6a1f1dSLionel Sambuc struct bio_dgram_sctp_rcvinfo {
382ebfedea0SLionel Sambuc     uint16_t rcv_sid;
383ebfedea0SLionel Sambuc     uint16_t rcv_ssn;
384ebfedea0SLionel Sambuc     uint16_t rcv_flags;
385ebfedea0SLionel Sambuc     uint32_t rcv_ppid;
386ebfedea0SLionel Sambuc     uint32_t rcv_tsn;
387ebfedea0SLionel Sambuc     uint32_t rcv_cumtsn;
388ebfedea0SLionel Sambuc     uint32_t rcv_context;
389ebfedea0SLionel Sambuc };
390ebfedea0SLionel Sambuc 
391*0a6a1f1dSLionel Sambuc struct bio_dgram_sctp_prinfo {
392ebfedea0SLionel Sambuc     uint16_t pr_policy;
393ebfedea0SLionel Sambuc     uint32_t pr_value;
394ebfedea0SLionel Sambuc };
395ebfedea0SLionel Sambuc # endif
396ebfedea0SLionel Sambuc 
397ebfedea0SLionel Sambuc /* connect BIO stuff */
398ebfedea0SLionel Sambuc # define BIO_CONN_S_BEFORE               1
399ebfedea0SLionel Sambuc # define BIO_CONN_S_GET_IP               2
400ebfedea0SLionel Sambuc # define BIO_CONN_S_GET_PORT             3
401ebfedea0SLionel Sambuc # define BIO_CONN_S_CREATE_SOCKET        4
402ebfedea0SLionel Sambuc # define BIO_CONN_S_CONNECT              5
403ebfedea0SLionel Sambuc # define BIO_CONN_S_OK                   6
404ebfedea0SLionel Sambuc # define BIO_CONN_S_BLOCKED_CONNECT      7
405ebfedea0SLionel Sambuc # define BIO_CONN_S_NBIO                 8
406*0a6a1f1dSLionel Sambuc /*
407*0a6a1f1dSLionel Sambuc  * #define BIO_CONN_get_param_hostname BIO_ctrl
408*0a6a1f1dSLionel Sambuc  */
409ebfedea0SLionel Sambuc 
410ebfedea0SLionel Sambuc # define BIO_C_SET_CONNECT                       100
411ebfedea0SLionel Sambuc # define BIO_C_DO_STATE_MACHINE                  101
412ebfedea0SLionel Sambuc # define BIO_C_SET_NBIO                          102
413ebfedea0SLionel Sambuc # define BIO_C_SET_PROXY_PARAM                   103
414ebfedea0SLionel Sambuc # define BIO_C_SET_FD                            104
415ebfedea0SLionel Sambuc # define BIO_C_GET_FD                            105
416ebfedea0SLionel Sambuc # define BIO_C_SET_FILE_PTR                      106
417ebfedea0SLionel Sambuc # define BIO_C_GET_FILE_PTR                      107
418ebfedea0SLionel Sambuc # define BIO_C_SET_FILENAME                      108
419ebfedea0SLionel Sambuc # define BIO_C_SET_SSL                           109
420ebfedea0SLionel Sambuc # define BIO_C_GET_SSL                           110
421ebfedea0SLionel Sambuc # define BIO_C_SET_MD                            111
422ebfedea0SLionel Sambuc # define BIO_C_GET_MD                            112
423ebfedea0SLionel Sambuc # define BIO_C_GET_CIPHER_STATUS                 113
424ebfedea0SLionel Sambuc # define BIO_C_SET_BUF_MEM                       114
425ebfedea0SLionel Sambuc # define BIO_C_GET_BUF_MEM_PTR                   115
426ebfedea0SLionel Sambuc # define BIO_C_GET_BUFF_NUM_LINES                116
427ebfedea0SLionel Sambuc # define BIO_C_SET_BUFF_SIZE                     117
428ebfedea0SLionel Sambuc # define BIO_C_SET_ACCEPT                        118
429ebfedea0SLionel Sambuc # define BIO_C_SSL_MODE                          119
430ebfedea0SLionel Sambuc # define BIO_C_GET_MD_CTX                        120
431ebfedea0SLionel Sambuc # define BIO_C_GET_PROXY_PARAM                   121
432ebfedea0SLionel Sambuc # define BIO_C_SET_BUFF_READ_DATA                122/* data to read first */
433ebfedea0SLionel Sambuc # define BIO_C_GET_CONNECT                       123
434ebfedea0SLionel Sambuc # define BIO_C_GET_ACCEPT                        124
435ebfedea0SLionel Sambuc # define BIO_C_SET_SSL_RENEGOTIATE_BYTES         125
436ebfedea0SLionel Sambuc # define BIO_C_GET_SSL_NUM_RENEGOTIATES          126
437ebfedea0SLionel Sambuc # define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT       127
438ebfedea0SLionel Sambuc # define BIO_C_FILE_SEEK                         128
439ebfedea0SLionel Sambuc # define BIO_C_GET_CIPHER_CTX                    129
440*0a6a1f1dSLionel Sambuc # define BIO_C_SET_BUF_MEM_EOF_RETURN            130/* return end of input
441*0a6a1f1dSLionel Sambuc                                                      * value */
442ebfedea0SLionel Sambuc # define BIO_C_SET_BIND_MODE                     131
443ebfedea0SLionel Sambuc # define BIO_C_GET_BIND_MODE                     132
444ebfedea0SLionel Sambuc # define BIO_C_FILE_TELL                         133
445ebfedea0SLionel Sambuc # define BIO_C_GET_SOCKS                         134
446ebfedea0SLionel Sambuc # define BIO_C_SET_SOCKS                         135
447ebfedea0SLionel Sambuc 
448ebfedea0SLionel Sambuc # define BIO_C_SET_WRITE_BUF_SIZE                136/* for BIO_s_bio */
449ebfedea0SLionel Sambuc # define BIO_C_GET_WRITE_BUF_SIZE                137
450ebfedea0SLionel Sambuc # define BIO_C_MAKE_BIO_PAIR                     138
451ebfedea0SLionel Sambuc # define BIO_C_DESTROY_BIO_PAIR                  139
452ebfedea0SLionel Sambuc # define BIO_C_GET_WRITE_GUARANTEE               140
453ebfedea0SLionel Sambuc # define BIO_C_GET_READ_REQUEST                  141
454ebfedea0SLionel Sambuc # define BIO_C_SHUTDOWN_WR                       142
455ebfedea0SLionel Sambuc # define BIO_C_NREAD0                            143
456ebfedea0SLionel Sambuc # define BIO_C_NREAD                             144
457ebfedea0SLionel Sambuc # define BIO_C_NWRITE0                           145
458ebfedea0SLionel Sambuc # define BIO_C_NWRITE                            146
459ebfedea0SLionel Sambuc # define BIO_C_RESET_READ_REQUEST                147
460ebfedea0SLionel Sambuc # define BIO_C_SET_MD_CTX                        148
461ebfedea0SLionel Sambuc 
462ebfedea0SLionel Sambuc # define BIO_C_SET_PREFIX                        149
463ebfedea0SLionel Sambuc # define BIO_C_GET_PREFIX                        150
464ebfedea0SLionel Sambuc # define BIO_C_SET_SUFFIX                        151
465ebfedea0SLionel Sambuc # define BIO_C_GET_SUFFIX                        152
466ebfedea0SLionel Sambuc 
467ebfedea0SLionel Sambuc # define BIO_C_SET_EX_ARG                        153
468ebfedea0SLionel Sambuc # define BIO_C_GET_EX_ARG                        154
469ebfedea0SLionel Sambuc 
470ebfedea0SLionel Sambuc # define BIO_set_app_data(s,arg)         BIO_set_ex_data(s,0,arg)
471ebfedea0SLionel Sambuc # define BIO_get_app_data(s)             BIO_get_ex_data(s,0)
472ebfedea0SLionel Sambuc 
473ebfedea0SLionel Sambuc /* BIO_s_connect() and BIO_s_socks4a_connect() */
474ebfedea0SLionel Sambuc # define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name)
475ebfedea0SLionel Sambuc # define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port)
476ebfedea0SLionel Sambuc # define BIO_set_conn_ip(b,ip)     BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip)
477ebfedea0SLionel Sambuc # define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port)
478ebfedea0SLionel Sambuc # define BIO_get_conn_hostname(b)  BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)
479ebfedea0SLionel Sambuc # define BIO_get_conn_port(b)      BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)
480ebfedea0SLionel Sambuc # define BIO_get_conn_ip(b)               BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)
481ebfedea0SLionel Sambuc # define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0)
482ebfedea0SLionel Sambuc 
483ebfedea0SLionel Sambuc # define BIO_set_nbio(b,n)       BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
484ebfedea0SLionel Sambuc 
485ebfedea0SLionel Sambuc /* BIO_s_accept_socket() */
486ebfedea0SLionel Sambuc # define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name)
487ebfedea0SLionel Sambuc # define BIO_get_accept_port(b)  BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)
488ebfedea0SLionel Sambuc /* #define BIO_set_nbio(b,n)    BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */
489ebfedea0SLionel Sambuc # define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?(void *)"a":NULL)
490ebfedea0SLionel Sambuc # define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio)
491ebfedea0SLionel Sambuc 
492ebfedea0SLionel Sambuc # define BIO_BIND_NORMAL                 0
493ebfedea0SLionel Sambuc # define BIO_BIND_REUSEADDR_IF_UNUSED    1
494ebfedea0SLionel Sambuc # define BIO_BIND_REUSEADDR              2
495ebfedea0SLionel Sambuc # define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)
496ebfedea0SLionel Sambuc # define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)
497ebfedea0SLionel Sambuc 
498ebfedea0SLionel Sambuc # define BIO_do_connect(b)       BIO_do_handshake(b)
499ebfedea0SLionel Sambuc # define BIO_do_accept(b)        BIO_do_handshake(b)
500ebfedea0SLionel Sambuc # define BIO_do_handshake(b)     BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
501ebfedea0SLionel Sambuc 
502ebfedea0SLionel Sambuc /* BIO_s_proxy_client() */
503ebfedea0SLionel Sambuc # define BIO_set_url(b,url)      BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url))
504ebfedea0SLionel Sambuc # define BIO_set_proxies(b,p)    BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p))
505ebfedea0SLionel Sambuc /* BIO_set_nbio(b,n) */
506ebfedea0SLionel Sambuc # define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s))
507ebfedea0SLionel Sambuc /* BIO *BIO_get_filter_bio(BIO *bio); */
508ebfedea0SLionel Sambuc # define BIO_set_proxy_cb(b,cb) BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(void *(*cb)()))
509ebfedea0SLionel Sambuc # define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk)
510ebfedea0SLionel Sambuc # define BIO_set_no_connect_return(b,bool) BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,bool)
511ebfedea0SLionel Sambuc 
512ebfedea0SLionel Sambuc # define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp)
513ebfedea0SLionel Sambuc # define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p))
514ebfedea0SLionel Sambuc # define BIO_get_url(b,url)      BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))
515ebfedea0SLionel Sambuc # define BIO_get_no_connect_return(b)    BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL)
516ebfedea0SLionel Sambuc 
517ebfedea0SLionel Sambuc # define BIO_set_fd(b,fd,c)      BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
518ebfedea0SLionel Sambuc # define BIO_get_fd(b,c)         BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)
519ebfedea0SLionel Sambuc 
520ebfedea0SLionel Sambuc # define BIO_set_fp(b,fp,c)      BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)
521ebfedea0SLionel Sambuc # define BIO_get_fp(b,fpp)       BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)
522ebfedea0SLionel Sambuc 
523ebfedea0SLionel Sambuc # define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
524ebfedea0SLionel Sambuc # define BIO_tell(b)     (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
525ebfedea0SLionel Sambuc 
526*0a6a1f1dSLionel Sambuc /*
527*0a6a1f1dSLionel Sambuc  * name is cast to lose const, but might be better to route through a
528*0a6a1f1dSLionel Sambuc  * function so we can do it safely
529*0a6a1f1dSLionel Sambuc  */
530ebfedea0SLionel Sambuc # ifdef CONST_STRICT
531*0a6a1f1dSLionel Sambuc /*
532*0a6a1f1dSLionel Sambuc  * If you are wondering why this isn't defined, its because CONST_STRICT is
533ebfedea0SLionel Sambuc  * purely a compile-time kludge to allow const to be checked.
534ebfedea0SLionel Sambuc  */
535ebfedea0SLionel Sambuc int BIO_read_filename(BIO *b, const char *name);
536ebfedea0SLionel Sambuc # else
537ebfedea0SLionel Sambuc #  define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
538ebfedea0SLionel Sambuc                 BIO_CLOSE|BIO_FP_READ,(char *)name)
539ebfedea0SLionel Sambuc # endif
540ebfedea0SLionel Sambuc # define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
541ebfedea0SLionel Sambuc                 BIO_CLOSE|BIO_FP_WRITE,name)
542ebfedea0SLionel Sambuc # define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
543ebfedea0SLionel Sambuc                 BIO_CLOSE|BIO_FP_APPEND,name)
544ebfedea0SLionel Sambuc # define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
545ebfedea0SLionel Sambuc                 BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name)
546ebfedea0SLionel Sambuc 
547*0a6a1f1dSLionel Sambuc /*
548*0a6a1f1dSLionel Sambuc  * WARNING WARNING, this ups the reference count on the read bio of the SSL
549*0a6a1f1dSLionel Sambuc  * structure.  This is because the ssl read BIO is now pointed to by the
550*0a6a1f1dSLionel Sambuc  * next_bio field in the bio.  So when you free the BIO, make sure you are
551*0a6a1f1dSLionel Sambuc  * doing a BIO_free_all() to catch the underlying BIO.
552*0a6a1f1dSLionel Sambuc  */
553ebfedea0SLionel Sambuc # define BIO_set_ssl(b,ssl,c)    BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl)
554ebfedea0SLionel Sambuc # define BIO_get_ssl(b,sslp)     BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp)
555ebfedea0SLionel Sambuc # define BIO_set_ssl_mode(b,client)      BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL)
556ebfedea0SLionel Sambuc # define BIO_set_ssl_renegotiate_bytes(b,num) \
557ebfedea0SLionel Sambuc         BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL);
558ebfedea0SLionel Sambuc # define BIO_get_num_renegotiates(b) \
559ebfedea0SLionel Sambuc         BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL);
560ebfedea0SLionel Sambuc # define BIO_set_ssl_renegotiate_timeout(b,seconds) \
561ebfedea0SLionel Sambuc         BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL);
562ebfedea0SLionel Sambuc 
563ebfedea0SLionel Sambuc /* defined in evp.h */
564ebfedea0SLionel Sambuc /* #define BIO_set_md(b,md)     BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */
565ebfedea0SLionel Sambuc 
566ebfedea0SLionel Sambuc # define BIO_get_mem_data(b,pp)  BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp)
567ebfedea0SLionel Sambuc # define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm)
568ebfedea0SLionel Sambuc # define BIO_get_mem_ptr(b,pp)   BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp)
569ebfedea0SLionel Sambuc # define BIO_set_mem_eof_return(b,v) \
570ebfedea0SLionel Sambuc                                 BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL)
571ebfedea0SLionel Sambuc 
572ebfedea0SLionel Sambuc /* For the BIO_f_buffer() type */
573ebfedea0SLionel Sambuc # define BIO_get_buffer_num_lines(b)     BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)
574ebfedea0SLionel Sambuc # define BIO_set_buffer_size(b,size)     BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)
575ebfedea0SLionel Sambuc # define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0)
576ebfedea0SLionel Sambuc # define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1)
577ebfedea0SLionel Sambuc # define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf)
578ebfedea0SLionel Sambuc 
579ebfedea0SLionel Sambuc /* Don't use the next one unless you know what you are doing :-) */
580ebfedea0SLionel Sambuc # define BIO_dup_state(b,ret)    BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret))
581ebfedea0SLionel Sambuc 
582ebfedea0SLionel Sambuc # define BIO_reset(b)            (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)
583ebfedea0SLionel Sambuc # define BIO_eof(b)              (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL)
584ebfedea0SLionel Sambuc # define BIO_set_close(b,c)      (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)
585ebfedea0SLionel Sambuc # define BIO_get_close(b)        (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL)
586ebfedea0SLionel Sambuc # define BIO_pending(b)          (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)
587ebfedea0SLionel Sambuc # define BIO_wpending(b)         (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL)
588ebfedea0SLionel Sambuc /* ...pending macros have inappropriate return type */
589ebfedea0SLionel Sambuc size_t BIO_ctrl_pending(BIO *b);
590ebfedea0SLionel Sambuc size_t BIO_ctrl_wpending(BIO *b);
591ebfedea0SLionel Sambuc # define BIO_flush(b)            (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
592ebfedea0SLionel Sambuc # define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \
593ebfedea0SLionel Sambuc                                                    cbp)
594ebfedea0SLionel Sambuc # define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb)
595ebfedea0SLionel Sambuc 
596ebfedea0SLionel Sambuc /* For the BIO_f_buffer() type */
597ebfedea0SLionel Sambuc # define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL)
598ebfedea0SLionel Sambuc 
599ebfedea0SLionel Sambuc /* For BIO_s_bio() */
600ebfedea0SLionel Sambuc # define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL)
601ebfedea0SLionel Sambuc # define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL)
602ebfedea0SLionel Sambuc # define BIO_make_bio_pair(b1,b2)   (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2)
603ebfedea0SLionel Sambuc # define BIO_destroy_bio_pair(b)    (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL)
604ebfedea0SLionel Sambuc # define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL)
605ebfedea0SLionel Sambuc /* macros with inappropriate type -- but ...pending macros use int too: */
606ebfedea0SLionel Sambuc # define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL)
607ebfedea0SLionel Sambuc # define BIO_get_read_request(b)    (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL)
608ebfedea0SLionel Sambuc size_t BIO_ctrl_get_write_guarantee(BIO *b);
609ebfedea0SLionel Sambuc size_t BIO_ctrl_get_read_request(BIO *b);
610ebfedea0SLionel Sambuc int BIO_ctrl_reset_read_request(BIO *b);
611ebfedea0SLionel Sambuc 
612ebfedea0SLionel Sambuc /* ctrl macros for dgram */
613ebfedea0SLionel Sambuc # define BIO_ctrl_dgram_connect(b,peer)  \
614ebfedea0SLionel Sambuc                      (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer)
615ebfedea0SLionel Sambuc # define BIO_ctrl_set_connected(b, state, peer) \
616ebfedea0SLionel Sambuc          (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer)
617ebfedea0SLionel Sambuc # define BIO_dgram_recv_timedout(b) \
618ebfedea0SLionel Sambuc          (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL)
619ebfedea0SLionel Sambuc # define BIO_dgram_send_timedout(b) \
620ebfedea0SLionel Sambuc          (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL)
621ebfedea0SLionel Sambuc # define BIO_dgram_get_peer(b,peer) \
622ebfedea0SLionel Sambuc          (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)peer)
623ebfedea0SLionel Sambuc # define BIO_dgram_set_peer(b,peer) \
624ebfedea0SLionel Sambuc          (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer)
625*0a6a1f1dSLionel Sambuc # define BIO_dgram_get_mtu_overhead(b) \
626*0a6a1f1dSLionel Sambuc          (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL)
627ebfedea0SLionel Sambuc 
628ebfedea0SLionel Sambuc /* These two aren't currently implemented */
629ebfedea0SLionel Sambuc /* int BIO_get_ex_num(BIO *bio); */
630ebfedea0SLionel Sambuc /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */
631ebfedea0SLionel Sambuc int BIO_set_ex_data(BIO *bio, int idx, void *data);
632ebfedea0SLionel Sambuc void *BIO_get_ex_data(BIO *bio, int idx);
633ebfedea0SLionel Sambuc int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
634ebfedea0SLionel Sambuc                          CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
635ebfedea0SLionel Sambuc unsigned long BIO_number_read(BIO *bio);
636ebfedea0SLionel Sambuc unsigned long BIO_number_written(BIO *bio);
637ebfedea0SLionel Sambuc 
638ebfedea0SLionel Sambuc /* For BIO_f_asn1() */
639ebfedea0SLionel Sambuc int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix,
640ebfedea0SLionel Sambuc                         asn1_ps_func *prefix_free);
641ebfedea0SLionel Sambuc int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix,
642ebfedea0SLionel Sambuc                         asn1_ps_func **pprefix_free);
643ebfedea0SLionel Sambuc int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,
644ebfedea0SLionel Sambuc                         asn1_ps_func *suffix_free);
645ebfedea0SLionel Sambuc int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
646ebfedea0SLionel Sambuc                         asn1_ps_func **psuffix_free);
647ebfedea0SLionel Sambuc 
648ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_FP_API
649ebfedea0SLionel Sambuc BIO_METHOD *BIO_s_file(void);
650ebfedea0SLionel Sambuc BIO *BIO_new_file(const char *filename, const char *mode);
651ebfedea0SLionel Sambuc BIO *BIO_new_fp(FILE *stream, int close_flag);
652ebfedea0SLionel Sambuc #  define BIO_s_file_internal    BIO_s_file
653ebfedea0SLionel Sambuc # endif
654ebfedea0SLionel Sambuc BIO *BIO_new(BIO_METHOD *type);
655ebfedea0SLionel Sambuc int BIO_set(BIO *a, BIO_METHOD *type);
656ebfedea0SLionel Sambuc int BIO_free(BIO *a);
657ebfedea0SLionel Sambuc void BIO_vfree(BIO *a);
658ebfedea0SLionel Sambuc int BIO_read(BIO *b, void *data, int len);
659ebfedea0SLionel Sambuc int BIO_gets(BIO *bp, char *buf, int size);
660ebfedea0SLionel Sambuc int BIO_write(BIO *b, const void *data, int len);
661ebfedea0SLionel Sambuc int BIO_puts(BIO *bp, const char *buf);
662ebfedea0SLionel Sambuc int BIO_indent(BIO *b, int indent, int max);
663ebfedea0SLionel Sambuc long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);
664*0a6a1f1dSLionel Sambuc long BIO_callback_ctrl(BIO *b, int cmd,
665*0a6a1f1dSLionel Sambuc                        void (*fp) (struct bio_st *, int, const char *, int,
666*0a6a1f1dSLionel Sambuc                                    long, long));
667ebfedea0SLionel Sambuc char *BIO_ptr_ctrl(BIO *bp, int cmd, long larg);
668ebfedea0SLionel Sambuc long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg);
669ebfedea0SLionel Sambuc BIO *BIO_push(BIO *b, BIO *append);
670ebfedea0SLionel Sambuc BIO *BIO_pop(BIO *b);
671ebfedea0SLionel Sambuc void BIO_free_all(BIO *a);
672ebfedea0SLionel Sambuc BIO *BIO_find_type(BIO *b, int bio_type);
673ebfedea0SLionel Sambuc BIO *BIO_next(BIO *b);
674ebfedea0SLionel Sambuc BIO *BIO_get_retry_BIO(BIO *bio, int *reason);
675ebfedea0SLionel Sambuc int BIO_get_retry_reason(BIO *bio);
676ebfedea0SLionel Sambuc BIO *BIO_dup_chain(BIO *in);
677ebfedea0SLionel Sambuc 
678ebfedea0SLionel Sambuc int BIO_nread0(BIO *bio, char **buf);
679ebfedea0SLionel Sambuc int BIO_nread(BIO *bio, char **buf, int num);
680ebfedea0SLionel Sambuc int BIO_nwrite0(BIO *bio, char **buf);
681ebfedea0SLionel Sambuc int BIO_nwrite(BIO *bio, char **buf, int num);
682ebfedea0SLionel Sambuc 
683ebfedea0SLionel Sambuc long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi,
684ebfedea0SLionel Sambuc                         long argl, long ret);
685ebfedea0SLionel Sambuc 
686ebfedea0SLionel Sambuc BIO_METHOD *BIO_s_mem(void);
687ebfedea0SLionel Sambuc BIO *BIO_new_mem_buf(void *buf, int len);
688ebfedea0SLionel Sambuc BIO_METHOD *BIO_s_socket(void);
689ebfedea0SLionel Sambuc BIO_METHOD *BIO_s_connect(void);
690ebfedea0SLionel Sambuc BIO_METHOD *BIO_s_accept(void);
691ebfedea0SLionel Sambuc BIO_METHOD *BIO_s_fd(void);
692ebfedea0SLionel Sambuc # ifndef OPENSSL_SYS_OS2
693ebfedea0SLionel Sambuc BIO_METHOD *BIO_s_log(void);
694ebfedea0SLionel Sambuc # endif
695ebfedea0SLionel Sambuc BIO_METHOD *BIO_s_bio(void);
696ebfedea0SLionel Sambuc BIO_METHOD *BIO_s_null(void);
697ebfedea0SLionel Sambuc BIO_METHOD *BIO_f_null(void);
698ebfedea0SLionel Sambuc BIO_METHOD *BIO_f_buffer(void);
699ebfedea0SLionel Sambuc # ifdef OPENSSL_SYS_VMS
700ebfedea0SLionel Sambuc BIO_METHOD *BIO_f_linebuffer(void);
701ebfedea0SLionel Sambuc # endif
702ebfedea0SLionel Sambuc BIO_METHOD *BIO_f_nbio_test(void);
703ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_DGRAM
704ebfedea0SLionel Sambuc BIO_METHOD *BIO_s_datagram(void);
705ebfedea0SLionel Sambuc #  ifndef OPENSSL_NO_SCTP
706ebfedea0SLionel Sambuc BIO_METHOD *BIO_s_datagram_sctp(void);
707ebfedea0SLionel Sambuc #  endif
708ebfedea0SLionel Sambuc # endif
709ebfedea0SLionel Sambuc 
710ebfedea0SLionel Sambuc /* BIO_METHOD *BIO_f_ber(void); */
711ebfedea0SLionel Sambuc 
712ebfedea0SLionel Sambuc int BIO_sock_should_retry(int i);
713ebfedea0SLionel Sambuc int BIO_sock_non_fatal_error(int error);
714ebfedea0SLionel Sambuc int BIO_dgram_non_fatal_error(int error);
715ebfedea0SLionel Sambuc 
716ebfedea0SLionel Sambuc int BIO_fd_should_retry(int i);
717ebfedea0SLionel Sambuc int BIO_fd_non_fatal_error(int error);
718ebfedea0SLionel Sambuc int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u),
719ebfedea0SLionel Sambuc                 void *u, const char *s, int len);
720ebfedea0SLionel Sambuc int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u),
721ebfedea0SLionel Sambuc                        void *u, const char *s, int len, int indent);
722ebfedea0SLionel Sambuc int BIO_dump(BIO *b, const char *bytes, int len);
723ebfedea0SLionel Sambuc int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent);
724ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_FP_API
725ebfedea0SLionel Sambuc int BIO_dump_fp(FILE *fp, const char *s, int len);
726ebfedea0SLionel Sambuc int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);
727ebfedea0SLionel Sambuc # endif
728ebfedea0SLionel Sambuc struct hostent *BIO_gethostbyname(const char *name);
729*0a6a1f1dSLionel Sambuc /*-
730*0a6a1f1dSLionel Sambuc  * We might want a thread-safe interface too:
731ebfedea0SLionel Sambuc  * struct hostent *BIO_gethostbyname_r(const char *name,
732ebfedea0SLionel Sambuc  *     struct hostent *result, void *buffer, size_t buflen);
733ebfedea0SLionel Sambuc  * or something similar (caller allocates a struct hostent,
734ebfedea0SLionel Sambuc  * pointed to by "result", and additional buffer space for the various
735ebfedea0SLionel Sambuc  * substructures; if the buffer does not suffice, NULL is returned
736ebfedea0SLionel Sambuc  * and an appropriate error code is set).
737ebfedea0SLionel Sambuc  */
738ebfedea0SLionel Sambuc int BIO_sock_error(int sock);
739ebfedea0SLionel Sambuc int BIO_socket_ioctl(int fd, long type, void *arg);
740ebfedea0SLionel Sambuc int BIO_socket_nbio(int fd, int mode);
741ebfedea0SLionel Sambuc int BIO_get_port(const char *str, unsigned short *port_ptr);
742ebfedea0SLionel Sambuc int BIO_get_host_ip(const char *str, unsigned char *ip);
743ebfedea0SLionel Sambuc int BIO_get_accept_socket(char *host_port, int mode);
744ebfedea0SLionel Sambuc int BIO_accept(int sock, char **ip_port);
745ebfedea0SLionel Sambuc int BIO_sock_init(void);
746ebfedea0SLionel Sambuc void BIO_sock_cleanup(void);
747ebfedea0SLionel Sambuc int BIO_set_tcp_ndelay(int sock, int turn_on);
748ebfedea0SLionel Sambuc 
749ebfedea0SLionel Sambuc BIO *BIO_new_socket(int sock, int close_flag);
750ebfedea0SLionel Sambuc BIO *BIO_new_dgram(int fd, int close_flag);
751ebfedea0SLionel Sambuc # ifndef OPENSSL_NO_SCTP
752ebfedea0SLionel Sambuc BIO *BIO_new_dgram_sctp(int fd, int close_flag);
753ebfedea0SLionel Sambuc int BIO_dgram_is_sctp(BIO *bio);
754ebfedea0SLionel Sambuc int BIO_dgram_sctp_notification_cb(BIO *b,
755*0a6a1f1dSLionel Sambuc                                    void (*handle_notifications) (BIO *bio,
756*0a6a1f1dSLionel Sambuc                                                                  void
757*0a6a1f1dSLionel Sambuc                                                                  *context,
758*0a6a1f1dSLionel Sambuc                                                                  void *buf),
759ebfedea0SLionel Sambuc                                    void *context);
760ebfedea0SLionel Sambuc int BIO_dgram_sctp_wait_for_dry(BIO *b);
761ebfedea0SLionel Sambuc int BIO_dgram_sctp_msg_waiting(BIO *b);
762ebfedea0SLionel Sambuc # endif
763ebfedea0SLionel Sambuc BIO *BIO_new_fd(int fd, int close_flag);
764ebfedea0SLionel Sambuc BIO *BIO_new_connect(char *host_port);
765ebfedea0SLionel Sambuc BIO *BIO_new_accept(char *host_port);
766ebfedea0SLionel Sambuc 
767ebfedea0SLionel Sambuc int BIO_new_bio_pair(BIO **bio1, size_t writebuf1,
768ebfedea0SLionel Sambuc                      BIO **bio2, size_t writebuf2);
769*0a6a1f1dSLionel Sambuc /*
770*0a6a1f1dSLionel Sambuc  * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints.
771*0a6a1f1dSLionel Sambuc  * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default
772*0a6a1f1dSLionel Sambuc  * value.
773ebfedea0SLionel Sambuc  */
774ebfedea0SLionel Sambuc 
775ebfedea0SLionel Sambuc void BIO_copy_next_retry(BIO *b);
776ebfedea0SLionel Sambuc 
777*0a6a1f1dSLionel Sambuc /*
778*0a6a1f1dSLionel Sambuc  * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);
779*0a6a1f1dSLionel Sambuc  */
780ebfedea0SLionel Sambuc 
781ebfedea0SLionel Sambuc # ifdef __GNUC__
782ebfedea0SLionel Sambuc #  define __bio_h__attr__ __attribute__
783ebfedea0SLionel Sambuc # else
784ebfedea0SLionel Sambuc #  define __bio_h__attr__(x)
785ebfedea0SLionel Sambuc # endif
786ebfedea0SLionel Sambuc int BIO_printf(BIO *bio, const char *format, ...)
787ebfedea0SLionel Sambuc __bio_h__attr__((__format__(__printf__, 2, 3)));
788ebfedea0SLionel Sambuc int BIO_vprintf(BIO *bio, const char *format, va_list args)
789ebfedea0SLionel Sambuc __bio_h__attr__((__format__(__printf__, 2, 0)));
790ebfedea0SLionel Sambuc int BIO_snprintf(char *buf, size_t n, const char *format, ...)
791ebfedea0SLionel Sambuc __bio_h__attr__((__format__(__printf__, 3, 4)));
792ebfedea0SLionel Sambuc int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
793ebfedea0SLionel Sambuc __bio_h__attr__((__format__(__printf__, 3, 0)));
794ebfedea0SLionel Sambuc # undef __bio_h__attr__
795ebfedea0SLionel Sambuc 
796ebfedea0SLionel Sambuc /* BEGIN ERROR CODES */
797*0a6a1f1dSLionel Sambuc /*
798*0a6a1f1dSLionel Sambuc  * The following lines are auto generated by the script mkerr.pl. Any changes
799ebfedea0SLionel Sambuc  * made after this point may be overwritten when the script is next run.
800ebfedea0SLionel Sambuc  */
801ebfedea0SLionel Sambuc void ERR_load_BIO_strings(void);
802ebfedea0SLionel Sambuc 
803ebfedea0SLionel Sambuc /* Error codes for the BIO functions. */
804ebfedea0SLionel Sambuc 
805ebfedea0SLionel Sambuc /* Function codes. */
806ebfedea0SLionel Sambuc # define BIO_F_ACPT_STATE                                 100
807ebfedea0SLionel Sambuc # define BIO_F_BIO_ACCEPT                                 101
808ebfedea0SLionel Sambuc # define BIO_F_BIO_BER_GET_HEADER                         102
809ebfedea0SLionel Sambuc # define BIO_F_BIO_CALLBACK_CTRL                          131
810ebfedea0SLionel Sambuc # define BIO_F_BIO_CTRL                                   103
811ebfedea0SLionel Sambuc # define BIO_F_BIO_GETHOSTBYNAME                          120
812ebfedea0SLionel Sambuc # define BIO_F_BIO_GETS                                   104
813ebfedea0SLionel Sambuc # define BIO_F_BIO_GET_ACCEPT_SOCKET                      105
814ebfedea0SLionel Sambuc # define BIO_F_BIO_GET_HOST_IP                            106
815ebfedea0SLionel Sambuc # define BIO_F_BIO_GET_PORT                               107
816ebfedea0SLionel Sambuc # define BIO_F_BIO_MAKE_PAIR                              121
817ebfedea0SLionel Sambuc # define BIO_F_BIO_NEW                                    108
818ebfedea0SLionel Sambuc # define BIO_F_BIO_NEW_FILE                               109
819ebfedea0SLionel Sambuc # define BIO_F_BIO_NEW_MEM_BUF                            126
820ebfedea0SLionel Sambuc # define BIO_F_BIO_NREAD                                  123
821ebfedea0SLionel Sambuc # define BIO_F_BIO_NREAD0                                 124
822ebfedea0SLionel Sambuc # define BIO_F_BIO_NWRITE                                 125
823ebfedea0SLionel Sambuc # define BIO_F_BIO_NWRITE0                                122
824ebfedea0SLionel Sambuc # define BIO_F_BIO_PUTS                                   110
825ebfedea0SLionel Sambuc # define BIO_F_BIO_READ                                   111
826ebfedea0SLionel Sambuc # define BIO_F_BIO_SOCK_INIT                              112
827ebfedea0SLionel Sambuc # define BIO_F_BIO_WRITE                                  113
828ebfedea0SLionel Sambuc # define BIO_F_BUFFER_CTRL                                114
829ebfedea0SLionel Sambuc # define BIO_F_CONN_CTRL                                  127
830ebfedea0SLionel Sambuc # define BIO_F_CONN_STATE                                 115
831ebfedea0SLionel Sambuc # define BIO_F_DGRAM_SCTP_READ                            132
832*0a6a1f1dSLionel Sambuc # define BIO_F_DGRAM_SCTP_WRITE                           133
833ebfedea0SLionel Sambuc # define BIO_F_FILE_CTRL                                  116
834ebfedea0SLionel Sambuc # define BIO_F_FILE_READ                                  130
835ebfedea0SLionel Sambuc # define BIO_F_LINEBUFFER_CTRL                            129
836ebfedea0SLionel Sambuc # define BIO_F_MEM_READ                                   128
837ebfedea0SLionel Sambuc # define BIO_F_MEM_WRITE                                  117
838ebfedea0SLionel Sambuc # define BIO_F_SSL_NEW                                    118
839ebfedea0SLionel Sambuc # define BIO_F_WSASTARTUP                                 119
840ebfedea0SLionel Sambuc 
841ebfedea0SLionel Sambuc /* Reason codes. */
842ebfedea0SLionel Sambuc # define BIO_R_ACCEPT_ERROR                               100
843ebfedea0SLionel Sambuc # define BIO_R_BAD_FOPEN_MODE                             101
844ebfedea0SLionel Sambuc # define BIO_R_BAD_HOSTNAME_LOOKUP                        102
845ebfedea0SLionel Sambuc # define BIO_R_BROKEN_PIPE                                124
846ebfedea0SLionel Sambuc # define BIO_R_CONNECT_ERROR                              103
847ebfedea0SLionel Sambuc # define BIO_R_EOF_ON_MEMORY_BIO                          127
848ebfedea0SLionel Sambuc # define BIO_R_ERROR_SETTING_NBIO                         104
849ebfedea0SLionel Sambuc # define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET      105
850ebfedea0SLionel Sambuc # define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET        106
851ebfedea0SLionel Sambuc # define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET          107
852ebfedea0SLionel Sambuc # define BIO_R_INVALID_ARGUMENT                           125
853ebfedea0SLionel Sambuc # define BIO_R_INVALID_IP_ADDRESS                         108
854ebfedea0SLionel Sambuc # define BIO_R_IN_USE                                     123
855ebfedea0SLionel Sambuc # define BIO_R_KEEPALIVE                                  109
856ebfedea0SLionel Sambuc # define BIO_R_NBIO_CONNECT_ERROR                         110
857ebfedea0SLionel Sambuc # define BIO_R_NO_ACCEPT_PORT_SPECIFIED                   111
858ebfedea0SLionel Sambuc # define BIO_R_NO_HOSTNAME_SPECIFIED                      112
859ebfedea0SLionel Sambuc # define BIO_R_NO_PORT_DEFINED                            113
860ebfedea0SLionel Sambuc # define BIO_R_NO_PORT_SPECIFIED                          114
861ebfedea0SLionel Sambuc # define BIO_R_NO_SUCH_FILE                               128
862ebfedea0SLionel Sambuc # define BIO_R_NULL_PARAMETER                             115
863ebfedea0SLionel Sambuc # define BIO_R_TAG_MISMATCH                               116
864ebfedea0SLionel Sambuc # define BIO_R_UNABLE_TO_BIND_SOCKET                      117
865ebfedea0SLionel Sambuc # define BIO_R_UNABLE_TO_CREATE_SOCKET                    118
866ebfedea0SLionel Sambuc # define BIO_R_UNABLE_TO_LISTEN_SOCKET                    119
867ebfedea0SLionel Sambuc # define BIO_R_UNINITIALIZED                              120
868ebfedea0SLionel Sambuc # define BIO_R_UNSUPPORTED_METHOD                         121
869ebfedea0SLionel Sambuc # define BIO_R_WRITE_TO_READ_ONLY_BIO                     126
870ebfedea0SLionel Sambuc # define BIO_R_WSASTARTUP                                 122
871ebfedea0SLionel Sambuc 
872ebfedea0SLionel Sambuc #ifdef  __cplusplus
873ebfedea0SLionel Sambuc }
874ebfedea0SLionel Sambuc #endif
875ebfedea0SLionel Sambuc #endif
876