]> git.ipfire.org Git - thirdparty/openssl.git/blob - crypto/bio/bio.h
Import of old SSLeay release: SSLeay 0.8.1b
[thirdparty/openssl.git] / crypto / bio / bio.h
1 /* crypto/bio/bio.h */
2 /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59 #ifndef HEADER_BIO_H
60 #define HEADER_BIO_H
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65
66 /* These are the 'types' of BIOs */
67 #define BIO_TYPE_NONE 0
68 #define BIO_TYPE_MEM (1|0x0400)
69 #define BIO_TYPE_FILE (2|0x0400)
70
71 #define BIO_TYPE_FD (4|0x0400|0x0100)
72 #define BIO_TYPE_SOCKET (5|0x0400|0x0100)
73 #define BIO_TYPE_NULL (6|0x0400)
74 #define BIO_TYPE_SSL (7|0x0200)
75 #define BIO_TYPE_MD (8|0x0200) /* pasive filter */
76 #define BIO_TYPE_BUFFER (9|0x0200) /* filter */
77 #define BIO_TYPE_CIPHER (10|0x0200) /* filter */
78 #define BIO_TYPE_BASE64 (11|0x0200) /* filter */
79 #define BIO_TYPE_CONNECT (12|0x0400|0x0100) /* socket - connect */
80 #define BIO_TYPE_ACCEPT (13|0x0400|0x0100) /* socket for accept */
81 #define BIO_TYPE_PROXY_CLIENT (14|0x0400) /* client proxy BIO */
82 #define BIO_TYPE_PROXY_SERVER (15|0x0200) /* server proxy BIO */
83 #define BIO_TYPE_NBIO_TEST (16|0x0200) /* server proxy BIO */
84 #define BIO_TYPE_NULL_FILTER (17|0x0200)
85
86 #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */
87 #define BIO_TYPE_FILTER 0x0200
88 #define BIO_TYPE_SOURCE_SINK 0x0400
89
90 /* BIO_FILENAME_READ|BIO_CLOSE to open or close on free.
91 * BIO_set_fp(in,stdin,BIO_NOCLOSE); */
92 #define BIO_NOCLOSE 0x00
93 #define BIO_CLOSE 0x01
94
95 /* These are used in the following macros and are passed to
96 * BIO_ctrl() */
97 #define BIO_CTRL_RESET 1 /* opt - rewind/zero etc */
98 #define BIO_CTRL_EOF 2 /* opt - are we at the eof */
99 #define BIO_CTRL_INFO 3 /* opt - extra tit-bits */
100 #define BIO_CTRL_SET 4 /* man - set the 'IO' type */
101 #define BIO_CTRL_GET 5 /* man - get the 'IO' type */
102 #define BIO_CTRL_PUSH 6 /* opt - internal, used to signify change */
103 #define BIO_CTRL_POP 7 /* opt - internal, used to signify change */
104 #define BIO_CTRL_GET_CLOSE 8 /* man - set the 'close' on free */
105 #define BIO_CTRL_SET_CLOSE 9 /* man - set the 'close' on free */
106 #define BIO_CTRL_PENDING 10 /* opt - is their more data buffered */
107 #define BIO_CTRL_FLUSH 11 /* opt - 'flush' buffered output */
108 #define BIO_CTRL_DUP 12 /* man - extra stuff for 'duped' BIO */
109 #define BIO_CTRL_WPENDING 13 /* opt - number of bytes still to write */
110
111 #define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */
112
113 /* modifiers */
114 #define BIO_FP_READ 0x02
115 #define BIO_FP_WRITE 0x04
116 #define BIO_FP_APPEND 0x08
117 #define BIO_FP_TEXT 0x10
118
119 #define BIO_FLAGS_READ 0x01
120 #define BIO_FLAGS_WRITE 0x02
121 #define BIO_FLAGS_IO_SPECIAL 0x04
122 #define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
123 #define BIO_FLAGS_SHOULD_RETRY 0x08
124
125 /* Mostly used in the SSL BIO */
126 #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10
127 #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20
128 #define BIO_FLAGS_PROTOCOL_STARTUP 0x40
129
130 #define BIO_set_flags(b,f) ((b)->flags|=(f))
131 #define BIO_set_retry_special(b) \
132 ((b)->flags|=(BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY))
133 #define BIO_set_retry_read(b) \
134 ((b)->flags|=(BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
135 #define BIO_set_retry_write(b) \
136 ((b)->flags|=(BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))
137
138 /* These are normally used internally in BIOs */
139 #define BIO_clear_flags(b,f) ((b)->flags&= ~(f))
140 #define BIO_clear_retry_flags(b) \
141 ((b)->flags&= ~(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
142 #define BIO_get_retry_flags(b) \
143 ((b)->flags&(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
144
145 /* These shouldbe used by the application to tell why we should retry */
146 #define BIO_should_read(a) ((a)->flags & BIO_FLAGS_READ)
147 #define BIO_should_write(a) ((a)->flags & BIO_FLAGS_WRITE)
148 #define BIO_should_io_special(a) ((a)->flags & BIO_FLAGS_IO_SPECIAL)
149 #define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS)
150 #define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY)
151
152 /* The next two are used in conjunction with the
153 * BIO_should_io_special() condition. After this returns true,
154 * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO
155 * stack and return the 'reason' for the special and the offending BIO.
156 * Given a BIO, BIO_get_retry_reason(bio) will return the code. */
157 /* Returned from the SSL bio when the certificate retrieval code had an error */
158 #define BIO_RR_SSL_X509_LOOKUP 0x01
159 /* Returned from the connect BIO when a connect would have blocked */
160 #define BIO_RR_CONNECT 0x02
161
162 /* These are passed by the BIO callback */
163 #define BIO_CB_FREE 0x01
164 #define BIO_CB_READ 0x02
165 #define BIO_CB_WRITE 0x03
166 #define BIO_CB_PUTS 0x04
167 #define BIO_CB_GETS 0x05
168 #define BIO_CB_CTRL 0x06
169
170 /* The callback is called before and after the underling operation,
171 * The BIO_CB_RETURN flag indicates if it is after the call */
172 #define BIO_CB_RETURN 0x80
173 #define BIO_CB_return(a) ((a)|BIO_CB_RETURN))
174 #define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN))
175 #define BIO_cb_post(a) ((a)&BIO_CB_RETURN)
176
177 #define BIO_set_callback(b,cb) ((b)->callback=(cb))
178 #define BIO_set_callback_arg(b,arg) ((b)->cb_arg=(char *)(arg))
179 #define BIO_get_callback_arg(b) ((b)->cb_arg)
180 #define BIO_get_callback(b) ((b)->callback)
181 #define BIO_method_name(b) ((b)->method->name)
182 #define BIO_method_type(b) ((b)->method->type)
183
184 #ifndef WIN16
185 typedef struct bio_method_st
186 {
187 int type;
188 char *name;
189 int (*bwrite)();
190 int (*bread)();
191 int (*bputs)();
192 int (*bgets)();
193 long (*ctrl)();
194 int (*create)();
195 int (*destroy)();
196 } BIO_METHOD;
197 #else
198 typedef struct bio_method_st
199 {
200 int type;
201 char *name;
202 int (_far *bwrite)();
203 int (_far *bread)();
204 int (_far *bputs)();
205 int (_far *bgets)();
206 long (_far *ctrl)();
207 int (_far *create)();
208 int (_far *destroy)();
209 } BIO_METHOD;
210 #endif
211
212 typedef struct bio_st
213 {
214 BIO_METHOD *method;
215 #ifndef NOPROTO
216 /* bio, mode, argp, argi, argl, ret */
217 long (*callback)(struct bio_st *,int,char *,int, long,long);
218 #else
219 long (*callback)();
220 #endif
221 char *cb_arg; /* first argument for the callback */
222
223 int init;
224 int shutdown;
225 int flags; /* extra storage */
226 int retry_reason;
227 int num;
228 char *ptr;
229 struct bio_st *next_bio; /* used by filter BIOs */
230 struct bio_st *prev_bio; /* used by filter BIOs */
231 int references;
232 unsigned long num_read;
233 unsigned long num_write;
234
235 char *app_data;
236 } BIO;
237
238 typedef struct bio_f_buffer_ctx_struct
239 {
240 /* BIO *bio; */ /* this is now in the BIO struct */
241 int ibuf_size; /* how big is the input buffer */
242 int obuf_size; /* how big is the output buffer */
243
244 char *ibuf; /* the char array */
245 int ibuf_len; /* how many bytes are in it */
246 int ibuf_off; /* write/read offset */
247
248 char *obuf; /* the char array */
249 int obuf_len; /* how many bytes are in it */
250 int obuf_off; /* write/read offset */
251 } BIO_F_BUFFER_CTX;
252
253 #define BIO_number_read(b) ((b)->num_read)
254 #define BIO_number_written(b) ((b)->num_write)
255
256 #define BIO_C_SET_CONNECT 100
257 #define BIO_C_DO_STATE_MACHINE 101
258 #define BIO_C_SET_NBIO 102
259 #define BIO_C_SET_PROXY_PARAM 103
260 #define BIO_C_SET_FD 104
261 #define BIO_C_GET_FD 105
262 #define BIO_C_SET_FILE_PTR 106
263 #define BIO_C_GET_FILE_PTR 107
264 #define BIO_C_SET_FILENAME 108
265 #define BIO_C_SET_SSL 109
266 #define BIO_C_GET_SSL 110
267 #define BIO_C_SET_MD 111
268 #define BIO_C_GET_MD 112
269 #define BIO_C_GET_CIPHER_STATUS 113
270 #define BIO_C_SET_BUF_MEM 114
271 #define BIO_C_GET_BUF_MEM_PTR 115
272 #define BIO_C_GET_BUFF_NUM_LINES 116
273 #define BIO_C_SET_BUFF_SIZE 117
274 #define BIO_C_SET_ACCEPT 118
275 #define BIO_C_SSL_MODE 119
276 #define BIO_C_GET_MD_CTX 120
277 #define BIO_C_GET_PROXY_PARAM 121
278
279 #define BIO_set_app_data(s,arg) ((s)->app_data=(char *)arg)
280 #define BIO_get_app_data(s) ((s)->app_data)
281
282 /* BIO_s_connect_socket() */
283 #define BIO_set_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name)
284 #define BIO_set_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port)
285 #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
286
287 /* BIO_s_accept_socket() */
288 #define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name)
289 /* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */
290 #define BIO_set_nbio_accpet(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a":NULL)
291 #define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio)
292
293 #define BIO_do_connect(b) BIO_do_handshake(b)
294 #define BIO_do_accept(b) BIO_do_handshake(b)
295 #define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
296
297 /* BIO_s_proxy_client() */
298 #define BIO_set_url(b,url) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url))
299 #define BIO_set_proxies(b,p) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p))
300 /* BIO_set_nbio(b,n) */
301 #define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s))
302 /* BIO *BIO_get_filter_bio(BIO *bio); */
303 #define BIO_set_proxy_cb(b,cb) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(char *)(cb))
304 #define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk)
305
306 #define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp)
307 #define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p))
308 #define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))
309
310 #define BIO_set_fd(b,fd,c) BIO_ctrl_int(b,BIO_C_SET_FD,c,fd)
311 #define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)
312
313 #define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)
314 #define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)
315
316 #define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
317 BIO_CLOSE|BIO_FP_READ,name)
318 #define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
319 BIO_CLOSE|BIO_FP_WRITE,name)
320 #define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
321 BIO_CLOSE|BIO_FP_APPEND,name)
322
323 #define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl)
324 #define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp)
325 #define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL)
326
327 /* defined in evp.h */
328 /* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */
329
330 #define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm)
331 #define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp)
332
333 /* For the BIO_f_buffer() type */
334 #define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)
335 #define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)
336 #define BIO_set_read_buffer_size(b,size) BIO_ctrl_int(b,BIO_C_SET_BUFF_SIZE,size,0)
337 #define BIO_set_write_buffer_size(b,size) BIO_ctrl_int(b,BIO_C_SET_BUFF_SIZE,size,1)
338
339 /* Don't use the next one unless you know what you are doing :-) */
340 #define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)ret)
341
342 #define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)
343 #define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL)
344 #define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)
345 #define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL)
346 #define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)
347 #define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL)
348 #define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
349
350 /* For the BIO_f_buffer() type */
351 #define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL)
352
353 #ifndef NOPROTO
354 BIO * BIO_new(BIO_METHOD *type);
355 int BIO_set(BIO *a,BIO_METHOD *type);
356 int BIO_free(BIO *a);
357 int BIO_read(BIO *b, char *data, int len);
358 int BIO_gets(BIO *bp,char *buf, int size);
359 int BIO_write(BIO *b, char *data, int len);
360 int BIO_puts(BIO *bp,char *buf);
361 long BIO_ctrl(BIO *bp,int cmd,long larg,char *parg);
362 long BIO_ctrl_int(BIO *bp,int cmd,long larg,int iarg);
363 BIO * BIO_push(BIO *b,BIO *append);
364 BIO * BIO_pop(BIO *b);
365 void BIO_free_all(BIO *a);
366 BIO * BIO_find_type(BIO *b,int bio_type);
367 BIO * BIO_get_retry_BIO(BIO *bio, int *reason);
368 int BIO_get_retry_reason(BIO *bio);
369 BIO * BIO_dup_chain(BIO *in);
370
371 #ifndef WIN16
372 long BIO_debug_callback(BIO *bio,int cmd,char *argp,int argi,
373 long argl,long ret);
374 #else
375 long _far _loadds BIO_debug_callback(BIO *bio,int cmd,char *argp,int argi,
376 long argl,long ret);
377 #endif
378
379 #if !defined(WIN16) || defined(APPS_WIN16)
380 BIO_METHOD *BIO_s_file(void);
381 #else
382 BIO_METHOD *BIO_s_file_internal_w16(void);
383 #endif
384
385 BIO_METHOD *BIO_s_mem(void);
386 BIO_METHOD *BIO_s_socket(void);
387 BIO_METHOD *BIO_s_connect(void);
388 BIO_METHOD *BIO_s_accept(void);
389 BIO_METHOD *BIO_s_fd(void);
390 BIO_METHOD *BIO_s_null(void);
391 BIO_METHOD *BIO_f_null(void);
392 BIO_METHOD *BIO_f_nbio_test(void);
393 BIO_METHOD *BIO_f_buffer(void);
394
395 int BIO_sock_should_retry(int i);
396 int BIO_sock_non_fatal_error(int error);
397 int BIO_fd_should_retry(int i);
398 int BIO_fd_non_fatal_error(int error);
399 int BIO_dump(BIO *b,char *bytes,int len);
400
401 struct hostent *BIO_gethostbyname(char *name);
402 int BIO_sock_error(int sock);
403 int BIO_socket_ioctl(int fd, long type, unsigned long *arg);
404 int BIO_get_port(char *str, short *port_ptr);
405 int BIO_get_host_ip(char *str, unsigned char *ip);
406 int BIO_get_accept_socket(char *host_port);
407 int BIO_accept(int sock,char **ip_port);
408 int BIO_sock_init(void );
409 void BIO_sock_cleanup(void);
410 int BIO_set_tcp_ndelay(int sock,int turn_on);
411
412 void ERR_load_BIO_strings(void );
413
414 #if !defined(WIN16) || defined(APPS_WIN16)
415 BIO *BIO_new_file(char *filename, char *mode);
416 BIO *BIO_new_fp(FILE *stream, int close_flag);
417 #endif
418 BIO *BIO_new_socket(int sock, int close_flag);
419 BIO *BIO_new_fd(int fd, int close_flag);
420 BIO *BIO_new_connect(char *host_port);
421 BIO *BIO_new_accept(char *host_port);
422
423 void BIO_copy_next_retry(BIO *b);
424
425 #else
426
427 BIO * BIO_new();
428 int BIO_set();
429 int BIO_free();
430 int BIO_read();
431 int BIO_gets();
432 int BIO_write();
433 int BIO_puts();
434 long BIO_ctrl();
435 long BIO_ctrl_int();
436 BIO * BIO_push();
437 BIO * BIO_pop();
438 void BIO_free_all();
439 BIO * BIO_find_type();
440 BIO * BIO_get_retry_BIO();
441 int BIO_get_retry_reason();
442 BIO * BIO_dup_chain();
443
444 #ifndef WIN16
445 long BIO_debug_callback();
446 #else
447 long _far _loadds BIO_debug_callback();
448 #endif
449
450 #if !defined(WIN16) || defined(APPS_WIN16)
451 BIO_METHOD *BIO_s_file();
452 #else
453 BIO_METHOD *BIO_s_file_internal_w16();
454 #endif
455
456 BIO_METHOD *BIO_s_mem();
457 BIO_METHOD *BIO_s_socket();
458 BIO_METHOD *BIO_s_connect();
459 BIO_METHOD *BIO_s_accept();
460 BIO_METHOD *BIO_s_fd();
461 BIO_METHOD *BIO_s_null();
462 BIO_METHOD *BIO_f_null();
463 BIO_METHOD *BIO_f_buffer();
464 BIO_METHOD *BIO_f_nbio_test();
465
466 int BIO_sock_should_retry();
467 int BIO_sock_non_fatal_error();
468 int BIO_fd_should_retry();
469 int BIO_fd_non_fatal_error();
470 int BIO_dump();
471
472 struct hostent *BIO_gethostbyname();
473 int BIO_sock_error();
474 int BIO_socket_ioctl();
475 int BIO_get_port();
476 int BIO_get_host_ip();
477 int BIO_get_accept_socket();
478 int BIO_accept();
479 int BIO_sock_init();
480 void BIO_sock_cleanup();
481 int BIO_set_tcp_ndelay();
482
483 void ERR_load_BIO_strings();
484
485 #if !defined(WIN16) || defined(APPS_WIN16)
486 BIO *BIO_new_file();
487 BIO *BIO_new_fp();
488 #endif
489 BIO *BIO_new_socket();
490 BIO *BIO_new_fd();
491 BIO *BIO_new_connect();
492 BIO *BIO_new_accept();
493
494 void BIO_copy_next_retry();
495
496 #endif
497
498 /* Tim Hudson's portable varargs stuff */
499
500 #ifndef NOPROTO
501 #define VAR_ANSI /* select ANSI version by default */
502 #endif
503
504 #ifdef VAR_ANSI
505 /* ANSI version of a "portable" macro set for variable length args */
506 #ifndef __STDARG_H__ /**/
507 #include <stdarg.h>
508 #endif /**/
509
510 #define VAR_PLIST(arg1type,arg1) arg1type arg1, ...
511 #define VAR_PLIST2(arg1type,arg1,arg2type,arg2) arg1type arg1,arg2type arg2,...
512 #define VAR_ALIST
513 #define VAR_BDEFN(args,arg1type,arg1) va_list args
514 #define VAR_BDEFN2(args,arg1type,arg1,arg2type,arg2) va_list args
515 #define VAR_INIT(args,arg1type,arg1) va_start(args,arg1);
516 #define VAR_INIT2(args,arg1type,arg1,arg2type,arg2) va_start(args,arg2);
517 #define VAR_ARG(args,type,arg) arg=va_arg(args,type)
518 #define VAR_END(args) va_end(args);
519
520 #else
521
522 /* K&R version of a "portable" macro set for variable length args */
523 #ifndef __VARARGS_H__
524 #include <varargs.h>
525 #endif
526
527 #define VAR_PLIST(arg1type,arg1) va_alist
528 #define VAR_PLIST2(arg1type,arg1,arg2type,arg2) va_alist
529 #define VAR_ALIST va_dcl
530 #define VAR_BDEFN(args,arg1type,arg1) va_list args; arg1type arg1
531 #define VAR_BDEFN2(args,arg1type,arg1,arg2type,arg2) va_list args; \
532 arg1type arg1; arg2type arg2
533 #define VAR_INIT(args,arg1type,arg1) va_start(args); \
534 arg1=va_arg(args,arg1type);
535 #define VAR_INIT2(args,arg1type,arg1,arg2type,arg2) va_start(args); \
536 arg1=va_arg(args,arg1type); arg2=va_arg(args,arg2type);
537 #define VAR_ARG(args,type,arg) arg=va_arg(args,type)
538 #define VAR_END(args) va_end(args);
539
540 #endif
541
542 #ifndef NOPROTO
543 int BIO_printf( VAR_PLIST( BIO *, bio ) );
544 #else
545 int BIO_printf();
546 #endif
547
548 /* BEGIN ERROR CODES */
549 /* Error codes for the BIO functions. */
550
551 /* Function codes. */
552 #define BIO_F_ACPT_STATE 100
553 #define BIO_F_BIO_ACCEPT 101
554 #define BIO_F_BIO_CTRL 102
555 #define BIO_F_BIO_GETS 103
556 #define BIO_F_BIO_GET_ACCEPT_SOCKET 104
557 #define BIO_F_BIO_GET_HOST_IP 105
558 #define BIO_F_BIO_GET_PORT 106
559 #define BIO_F_BIO_NEW 107
560 #define BIO_F_BIO_NEW_FILE 108
561 #define BIO_F_BIO_PUTS 109
562 #define BIO_F_BIO_READ 110
563 #define BIO_F_BIO_SOCK_INIT 111
564 #define BIO_F_BIO_WRITE 112
565 #define BIO_F_CONN_STATE 113
566 #define BIO_F_FILE_CTRL 114
567 #define BIO_F_MEM_WRITE 115
568 #define BIO_F_WSASTARTUP 116
569
570 /* Reason codes. */
571 #define BIO_R_ACCEPT_ERROR 100
572 #define BIO_R_BAD_FOPEN_MODE 101
573 #define BIO_R_BAD_HOSTNAME_LOOKUP 102
574 #define BIO_R_CONNECT_ERROR 103
575 #define BIO_R_ERROR_SETTING_NBIO 104
576 #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105
577 #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106
578 #define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107
579 #define BIO_R_INVALID_IP_ADDRESS 108
580 #define BIO_R_NBIO_CONNECT_ERROR 109
581 #define BIO_R_NO_ACCEPT_PORT_SPECIFIED 110
582 #define BIO_R_NO_HOSTHNAME_SPECIFIED 111
583 #define BIO_R_NO_PORT_DEFINED 112
584 #define BIO_R_NO_PORT_SPECIFIED 113
585 #define BIO_R_NULL_PARAMETER 114
586 #define BIO_R_UNABLE_TO_BIND_SOCKET 115
587 #define BIO_R_UNABLE_TO_CREATE_SOCKET 116
588 #define BIO_R_UNABLE_TO_LISTEN_SOCKET 117
589 #define BIO_R_UNINITALISED 118
590 #define BIO_R_UNSUPPORTED_METHOD 119
591 #define BIO_R_WSASTARTUP 120
592
593 #ifdef __cplusplus
594 }
595 #endif
596 #endif
597