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