155714Skris/* crypto/bio/bio.h */ 255714Skris/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 355714Skris * All rights reserved. 455714Skris * 555714Skris * This package is an SSL implementation written 655714Skris * by Eric Young (eay@cryptsoft.com). 755714Skris * The implementation was written so as to conform with Netscapes SSL. 8296465Sdelphij * 955714Skris * This library is free for commercial and non-commercial use as long as 1055714Skris * the following conditions are aheared to. The following conditions 1155714Skris * apply to all code found in this distribution, be it the RC4, RSA, 1255714Skris * lhash, DES, etc., code; not just the SSL code. The SSL documentation 1355714Skris * included with this distribution is covered by the same copyright terms 1455714Skris * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15296465Sdelphij * 1655714Skris * Copyright remains Eric Young's, and as such any Copyright notices in 1755714Skris * the code are not to be removed. 1855714Skris * If this package is used in a product, Eric Young should be given attribution 1955714Skris * as the author of the parts of the library used. 2055714Skris * This can be in the form of a textual message at program startup or 2155714Skris * in documentation (online or textual) provided with the package. 22296465Sdelphij * 2355714Skris * Redistribution and use in source and binary forms, with or without 2455714Skris * modification, are permitted provided that the following conditions 2555714Skris * are met: 2655714Skris * 1. Redistributions of source code must retain the copyright 2755714Skris * notice, this list of conditions and the following disclaimer. 2855714Skris * 2. Redistributions in binary form must reproduce the above copyright 2955714Skris * notice, this list of conditions and the following disclaimer in the 3055714Skris * documentation and/or other materials provided with the distribution. 3155714Skris * 3. All advertising materials mentioning features or use of this software 3255714Skris * must display the following acknowledgement: 3355714Skris * "This product includes cryptographic software written by 3455714Skris * Eric Young (eay@cryptsoft.com)" 3555714Skris * The word 'cryptographic' can be left out if the rouines from the library 3655714Skris * being used are not cryptographic related :-). 37296465Sdelphij * 4. If you include any Windows specific code (or a derivative thereof) from 3855714Skris * the apps directory (application code) you must include an acknowledgement: 3955714Skris * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40296465Sdelphij * 4155714Skris * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 4255714Skris * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4355714Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 4455714Skris * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 4555714Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 4655714Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 4755714Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 4855714Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 4955714Skris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 5055714Skris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 5155714Skris * SUCH DAMAGE. 52296465Sdelphij * 5355714Skris * The licence and distribution terms for any publically available version or 5455714Skris * derivative of this code cannot be changed. i.e. this code cannot simply be 5555714Skris * copied and put under another distribution licence 5655714Skris * [including the GNU Public Licence.] 5755714Skris */ 5855714Skris 5955714Skris#ifndef HEADER_BIO_H 60296465Sdelphij# define HEADER_BIO_H 6155714Skris 62296465Sdelphij# include <openssl/e_os2.h> 63160814Ssimon 64296465Sdelphij# ifndef OPENSSL_NO_FP_API 65296465Sdelphij# include <stdio.h> 66296465Sdelphij# endif 67296465Sdelphij# include <stdarg.h> 6868651Skris 69296465Sdelphij# include <openssl/crypto.h> 7068651Skris 7155714Skris#ifdef __cplusplus 7255714Skrisextern "C" { 7355714Skris#endif 7455714Skris 7555714Skris/* These are the 'types' of BIOs */ 76296465Sdelphij# define BIO_TYPE_NONE 0 77296465Sdelphij# define BIO_TYPE_MEM (1|0x0400) 78296465Sdelphij# define BIO_TYPE_FILE (2|0x0400) 7955714Skris 80296465Sdelphij# define BIO_TYPE_FD (4|0x0400|0x0100) 81296465Sdelphij# define BIO_TYPE_SOCKET (5|0x0400|0x0100) 82296465Sdelphij# define BIO_TYPE_NULL (6|0x0400) 83296465Sdelphij# define BIO_TYPE_SSL (7|0x0200) 84296465Sdelphij# define BIO_TYPE_MD (8|0x0200)/* passive filter */ 85296465Sdelphij# define BIO_TYPE_BUFFER (9|0x0200)/* filter */ 86296465Sdelphij# define BIO_TYPE_CIPHER (10|0x0200)/* filter */ 87296465Sdelphij# define BIO_TYPE_BASE64 (11|0x0200)/* filter */ 88296465Sdelphij# define BIO_TYPE_CONNECT (12|0x0400|0x0100)/* socket - connect */ 89296465Sdelphij# define BIO_TYPE_ACCEPT (13|0x0400|0x0100)/* socket for accept */ 90296465Sdelphij# define BIO_TYPE_PROXY_CLIENT (14|0x0200)/* client proxy BIO */ 91296465Sdelphij# define BIO_TYPE_PROXY_SERVER (15|0x0200)/* server proxy BIO */ 92296465Sdelphij# define BIO_TYPE_NBIO_TEST (16|0x0200)/* server proxy BIO */ 93296465Sdelphij# define BIO_TYPE_NULL_FILTER (17|0x0200) 94296465Sdelphij# define BIO_TYPE_BER (18|0x0200)/* BER -> bin filter */ 95296465Sdelphij# define BIO_TYPE_BIO (19|0x0400)/* (half a) BIO pair */ 96296465Sdelphij# define BIO_TYPE_LINEBUFFER (20|0x0200)/* filter */ 97296465Sdelphij# define BIO_TYPE_DGRAM (21|0x0400|0x0100) 98296465Sdelphij# define BIO_TYPE_COMP (23|0x0200)/* filter */ 9955714Skris 100296465Sdelphij# define BIO_TYPE_DESCRIPTOR 0x0100/* socket, fd, connect or accept */ 101296465Sdelphij# define BIO_TYPE_FILTER 0x0200 102296465Sdelphij# define BIO_TYPE_SOURCE_SINK 0x0400 10355714Skris 104296465Sdelphij/* 105296465Sdelphij * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. 106296465Sdelphij * BIO_set_fp(in,stdin,BIO_NOCLOSE); 107296465Sdelphij */ 108296465Sdelphij# define BIO_NOCLOSE 0x00 109296465Sdelphij# define BIO_CLOSE 0x01 11055714Skris 111296465Sdelphij/* 112296465Sdelphij * These are used in the following macros and are passed to BIO_ctrl() 113296465Sdelphij */ 114296465Sdelphij# define BIO_CTRL_RESET 1/* opt - rewind/zero etc */ 115296465Sdelphij# define BIO_CTRL_EOF 2/* opt - are we at the eof */ 116296465Sdelphij# define BIO_CTRL_INFO 3/* opt - extra tit-bits */ 117296465Sdelphij# define BIO_CTRL_SET 4/* man - set the 'IO' type */ 118296465Sdelphij# define BIO_CTRL_GET 5/* man - get the 'IO' type */ 119296465Sdelphij# define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */ 120296465Sdelphij# define BIO_CTRL_POP 7/* opt - internal, used to signify change */ 121296465Sdelphij# define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */ 122296465Sdelphij# define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */ 123296465Sdelphij# define BIO_CTRL_PENDING 10/* opt - is their more data buffered */ 124296465Sdelphij# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */ 125296465Sdelphij# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */ 126296465Sdelphij# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */ 12755714Skris/* callback is int cb(BIO *bio,state,ret); */ 128296465Sdelphij# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ 129296465Sdelphij# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ 13055714Skris 131296465Sdelphij# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ 13255714Skris 133160814Ssimon/* dgram BIO stuff */ 134296465Sdelphij# define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */ 135296465Sdelphij# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected 136296465Sdelphij * socket to be passed in */ 137296465Sdelphij# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */ 138296465Sdelphij# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */ 139296465Sdelphij# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */ 140296465Sdelphij# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */ 141160814Ssimon 142296465Sdelphij# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */ 143296465Sdelphij# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */ 144296465Sdelphij 145160814Ssimon/* #ifdef IP_MTU_DISCOVER */ 146296465Sdelphij# define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */ 147160814Ssimon/* #endif */ 148160814Ssimon 149296465Sdelphij# define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */ 150296465Sdelphij# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 151296465Sdelphij# define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */ 152296465Sdelphij# define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU. 153296465Sdelphij * want to use this if asking 154296465Sdelphij * the kernel fails */ 155160814Ssimon 156296465Sdelphij# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was 157296465Sdelphij * exceed in the previous write 158296465Sdelphij * operation */ 159160814Ssimon 160296465Sdelphij# define BIO_CTRL_DGRAM_GET_PEER 46 161296465Sdelphij# define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */ 162160814Ssimon 163296465Sdelphij# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout 164296465Sdelphij * to * adjust socket timeouts */ 165160814Ssimon 16655714Skris/* modifiers */ 167296465Sdelphij# define BIO_FP_READ 0x02 168296465Sdelphij# define BIO_FP_WRITE 0x04 169296465Sdelphij# define BIO_FP_APPEND 0x08 170296465Sdelphij# define BIO_FP_TEXT 0x10 17155714Skris 172296465Sdelphij# define BIO_FLAGS_READ 0x01 173296465Sdelphij# define BIO_FLAGS_WRITE 0x02 174296465Sdelphij# define BIO_FLAGS_IO_SPECIAL 0x04 175296465Sdelphij# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) 176296465Sdelphij# define BIO_FLAGS_SHOULD_RETRY 0x08 177296465Sdelphij# ifndef BIO_FLAGS_UPLINK 178296465Sdelphij/* 179296465Sdelphij * "UPLINK" flag denotes file descriptors provided by application. It 180296465Sdelphij * defaults to 0, as most platforms don't require UPLINK interface. 181296465Sdelphij */ 182296465Sdelphij# define BIO_FLAGS_UPLINK 0 183296465Sdelphij# endif 18455714Skris 18555714Skris/* Used in BIO_gethostbyname() */ 186296465Sdelphij# define BIO_GHBN_CTRL_HITS 1 187296465Sdelphij# define BIO_GHBN_CTRL_MISSES 2 188296465Sdelphij# define BIO_GHBN_CTRL_CACHE_SIZE 3 189296465Sdelphij# define BIO_GHBN_CTRL_GET_ENTRY 4 190296465Sdelphij# define BIO_GHBN_CTRL_FLUSH 5 19155714Skris 19255714Skris/* Mostly used in the SSL BIO */ 193296465Sdelphij/*- 194296465Sdelphij * Not used anymore 19555714Skris * #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10 19655714Skris * #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20 197296465Sdelphij * #define BIO_FLAGS_PROTOCOL_STARTUP 0x40 19855714Skris */ 19955714Skris 200296465Sdelphij# define BIO_FLAGS_BASE64_NO_NL 0x100 20155714Skris 202296465Sdelphij/* 203296465Sdelphij * This is used with memory BIOs: it means we shouldn't free up or change the 20459191Skris * data in any way. 20559191Skris */ 206296465Sdelphij# define BIO_FLAGS_MEM_RDONLY 0x200 20759191Skris 208167612Ssimontypedef struct bio_st BIO; 209167612Ssimon 210167612Ssimonvoid BIO_set_flags(BIO *b, int flags); 211296465Sdelphijint BIO_test_flags(const BIO *b, int flags); 212167612Ssimonvoid BIO_clear_flags(BIO *b, int flags); 213167612Ssimon 214296465Sdelphij# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) 215296465Sdelphij# define BIO_set_retry_special(b) \ 216296465Sdelphij BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) 217296465Sdelphij# define BIO_set_retry_read(b) \ 218296465Sdelphij BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) 219296465Sdelphij# define BIO_set_retry_write(b) \ 220296465Sdelphij BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) 22155714Skris 22255714Skris/* These are normally used internally in BIOs */ 223296465Sdelphij# define BIO_clear_retry_flags(b) \ 224296465Sdelphij BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) 225296465Sdelphij# define BIO_get_retry_flags(b) \ 226296465Sdelphij BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) 22755714Skris 22859191Skris/* These should be used by the application to tell why we should retry */ 229296465Sdelphij# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) 230296465Sdelphij# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) 231296465Sdelphij# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) 232296465Sdelphij# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) 233296465Sdelphij# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) 23455714Skris 235296465Sdelphij/* 236296465Sdelphij * The next three are used in conjunction with the BIO_should_io_special() 237296465Sdelphij * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int 238296465Sdelphij * *reason); will walk the BIO stack and return the 'reason' for the special 239296465Sdelphij * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return 240296465Sdelphij * the code. 241296465Sdelphij */ 242296465Sdelphij/* 243296465Sdelphij * Returned from the SSL bio when the certificate retrieval code had an error 244296465Sdelphij */ 245296465Sdelphij# define BIO_RR_SSL_X509_LOOKUP 0x01 24655714Skris/* Returned from the connect BIO when a connect would have blocked */ 247296465Sdelphij# define BIO_RR_CONNECT 0x02 248109998Smarkm/* Returned from the accept BIO when an accept would have blocked */ 249296465Sdelphij# define BIO_RR_ACCEPT 0x03 25055714Skris 25155714Skris/* These are passed by the BIO callback */ 252296465Sdelphij# define BIO_CB_FREE 0x01 253296465Sdelphij# define BIO_CB_READ 0x02 254296465Sdelphij# define BIO_CB_WRITE 0x03 255296465Sdelphij# define BIO_CB_PUTS 0x04 256296465Sdelphij# define BIO_CB_GETS 0x05 257296465Sdelphij# define BIO_CB_CTRL 0x06 25855714Skris 259296465Sdelphij/* 260296465Sdelphij * The callback is called before and after the underling operation, The 261296465Sdelphij * BIO_CB_RETURN flag indicates if it is after the call 262296465Sdelphij */ 263296465Sdelphij# define BIO_CB_RETURN 0x80 264296465Sdelphij# define BIO_CB_return(a) ((a)|BIO_CB_RETURN)) 265296465Sdelphij# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) 266296465Sdelphij# define BIO_cb_post(a) ((a)&BIO_CB_RETURN) 26755714Skris 268296465Sdelphijlong (*BIO_get_callback(const BIO *b)) (struct bio_st *, int, const char *, 269296465Sdelphij int, long, long); 270296465Sdelphijvoid BIO_set_callback(BIO *b, 271296465Sdelphij long (*callback) (struct bio_st *, int, const char *, 272296465Sdelphij int, long, long)); 273167612Ssimonchar *BIO_get_callback_arg(const BIO *b); 274167612Ssimonvoid BIO_set_callback_arg(BIO *b, char *arg); 27555714Skris 276296465Sdelphijconst char *BIO_method_name(const BIO *b); 277167612Ssimonint BIO_method_type(const BIO *b); 27868651Skris 279296465Sdelphijtypedef void bio_info_cb (struct bio_st *, int, const char *, int, long, 280296465Sdelphij long); 28168651Skris 282296465Sdelphij# ifndef OPENSSL_SYS_WIN16 283296465Sdelphijtypedef struct bio_method_st { 284296465Sdelphij int type; 285296465Sdelphij const char *name; 286296465Sdelphij int (*bwrite) (BIO *, const char *, int); 287296465Sdelphij int (*bread) (BIO *, char *, int); 288296465Sdelphij int (*bputs) (BIO *, const char *); 289296465Sdelphij int (*bgets) (BIO *, char *, int); 290296465Sdelphij long (*ctrl) (BIO *, int, long, void *); 291296465Sdelphij int (*create) (BIO *); 292296465Sdelphij int (*destroy) (BIO *); 293296465Sdelphij long (*callback_ctrl) (BIO *, int, bio_info_cb *); 294296465Sdelphij} BIO_METHOD; 295296465Sdelphij# else 296296465Sdelphijtypedef struct bio_method_st { 297296465Sdelphij int type; 298296465Sdelphij const char *name; 299296465Sdelphij int (_far * bwrite) (); 300296465Sdelphij int (_far * bread) (); 301296465Sdelphij int (_far * bputs) (); 302296465Sdelphij int (_far * bgets) (); 303296465Sdelphij long (_far * ctrl) (); 304296465Sdelphij int (_far * create) (); 305296465Sdelphij int (_far * destroy) (); 306296465Sdelphij long (_far * callback_ctrl) (); 307296465Sdelphij} BIO_METHOD; 308296465Sdelphij# endif 30955714Skris 310296465Sdelphijstruct bio_st { 311296465Sdelphij BIO_METHOD *method; 312296465Sdelphij /* bio, mode, argp, argi, argl, ret */ 313296465Sdelphij long (*callback) (struct bio_st *, int, const char *, int, long, long); 314296465Sdelphij char *cb_arg; /* first argument for the callback */ 315296465Sdelphij int init; 316296465Sdelphij int shutdown; 317296465Sdelphij int flags; /* extra storage */ 318296465Sdelphij int retry_reason; 319296465Sdelphij int num; 320296465Sdelphij void *ptr; 321296465Sdelphij struct bio_st *next_bio; /* used by filter BIOs */ 322296465Sdelphij struct bio_st *prev_bio; /* used by filter BIOs */ 323296465Sdelphij int references; 324296465Sdelphij unsigned long num_read; 325296465Sdelphij unsigned long num_write; 326296465Sdelphij CRYPTO_EX_DATA ex_data; 327296465Sdelphij}; 32855714Skris 32968651SkrisDECLARE_STACK_OF(BIO) 33068651Skris 331296465Sdelphijtypedef struct bio_f_buffer_ctx_struct { 332296465Sdelphij /*- 333296465Sdelphij * Buffers are setup like this: 334296465Sdelphij * 335296465Sdelphij * <---------------------- size -----------------------> 336296465Sdelphij * +---------------------------------------------------+ 337296465Sdelphij * | consumed | remaining | free space | 338296465Sdelphij * +---------------------------------------------------+ 339296465Sdelphij * <-- off --><------- len -------> 340296465Sdelphij */ 341296465Sdelphij /*- BIO *bio; *//* 342296465Sdelphij * this is now in the BIO struct 343296465Sdelphij */ 344296465Sdelphij int ibuf_size; /* how big is the input buffer */ 345296465Sdelphij int obuf_size; /* how big is the output buffer */ 346296465Sdelphij char *ibuf; /* the char array */ 347296465Sdelphij int ibuf_len; /* how many bytes are in it */ 348296465Sdelphij int ibuf_off; /* write/read offset */ 349296465Sdelphij char *obuf; /* the char array */ 350296465Sdelphij int obuf_len; /* how many bytes are in it */ 351296465Sdelphij int obuf_off; /* write/read offset */ 352296465Sdelphij} BIO_F_BUFFER_CTX; 353237998Sjkim 35455714Skris/* connect BIO stuff */ 355296465Sdelphij# define BIO_CONN_S_BEFORE 1 356296465Sdelphij# define BIO_CONN_S_GET_IP 2 357296465Sdelphij# define BIO_CONN_S_GET_PORT 3 358296465Sdelphij# define BIO_CONN_S_CREATE_SOCKET 4 359296465Sdelphij# define BIO_CONN_S_CONNECT 5 360296465Sdelphij# define BIO_CONN_S_OK 6 361296465Sdelphij# define BIO_CONN_S_BLOCKED_CONNECT 7 362296465Sdelphij# define BIO_CONN_S_NBIO 8 363296465Sdelphij/* 364296465Sdelphij * #define BIO_CONN_get_param_hostname BIO_ctrl 365296465Sdelphij */ 36655714Skris 367296465Sdelphij# define BIO_C_SET_CONNECT 100 368296465Sdelphij# define BIO_C_DO_STATE_MACHINE 101 369296465Sdelphij# define BIO_C_SET_NBIO 102 370296465Sdelphij# define BIO_C_SET_PROXY_PARAM 103 371296465Sdelphij# define BIO_C_SET_FD 104 372296465Sdelphij# define BIO_C_GET_FD 105 373296465Sdelphij# define BIO_C_SET_FILE_PTR 106 374296465Sdelphij# define BIO_C_GET_FILE_PTR 107 375296465Sdelphij# define BIO_C_SET_FILENAME 108 376296465Sdelphij# define BIO_C_SET_SSL 109 377296465Sdelphij# define BIO_C_GET_SSL 110 378296465Sdelphij# define BIO_C_SET_MD 111 379296465Sdelphij# define BIO_C_GET_MD 112 380296465Sdelphij# define BIO_C_GET_CIPHER_STATUS 113 381296465Sdelphij# define BIO_C_SET_BUF_MEM 114 382296465Sdelphij# define BIO_C_GET_BUF_MEM_PTR 115 383296465Sdelphij# define BIO_C_GET_BUFF_NUM_LINES 116 384296465Sdelphij# define BIO_C_SET_BUFF_SIZE 117 385296465Sdelphij# define BIO_C_SET_ACCEPT 118 386296465Sdelphij# define BIO_C_SSL_MODE 119 387296465Sdelphij# define BIO_C_GET_MD_CTX 120 388296465Sdelphij# define BIO_C_GET_PROXY_PARAM 121 389296465Sdelphij# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */ 390296465Sdelphij# define BIO_C_GET_CONNECT 123 391296465Sdelphij# define BIO_C_GET_ACCEPT 124 392296465Sdelphij# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 393296465Sdelphij# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 394296465Sdelphij# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 395296465Sdelphij# define BIO_C_FILE_SEEK 128 396296465Sdelphij# define BIO_C_GET_CIPHER_CTX 129 397296465Sdelphij# define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input 398296465Sdelphij * value */ 399296465Sdelphij# define BIO_C_SET_BIND_MODE 131 400296465Sdelphij# define BIO_C_GET_BIND_MODE 132 401296465Sdelphij# define BIO_C_FILE_TELL 133 402296465Sdelphij# define BIO_C_GET_SOCKS 134 403296465Sdelphij# define BIO_C_SET_SOCKS 135 40455714Skris 405296465Sdelphij# define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ 406296465Sdelphij# define BIO_C_GET_WRITE_BUF_SIZE 137 407296465Sdelphij# define BIO_C_MAKE_BIO_PAIR 138 408296465Sdelphij# define BIO_C_DESTROY_BIO_PAIR 139 409296465Sdelphij# define BIO_C_GET_WRITE_GUARANTEE 140 410296465Sdelphij# define BIO_C_GET_READ_REQUEST 141 411296465Sdelphij# define BIO_C_SHUTDOWN_WR 142 412296465Sdelphij# define BIO_C_NREAD0 143 413296465Sdelphij# define BIO_C_NREAD 144 414296465Sdelphij# define BIO_C_NWRITE0 145 415296465Sdelphij# define BIO_C_NWRITE 146 416296465Sdelphij# define BIO_C_RESET_READ_REQUEST 147 417296465Sdelphij# define BIO_C_SET_MD_CTX 148 41855714Skris 419296465Sdelphij# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) 420296465Sdelphij# define BIO_get_app_data(s) BIO_get_ex_data(s,0) 42155714Skris 42255714Skris/* BIO_s_connect() and BIO_s_socks4a_connect() */ 423296465Sdelphij# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name) 424296465Sdelphij# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port) 425296465Sdelphij# define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip) 426296465Sdelphij# define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) 427296465Sdelphij# define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) 428296465Sdelphij# define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) 429296465Sdelphij# define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) 430296465Sdelphij# define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0) 43155714Skris 432296465Sdelphij# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) 43355714Skris 43455714Skris/* BIO_s_accept_socket() */ 435296465Sdelphij# define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) 436296465Sdelphij# define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) 437296465Sdelphij/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ 438296465Sdelphij# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?(void *)"a":NULL) 439296465Sdelphij# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) 44055714Skris 441296465Sdelphij# define BIO_BIND_NORMAL 0 442296465Sdelphij# define BIO_BIND_REUSEADDR_IF_UNUSED 1 443296465Sdelphij# define BIO_BIND_REUSEADDR 2 444296465Sdelphij# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) 445296465Sdelphij# define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) 44655714Skris 447296465Sdelphij# define BIO_do_connect(b) BIO_do_handshake(b) 448296465Sdelphij# define BIO_do_accept(b) BIO_do_handshake(b) 449296465Sdelphij# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) 45055714Skris 45155714Skris/* BIO_s_proxy_client() */ 452296465Sdelphij# define BIO_set_url(b,url) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url)) 453296465Sdelphij# define BIO_set_proxies(b,p) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p)) 45455714Skris/* BIO_set_nbio(b,n) */ 455296465Sdelphij# define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s)) 45655714Skris/* BIO *BIO_get_filter_bio(BIO *bio); */ 457296465Sdelphij# define BIO_set_proxy_cb(b,cb) BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(void *(*cb)())) 458296465Sdelphij# define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk) 459296465Sdelphij# define BIO_set_no_connect_return(b,bool) BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,bool) 46055714Skris 461296465Sdelphij# define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp) 462296465Sdelphij# define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p)) 463296465Sdelphij# define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url)) 464296465Sdelphij# define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL) 46555714Skris 466296465Sdelphij# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) 467296465Sdelphij# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) 46855714Skris 469296465Sdelphij# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp) 470296465Sdelphij# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp) 47155714Skris 472296465Sdelphij# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) 473296465Sdelphij# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) 47455714Skris 475296465Sdelphij/* 476296465Sdelphij * name is cast to lose const, but might be better to route through a 477296465Sdelphij * function so we can do it safely 478296465Sdelphij */ 479296465Sdelphij# ifdef CONST_STRICT 480296465Sdelphij/* 481296465Sdelphij * If you are wondering why this isn't defined, its because CONST_STRICT is 48255714Skris * purely a compile-time kludge to allow const to be checked. 48355714Skris */ 484296465Sdelphijint BIO_read_filename(BIO *b, const char *name); 485296465Sdelphij# else 486296465Sdelphij# define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ 487296465Sdelphij BIO_CLOSE|BIO_FP_READ,(char *)name) 488296465Sdelphij# endif 489296465Sdelphij# define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ 490296465Sdelphij BIO_CLOSE|BIO_FP_WRITE,name) 491296465Sdelphij# define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ 492296465Sdelphij BIO_CLOSE|BIO_FP_APPEND,name) 493296465Sdelphij# define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ 494296465Sdelphij BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) 49555714Skris 496296465Sdelphij/* 497296465Sdelphij * WARNING WARNING, this ups the reference count on the read bio of the SSL 498296465Sdelphij * structure. This is because the ssl read BIO is now pointed to by the 499296465Sdelphij * next_bio field in the bio. So when you free the BIO, make sure you are 500296465Sdelphij * doing a BIO_free_all() to catch the underlying BIO. 501296465Sdelphij */ 502296465Sdelphij# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) 503296465Sdelphij# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) 504296465Sdelphij# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) 505296465Sdelphij# define BIO_set_ssl_renegotiate_bytes(b,num) \ 506296465Sdelphij BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL); 507296465Sdelphij# define BIO_get_num_renegotiates(b) \ 508296465Sdelphij BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL); 509296465Sdelphij# define BIO_set_ssl_renegotiate_timeout(b,seconds) \ 510296465Sdelphij BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL); 51155714Skris 51255714Skris/* defined in evp.h */ 513296465Sdelphij/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */ 51455714Skris 515296465Sdelphij# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp) 516296465Sdelphij# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm) 517296465Sdelphij# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp) 518296465Sdelphij# define BIO_set_mem_eof_return(b,v) \ 519296465Sdelphij BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) 52055714Skris 52155714Skris/* For the BIO_f_buffer() type */ 522296465Sdelphij# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) 523296465Sdelphij# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) 524296465Sdelphij# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) 525296465Sdelphij# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) 526296465Sdelphij# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) 52755714Skris 52855714Skris/* Don't use the next one unless you know what you are doing :-) */ 529296465Sdelphij# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) 53055714Skris 531296465Sdelphij# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) 532296465Sdelphij# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) 533296465Sdelphij# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) 534296465Sdelphij# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) 535296465Sdelphij# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) 536296465Sdelphij# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) 53755714Skris/* ...pending macros have inappropriate return type */ 53855714Skrissize_t BIO_ctrl_pending(BIO *b); 53955714Skrissize_t BIO_ctrl_wpending(BIO *b); 540296465Sdelphij# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) 541296465Sdelphij# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ 542296465Sdelphij cbp) 543296465Sdelphij# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) 54455714Skris 54555714Skris/* For the BIO_f_buffer() type */ 546296465Sdelphij# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) 54755714Skris 54855714Skris/* For BIO_s_bio() */ 549296465Sdelphij# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) 550296465Sdelphij# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) 551296465Sdelphij# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) 552296465Sdelphij# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) 553296465Sdelphij# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) 55455714Skris/* macros with inappropriate type -- but ...pending macros use int too: */ 555296465Sdelphij# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) 556296465Sdelphij# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) 55755714Skrissize_t BIO_ctrl_get_write_guarantee(BIO *b); 55855714Skrissize_t BIO_ctrl_get_read_request(BIO *b); 55959191Skrisint BIO_ctrl_reset_read_request(BIO *b); 56055714Skris 561160814Ssimon/* ctrl macros for dgram */ 562296465Sdelphij# define BIO_ctrl_dgram_connect(b,peer) \ 563160814Ssimon (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer) 564296465Sdelphij# define BIO_ctrl_set_connected(b, state, peer) \ 565160814Ssimon (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer) 566296465Sdelphij# define BIO_dgram_recv_timedout(b) \ 567160814Ssimon (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) 568296465Sdelphij# define BIO_dgram_send_timedout(b) \ 569160814Ssimon (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) 570296465Sdelphij# define BIO_dgram_get_peer(b,peer) \ 571205128Ssimon (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)peer) 572296465Sdelphij# define BIO_dgram_set_peer(b,peer) \ 573160814Ssimon (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer) 574160814Ssimon 57555714Skris/* These two aren't currently implemented */ 57655714Skris/* int BIO_get_ex_num(BIO *bio); */ 57755714Skris/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ 578296465Sdelphijint BIO_set_ex_data(BIO *bio, int idx, void *data); 579296465Sdelphijvoid *BIO_get_ex_data(BIO *bio, int idx); 58059191Skrisint BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 581296465Sdelphij CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 58259191Skrisunsigned long BIO_number_read(BIO *bio); 58359191Skrisunsigned long BIO_number_written(BIO *bio); 58455714Skris 585109998Smarkm# ifndef OPENSSL_NO_FP_API 586109998Smarkm# if defined(OPENSSL_SYS_WIN16) && defined(_WINDLL) 58755714SkrisBIO_METHOD *BIO_s_file_internal(void); 58855714SkrisBIO *BIO_new_file_internal(char *filename, char *mode); 58955714SkrisBIO *BIO_new_fp_internal(FILE *stream, int close_flag); 590296465Sdelphij# define BIO_s_file BIO_s_file_internal 591296465Sdelphij# define BIO_new_file BIO_new_file_internal 592296465Sdelphij# define BIO_new_fp BIO_new_fp_internal 593296465Sdelphij# else /* FP_API */ 594296465SdelphijBIO_METHOD *BIO_s_file(void); 59555714SkrisBIO *BIO_new_file(const char *filename, const char *mode); 59655714SkrisBIO *BIO_new_fp(FILE *stream, int close_flag); 597296465Sdelphij# define BIO_s_file_internal BIO_s_file 598296465Sdelphij# define BIO_new_file_internal BIO_new_file 599296465Sdelphij# define BIO_new_fp_internal BIO_s_file 600296465Sdelphij# endif /* FP_API */ 60168651Skris# endif 602296465SdelphijBIO *BIO_new(BIO_METHOD *type); 603296465Sdelphijint BIO_set(BIO *a, BIO_METHOD *type); 604296465Sdelphijint BIO_free(BIO *a); 605296465Sdelphijvoid BIO_vfree(BIO *a); 606296465Sdelphijint BIO_read(BIO *b, void *data, int len); 607296465Sdelphijint BIO_gets(BIO *bp, char *buf, int size); 608296465Sdelphijint BIO_write(BIO *b, const void *data, int len); 609296465Sdelphijint BIO_puts(BIO *bp, const char *buf); 610296465Sdelphijint BIO_indent(BIO *b, int indent, int max); 611296465Sdelphijlong BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); 612296465Sdelphijlong BIO_callback_ctrl(BIO *b, int cmd, 613296465Sdelphij void (*fp) (struct bio_st *, int, const char *, int, 614296465Sdelphij long, long)); 615296465Sdelphijchar *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); 616296465Sdelphijlong BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); 617296465SdelphijBIO *BIO_push(BIO *b, BIO *append); 618296465SdelphijBIO *BIO_pop(BIO *b); 619296465Sdelphijvoid BIO_free_all(BIO *a); 620296465SdelphijBIO *BIO_find_type(BIO *b, int bio_type); 621296465SdelphijBIO *BIO_next(BIO *b); 622296465SdelphijBIO *BIO_get_retry_BIO(BIO *bio, int *reason); 623296465Sdelphijint BIO_get_retry_reason(BIO *bio); 624296465SdelphijBIO *BIO_dup_chain(BIO *in); 62555714Skris 62659191Skrisint BIO_nread0(BIO *bio, char **buf); 62759191Skrisint BIO_nread(BIO *bio, char **buf, int num); 62859191Skrisint BIO_nwrite0(BIO *bio, char **buf); 62959191Skrisint BIO_nwrite(BIO *bio, char **buf, int num); 63059191Skris 631296465Sdelphij# ifndef OPENSSL_SYS_WIN16 632296465Sdelphijlong BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, 633296465Sdelphij long argl, long ret); 634296465Sdelphij# else 635296465Sdelphijlong _far _loadds BIO_debug_callback(BIO *bio, int cmd, const char *argp, 636296465Sdelphij int argi, long argl, long ret); 637296465Sdelphij# endif 63855714Skris 63955714SkrisBIO_METHOD *BIO_s_mem(void); 64059191SkrisBIO *BIO_new_mem_buf(void *buf, int len); 64155714SkrisBIO_METHOD *BIO_s_socket(void); 64255714SkrisBIO_METHOD *BIO_s_connect(void); 64355714SkrisBIO_METHOD *BIO_s_accept(void); 64455714SkrisBIO_METHOD *BIO_s_fd(void); 645296465Sdelphij# ifndef OPENSSL_SYS_OS2 64655714SkrisBIO_METHOD *BIO_s_log(void); 647296465Sdelphij# endif 64855714SkrisBIO_METHOD *BIO_s_bio(void); 64955714SkrisBIO_METHOD *BIO_s_null(void); 65055714SkrisBIO_METHOD *BIO_f_null(void); 65155714SkrisBIO_METHOD *BIO_f_buffer(void); 652296465Sdelphij# ifdef OPENSSL_SYS_VMS 65368651SkrisBIO_METHOD *BIO_f_linebuffer(void); 654296465Sdelphij# endif 65555714SkrisBIO_METHOD *BIO_f_nbio_test(void); 656296465Sdelphij# ifndef OPENSSL_NO_DGRAM 657160814SsimonBIO_METHOD *BIO_s_datagram(void); 658296465Sdelphij# endif 659160814Ssimon 66055714Skris/* BIO_METHOD *BIO_f_ber(void); */ 66155714Skris 66255714Skrisint BIO_sock_should_retry(int i); 66355714Skrisint BIO_sock_non_fatal_error(int error); 664160814Ssimonint BIO_dgram_non_fatal_error(int error); 665160814Ssimon 66655714Skrisint BIO_fd_should_retry(int i); 66755714Skrisint BIO_fd_non_fatal_error(int error); 668296465Sdelphijint BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), 669296465Sdelphij void *u, const char *s, int len); 670296465Sdelphijint BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), 671296465Sdelphij void *u, const char *s, int len, int indent); 672296465Sdelphijint BIO_dump(BIO *b, const char *bytes, int len); 673296465Sdelphijint BIO_dump_indent(BIO *b, const char *bytes, int len, int indent); 674296465Sdelphij# ifndef OPENSSL_NO_FP_API 675160814Ssimonint BIO_dump_fp(FILE *fp, const char *s, int len); 676160814Ssimonint BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); 677296465Sdelphij# endif 67855714Skrisstruct hostent *BIO_gethostbyname(const char *name); 679296465Sdelphij/*- 680296465Sdelphij * We might want a thread-safe interface too: 68155714Skris * struct hostent *BIO_gethostbyname_r(const char *name, 68255714Skris * struct hostent *result, void *buffer, size_t buflen); 68355714Skris * or something similar (caller allocates a struct hostent, 68455714Skris * pointed to by "result", and additional buffer space for the various 68555714Skris * substructures; if the buffer does not suffice, NULL is returned 68655714Skris * and an appropriate error code is set). 68755714Skris */ 68855714Skrisint BIO_sock_error(int sock); 689111147Snectarint BIO_socket_ioctl(int fd, long type, void *arg); 690296465Sdelphijint BIO_socket_nbio(int fd, int mode); 69155714Skrisint BIO_get_port(const char *str, unsigned short *port_ptr); 69255714Skrisint BIO_get_host_ip(const char *str, unsigned char *ip); 693296465Sdelphijint BIO_get_accept_socket(char *host_port, int mode); 694296465Sdelphijint BIO_accept(int sock, char **ip_port); 695296465Sdelphijint BIO_sock_init(void); 69655714Skrisvoid BIO_sock_cleanup(void); 697296465Sdelphijint BIO_set_tcp_ndelay(int sock, int turn_on); 69855714Skris 69955714SkrisBIO *BIO_new_socket(int sock, int close_flag); 700160814SsimonBIO *BIO_new_dgram(int fd, int close_flag); 70155714SkrisBIO *BIO_new_fd(int fd, int close_flag); 70255714SkrisBIO *BIO_new_connect(char *host_port); 70355714SkrisBIO *BIO_new_accept(char *host_port); 70455714Skris 70555714Skrisint BIO_new_bio_pair(BIO **bio1, size_t writebuf1, 706296465Sdelphij BIO **bio2, size_t writebuf2); 707296465Sdelphij/* 708296465Sdelphij * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. 709296465Sdelphij * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default 710296465Sdelphij * value. 71155714Skris */ 71255714Skris 71355714Skrisvoid BIO_copy_next_retry(BIO *b); 71455714Skris 715296465Sdelphij/* 716296465Sdelphij * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); 717296465Sdelphij */ 71855714Skris 719296465Sdelphij# ifdef __GNUC__ 720160814Ssimon# define __bio_h__attr__ __attribute__ 721296465Sdelphij# else 722160814Ssimon# define __bio_h__attr__(x) 723296465Sdelphij# endif 724160814Ssimonint BIO_printf(BIO *bio, const char *format, ...) 725296465Sdelphij__bio_h__attr__((__format__(__printf__, 2, 3))); 726160814Ssimonint BIO_vprintf(BIO *bio, const char *format, va_list args) 727296465Sdelphij__bio_h__attr__((__format__(__printf__, 2, 0))); 728160814Ssimonint BIO_snprintf(char *buf, size_t n, const char *format, ...) 729296465Sdelphij__bio_h__attr__((__format__(__printf__, 3, 4))); 730160814Ssimonint BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) 731296465Sdelphij__bio_h__attr__((__format__(__printf__, 3, 0))); 732296465Sdelphij# undef __bio_h__attr__ 73355714Skris 73455714Skris/* BEGIN ERROR CODES */ 735296465Sdelphij/* 736296465Sdelphij * The following lines are auto generated by the script mkerr.pl. Any changes 73755714Skris * made after this point may be overwritten when the script is next run. 73855714Skris */ 73989837Skrisvoid ERR_load_BIO_strings(void); 74055714Skris 74155714Skris/* Error codes for the BIO functions. */ 74255714Skris 74355714Skris/* Function codes. */ 744296465Sdelphij# define BIO_F_ACPT_STATE 100 745296465Sdelphij# define BIO_F_BIO_ACCEPT 101 746296465Sdelphij# define BIO_F_BIO_BER_GET_HEADER 102 747296465Sdelphij# define BIO_F_BIO_CALLBACK_CTRL 131 748296465Sdelphij# define BIO_F_BIO_CTRL 103 749296465Sdelphij# define BIO_F_BIO_GETHOSTBYNAME 120 750296465Sdelphij# define BIO_F_BIO_GETS 104 751296465Sdelphij# define BIO_F_BIO_GET_ACCEPT_SOCKET 105 752296465Sdelphij# define BIO_F_BIO_GET_HOST_IP 106 753296465Sdelphij# define BIO_F_BIO_GET_PORT 107 754296465Sdelphij# define BIO_F_BIO_MAKE_PAIR 121 755296465Sdelphij# define BIO_F_BIO_NEW 108 756296465Sdelphij# define BIO_F_BIO_NEW_FILE 109 757296465Sdelphij# define BIO_F_BIO_NEW_MEM_BUF 126 758296465Sdelphij# define BIO_F_BIO_NREAD 123 759296465Sdelphij# define BIO_F_BIO_NREAD0 124 760296465Sdelphij# define BIO_F_BIO_NWRITE 125 761296465Sdelphij# define BIO_F_BIO_NWRITE0 122 762296465Sdelphij# define BIO_F_BIO_PUTS 110 763296465Sdelphij# define BIO_F_BIO_READ 111 764296465Sdelphij# define BIO_F_BIO_SOCK_INIT 112 765296465Sdelphij# define BIO_F_BIO_WRITE 113 766296465Sdelphij# define BIO_F_BUFFER_CTRL 114 767296465Sdelphij# define BIO_F_CONN_CTRL 127 768296465Sdelphij# define BIO_F_CONN_STATE 115 769296465Sdelphij# define BIO_F_FILE_CTRL 116 770296465Sdelphij# define BIO_F_FILE_READ 130 771296465Sdelphij# define BIO_F_LINEBUFFER_CTRL 129 772296465Sdelphij# define BIO_F_MEM_READ 128 773296465Sdelphij# define BIO_F_MEM_WRITE 117 774296465Sdelphij# define BIO_F_SSL_NEW 118 775296465Sdelphij# define BIO_F_WSASTARTUP 119 77655714Skris 77755714Skris/* Reason codes. */ 778296465Sdelphij# define BIO_R_ACCEPT_ERROR 100 779296465Sdelphij# define BIO_R_BAD_FOPEN_MODE 101 780296465Sdelphij# define BIO_R_BAD_HOSTNAME_LOOKUP 102 781296465Sdelphij# define BIO_R_BROKEN_PIPE 124 782296465Sdelphij# define BIO_R_CONNECT_ERROR 103 783296465Sdelphij# define BIO_R_EOF_ON_MEMORY_BIO 127 784296465Sdelphij# define BIO_R_ERROR_SETTING_NBIO 104 785296465Sdelphij# define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 786296465Sdelphij# define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 787296465Sdelphij# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 788296465Sdelphij# define BIO_R_INVALID_ARGUMENT 125 789296465Sdelphij# define BIO_R_INVALID_IP_ADDRESS 108 790296465Sdelphij# define BIO_R_IN_USE 123 791296465Sdelphij# define BIO_R_KEEPALIVE 109 792296465Sdelphij# define BIO_R_NBIO_CONNECT_ERROR 110 793296465Sdelphij# define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 794296465Sdelphij# define BIO_R_NO_HOSTNAME_SPECIFIED 112 795296465Sdelphij# define BIO_R_NO_PORT_DEFINED 113 796296465Sdelphij# define BIO_R_NO_PORT_SPECIFIED 114 797296465Sdelphij# define BIO_R_NO_SUCH_FILE 128 798296465Sdelphij# define BIO_R_NULL_PARAMETER 115 799296465Sdelphij# define BIO_R_TAG_MISMATCH 116 800296465Sdelphij# define BIO_R_UNABLE_TO_BIND_SOCKET 117 801296465Sdelphij# define BIO_R_UNABLE_TO_CREATE_SOCKET 118 802296465Sdelphij# define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 803296465Sdelphij# define BIO_R_UNINITIALIZED 120 804296465Sdelphij# define BIO_R_UNSUPPORTED_METHOD 121 805296465Sdelphij# define BIO_R_WRITE_TO_READ_ONLY_BIO 126 806296465Sdelphij# define BIO_R_WSASTARTUP 122 80755714Skris 80855714Skris#ifdef __cplusplus 80955714Skris} 81055714Skris#endif 81155714Skris#endif 812