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. 8280304Sjkim * 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). 15280304Sjkim * 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. 22280304Sjkim * 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 :-). 37280304Sjkim * 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)" 40280304Sjkim * 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. 52280304Sjkim * 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 60280304Sjkim# define HEADER_BIO_H 6155714Skris 62280304Sjkim# include <openssl/e_os2.h> 63160814Ssimon 64280304Sjkim# ifndef OPENSSL_NO_FP_API 65280304Sjkim# include <stdio.h> 66280304Sjkim# endif 67280304Sjkim# include <stdarg.h> 6868651Skris 69280304Sjkim# include <openssl/crypto.h> 7068651Skris 71280304Sjkim# ifndef OPENSSL_NO_SCTP 72280304Sjkim# ifndef OPENSSL_SYS_VMS 73280304Sjkim# include <stdint.h> 74280304Sjkim# else 75280304Sjkim# include <inttypes.h> 76280304Sjkim# endif 77238405Sjkim# endif 78238405Sjkim 7955714Skris#ifdef __cplusplus 8055714Skrisextern "C" { 8155714Skris#endif 8255714Skris 8355714Skris/* These are the 'types' of BIOs */ 84280304Sjkim# define BIO_TYPE_NONE 0 85280304Sjkim# define BIO_TYPE_MEM (1|0x0400) 86280304Sjkim# define BIO_TYPE_FILE (2|0x0400) 8755714Skris 88280304Sjkim# define BIO_TYPE_FD (4|0x0400|0x0100) 89280304Sjkim# define BIO_TYPE_SOCKET (5|0x0400|0x0100) 90280304Sjkim# define BIO_TYPE_NULL (6|0x0400) 91280304Sjkim# define BIO_TYPE_SSL (7|0x0200) 92280304Sjkim# define BIO_TYPE_MD (8|0x0200)/* passive filter */ 93280304Sjkim# define BIO_TYPE_BUFFER (9|0x0200)/* filter */ 94280304Sjkim# define BIO_TYPE_CIPHER (10|0x0200)/* filter */ 95280304Sjkim# define BIO_TYPE_BASE64 (11|0x0200)/* filter */ 96280304Sjkim# define BIO_TYPE_CONNECT (12|0x0400|0x0100)/* socket - connect */ 97280304Sjkim# define BIO_TYPE_ACCEPT (13|0x0400|0x0100)/* socket for accept */ 98280304Sjkim# define BIO_TYPE_PROXY_CLIENT (14|0x0200)/* client proxy BIO */ 99280304Sjkim# define BIO_TYPE_PROXY_SERVER (15|0x0200)/* server proxy BIO */ 100280304Sjkim# define BIO_TYPE_NBIO_TEST (16|0x0200)/* server proxy BIO */ 101280304Sjkim# define BIO_TYPE_NULL_FILTER (17|0x0200) 102280304Sjkim# define BIO_TYPE_BER (18|0x0200)/* BER -> bin filter */ 103280304Sjkim# define BIO_TYPE_BIO (19|0x0400)/* (half a) BIO pair */ 104280304Sjkim# define BIO_TYPE_LINEBUFFER (20|0x0200)/* filter */ 105280304Sjkim# define BIO_TYPE_DGRAM (21|0x0400|0x0100) 106280304Sjkim# ifndef OPENSSL_NO_SCTP 107280304Sjkim# define BIO_TYPE_DGRAM_SCTP (24|0x0400|0x0100) 108280304Sjkim# endif 109280304Sjkim# define BIO_TYPE_ASN1 (22|0x0200)/* filter */ 110280304Sjkim# define BIO_TYPE_COMP (23|0x0200)/* filter */ 11155714Skris 112280304Sjkim# define BIO_TYPE_DESCRIPTOR 0x0100/* socket, fd, connect or accept */ 113280304Sjkim# define BIO_TYPE_FILTER 0x0200 114280304Sjkim# define BIO_TYPE_SOURCE_SINK 0x0400 11555714Skris 116280304Sjkim/* 117280304Sjkim * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. 118280304Sjkim * BIO_set_fp(in,stdin,BIO_NOCLOSE); 119280304Sjkim */ 120280304Sjkim# define BIO_NOCLOSE 0x00 121280304Sjkim# define BIO_CLOSE 0x01 12255714Skris 123280304Sjkim/* 124280304Sjkim * These are used in the following macros and are passed to BIO_ctrl() 125280304Sjkim */ 126280304Sjkim# define BIO_CTRL_RESET 1/* opt - rewind/zero etc */ 127280304Sjkim# define BIO_CTRL_EOF 2/* opt - are we at the eof */ 128280304Sjkim# define BIO_CTRL_INFO 3/* opt - extra tit-bits */ 129280304Sjkim# define BIO_CTRL_SET 4/* man - set the 'IO' type */ 130280304Sjkim# define BIO_CTRL_GET 5/* man - get the 'IO' type */ 131280304Sjkim# define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */ 132280304Sjkim# define BIO_CTRL_POP 7/* opt - internal, used to signify change */ 133280304Sjkim# define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */ 134280304Sjkim# define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */ 135280304Sjkim# define BIO_CTRL_PENDING 10/* opt - is their more data buffered */ 136280304Sjkim# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */ 137280304Sjkim# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */ 138280304Sjkim# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */ 13955714Skris/* callback is int cb(BIO *bio,state,ret); */ 140280304Sjkim# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ 141280304Sjkim# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ 14255714Skris 143280304Sjkim# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ 14455714Skris 145160814Ssimon/* dgram BIO stuff */ 146280304Sjkim# define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */ 147280304Sjkim# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected 148280304Sjkim * socket to be passed in */ 149280304Sjkim# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */ 150280304Sjkim# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */ 151280304Sjkim# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */ 152280304Sjkim# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */ 153160814Ssimon 154280304Sjkim# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */ 155280304Sjkim# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */ 156280304Sjkim 157160814Ssimon/* #ifdef IP_MTU_DISCOVER */ 158280304Sjkim# define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */ 159160814Ssimon/* #endif */ 160160814Ssimon 161280304Sjkim# define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */ 162280304Sjkim# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 163280304Sjkim# define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */ 164280304Sjkim# define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU. 165280304Sjkim * want to use this if asking 166280304Sjkim * the kernel fails */ 167160814Ssimon 168280304Sjkim# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was 169280304Sjkim * exceed in the previous write 170280304Sjkim * operation */ 171160814Ssimon 172280304Sjkim# define BIO_CTRL_DGRAM_GET_PEER 46 173280304Sjkim# define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */ 174160814Ssimon 175280304Sjkim# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout 176280304Sjkim * to adjust socket timeouts */ 177160814Ssimon 178280304Sjkim# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 179276864Sjkim 180280304Sjkim# ifndef OPENSSL_NO_SCTP 181238405Sjkim/* SCTP stuff */ 182280304Sjkim# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 183280304Sjkim# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 184280304Sjkim# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 185280304Sjkim# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 186280304Sjkim# define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 187280304Sjkim# define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 188280304Sjkim# define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 189280304Sjkim# define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 190280304Sjkim# define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 191280304Sjkim# define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 192280304Sjkim# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 193280304Sjkim# endif 194238405Sjkim 19555714Skris/* modifiers */ 196280304Sjkim# define BIO_FP_READ 0x02 197280304Sjkim# define BIO_FP_WRITE 0x04 198280304Sjkim# define BIO_FP_APPEND 0x08 199280304Sjkim# define BIO_FP_TEXT 0x10 20055714Skris 201280304Sjkim# define BIO_FLAGS_READ 0x01 202280304Sjkim# define BIO_FLAGS_WRITE 0x02 203280304Sjkim# define BIO_FLAGS_IO_SPECIAL 0x04 204280304Sjkim# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) 205280304Sjkim# define BIO_FLAGS_SHOULD_RETRY 0x08 206280304Sjkim# ifndef BIO_FLAGS_UPLINK 207280304Sjkim/* 208280304Sjkim * "UPLINK" flag denotes file descriptors provided by application. It 209280304Sjkim * defaults to 0, as most platforms don't require UPLINK interface. 210280304Sjkim */ 211280304Sjkim# define BIO_FLAGS_UPLINK 0 212280304Sjkim# endif 21355714Skris 21455714Skris/* Used in BIO_gethostbyname() */ 215280304Sjkim# define BIO_GHBN_CTRL_HITS 1 216280304Sjkim# define BIO_GHBN_CTRL_MISSES 2 217280304Sjkim# define BIO_GHBN_CTRL_CACHE_SIZE 3 218280304Sjkim# define BIO_GHBN_CTRL_GET_ENTRY 4 219280304Sjkim# define BIO_GHBN_CTRL_FLUSH 5 22055714Skris 22155714Skris/* Mostly used in the SSL BIO */ 222280304Sjkim/*- 223280304Sjkim * Not used anymore 22455714Skris * #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10 22555714Skris * #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20 226280304Sjkim * #define BIO_FLAGS_PROTOCOL_STARTUP 0x40 22755714Skris */ 22855714Skris 229280304Sjkim# define BIO_FLAGS_BASE64_NO_NL 0x100 23055714Skris 231280304Sjkim/* 232280304Sjkim * This is used with memory BIOs: it means we shouldn't free up or change the 23359191Skris * data in any way. 23459191Skris */ 235280304Sjkim# define BIO_FLAGS_MEM_RDONLY 0x200 23659191Skris 237167612Ssimontypedef struct bio_st BIO; 238167612Ssimon 239167612Ssimonvoid BIO_set_flags(BIO *b, int flags); 240280304Sjkimint BIO_test_flags(const BIO *b, int flags); 241167612Ssimonvoid BIO_clear_flags(BIO *b, int flags); 242167612Ssimon 243280304Sjkim# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) 244280304Sjkim# define BIO_set_retry_special(b) \ 245280304Sjkim BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) 246280304Sjkim# define BIO_set_retry_read(b) \ 247280304Sjkim BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) 248280304Sjkim# define BIO_set_retry_write(b) \ 249280304Sjkim BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) 25055714Skris 25155714Skris/* These are normally used internally in BIOs */ 252280304Sjkim# define BIO_clear_retry_flags(b) \ 253280304Sjkim BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) 254280304Sjkim# define BIO_get_retry_flags(b) \ 255280304Sjkim BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) 25655714Skris 25759191Skris/* These should be used by the application to tell why we should retry */ 258280304Sjkim# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) 259280304Sjkim# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) 260280304Sjkim# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) 261280304Sjkim# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) 262280304Sjkim# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) 26355714Skris 264280304Sjkim/* 265280304Sjkim * The next three are used in conjunction with the BIO_should_io_special() 266280304Sjkim * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int 267280304Sjkim * *reason); will walk the BIO stack and return the 'reason' for the special 268280304Sjkim * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return 269280304Sjkim * the code. 270280304Sjkim */ 271280304Sjkim/* 272280304Sjkim * Returned from the SSL bio when the certificate retrieval code had an error 273280304Sjkim */ 274280304Sjkim# define BIO_RR_SSL_X509_LOOKUP 0x01 27555714Skris/* Returned from the connect BIO when a connect would have blocked */ 276280304Sjkim# define BIO_RR_CONNECT 0x02 277109998Smarkm/* Returned from the accept BIO when an accept would have blocked */ 278280304Sjkim# define BIO_RR_ACCEPT 0x03 27955714Skris 28055714Skris/* These are passed by the BIO callback */ 281280304Sjkim# define BIO_CB_FREE 0x01 282280304Sjkim# define BIO_CB_READ 0x02 283280304Sjkim# define BIO_CB_WRITE 0x03 284280304Sjkim# define BIO_CB_PUTS 0x04 285280304Sjkim# define BIO_CB_GETS 0x05 286280304Sjkim# define BIO_CB_CTRL 0x06 28755714Skris 288280304Sjkim/* 289280304Sjkim * The callback is called before and after the underling operation, The 290280304Sjkim * BIO_CB_RETURN flag indicates if it is after the call 291280304Sjkim */ 292280304Sjkim# define BIO_CB_RETURN 0x80 293285330Sjkim# define BIO_CB_return(a) ((a)|BIO_CB_RETURN) 294280304Sjkim# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) 295280304Sjkim# define BIO_cb_post(a) ((a)&BIO_CB_RETURN) 29655714Skris 297280304Sjkimlong (*BIO_get_callback(const BIO *b)) (struct bio_st *, int, const char *, 298280304Sjkim int, long, long); 299280304Sjkimvoid BIO_set_callback(BIO *b, 300280304Sjkim long (*callback) (struct bio_st *, int, const char *, 301280304Sjkim int, long, long)); 302167612Ssimonchar *BIO_get_callback_arg(const BIO *b); 303167612Ssimonvoid BIO_set_callback_arg(BIO *b, char *arg); 30455714Skris 305280304Sjkimconst char *BIO_method_name(const BIO *b); 306167612Ssimonint BIO_method_type(const BIO *b); 30768651Skris 308280304Sjkimtypedef void bio_info_cb (struct bio_st *, int, const char *, int, long, 309280304Sjkim long); 31068651Skris 311280304Sjkimtypedef struct bio_method_st { 312280304Sjkim int type; 313280304Sjkim const char *name; 314280304Sjkim int (*bwrite) (BIO *, const char *, int); 315280304Sjkim int (*bread) (BIO *, char *, int); 316280304Sjkim int (*bputs) (BIO *, const char *); 317280304Sjkim int (*bgets) (BIO *, char *, int); 318280304Sjkim long (*ctrl) (BIO *, int, long, void *); 319280304Sjkim int (*create) (BIO *); 320280304Sjkim int (*destroy) (BIO *); 321280304Sjkim long (*callback_ctrl) (BIO *, int, bio_info_cb *); 322280304Sjkim} BIO_METHOD; 32355714Skris 324280304Sjkimstruct bio_st { 325280304Sjkim BIO_METHOD *method; 326280304Sjkim /* bio, mode, argp, argi, argl, ret */ 327280304Sjkim long (*callback) (struct bio_st *, int, const char *, int, long, long); 328280304Sjkim char *cb_arg; /* first argument for the callback */ 329280304Sjkim int init; 330280304Sjkim int shutdown; 331280304Sjkim int flags; /* extra storage */ 332280304Sjkim int retry_reason; 333280304Sjkim int num; 334280304Sjkim void *ptr; 335280304Sjkim struct bio_st *next_bio; /* used by filter BIOs */ 336280304Sjkim struct bio_st *prev_bio; /* used by filter BIOs */ 337280304Sjkim int references; 338280304Sjkim unsigned long num_read; 339280304Sjkim unsigned long num_write; 340280304Sjkim CRYPTO_EX_DATA ex_data; 341280304Sjkim}; 34255714Skris 34368651SkrisDECLARE_STACK_OF(BIO) 34468651Skris 345280304Sjkimtypedef struct bio_f_buffer_ctx_struct { 346280304Sjkim /*- 347280304Sjkim * Buffers are setup like this: 348280304Sjkim * 349280304Sjkim * <---------------------- size -----------------------> 350280304Sjkim * +---------------------------------------------------+ 351280304Sjkim * | consumed | remaining | free space | 352280304Sjkim * +---------------------------------------------------+ 353280304Sjkim * <-- off --><------- len -------> 354280304Sjkim */ 355280304Sjkim /*- BIO *bio; *//* 356280304Sjkim * this is now in the BIO struct 357280304Sjkim */ 358280304Sjkim int ibuf_size; /* how big is the input buffer */ 359280304Sjkim int obuf_size; /* how big is the output buffer */ 360280304Sjkim char *ibuf; /* the char array */ 361280304Sjkim int ibuf_len; /* how many bytes are in it */ 362280304Sjkim int ibuf_off; /* write/read offset */ 363280304Sjkim char *obuf; /* the char array */ 364280304Sjkim int obuf_len; /* how many bytes are in it */ 365280304Sjkim int obuf_off; /* write/read offset */ 366280304Sjkim} BIO_F_BUFFER_CTX; 367237657Sjkim 368238405Sjkim/* Prefix and suffix callback in ASN1 BIO */ 369280304Sjkimtypedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen, 370280304Sjkim void *parg); 371238405Sjkim 372280304Sjkim# ifndef OPENSSL_NO_SCTP 373238405Sjkim/* SCTP parameter structs */ 374280304Sjkimstruct bio_dgram_sctp_sndinfo { 375280304Sjkim uint16_t snd_sid; 376280304Sjkim uint16_t snd_flags; 377280304Sjkim uint32_t snd_ppid; 378280304Sjkim uint32_t snd_context; 379280304Sjkim}; 380238405Sjkim 381280304Sjkimstruct bio_dgram_sctp_rcvinfo { 382280304Sjkim uint16_t rcv_sid; 383280304Sjkim uint16_t rcv_ssn; 384280304Sjkim uint16_t rcv_flags; 385280304Sjkim uint32_t rcv_ppid; 386280304Sjkim uint32_t rcv_tsn; 387280304Sjkim uint32_t rcv_cumtsn; 388280304Sjkim uint32_t rcv_context; 389280304Sjkim}; 390238405Sjkim 391280304Sjkimstruct bio_dgram_sctp_prinfo { 392280304Sjkim uint16_t pr_policy; 393280304Sjkim uint32_t pr_value; 394280304Sjkim}; 395280304Sjkim# endif 396238405Sjkim 39755714Skris/* connect BIO stuff */ 398280304Sjkim# define BIO_CONN_S_BEFORE 1 399280304Sjkim# define BIO_CONN_S_GET_IP 2 400280304Sjkim# define BIO_CONN_S_GET_PORT 3 401280304Sjkim# define BIO_CONN_S_CREATE_SOCKET 4 402280304Sjkim# define BIO_CONN_S_CONNECT 5 403280304Sjkim# define BIO_CONN_S_OK 6 404280304Sjkim# define BIO_CONN_S_BLOCKED_CONNECT 7 405280304Sjkim# define BIO_CONN_S_NBIO 8 406280304Sjkim/* 407280304Sjkim * #define BIO_CONN_get_param_hostname BIO_ctrl 408280304Sjkim */ 40955714Skris 410280304Sjkim# define BIO_C_SET_CONNECT 100 411280304Sjkim# define BIO_C_DO_STATE_MACHINE 101 412280304Sjkim# define BIO_C_SET_NBIO 102 413280304Sjkim# define BIO_C_SET_PROXY_PARAM 103 414280304Sjkim# define BIO_C_SET_FD 104 415280304Sjkim# define BIO_C_GET_FD 105 416280304Sjkim# define BIO_C_SET_FILE_PTR 106 417280304Sjkim# define BIO_C_GET_FILE_PTR 107 418280304Sjkim# define BIO_C_SET_FILENAME 108 419280304Sjkim# define BIO_C_SET_SSL 109 420280304Sjkim# define BIO_C_GET_SSL 110 421280304Sjkim# define BIO_C_SET_MD 111 422280304Sjkim# define BIO_C_GET_MD 112 423280304Sjkim# define BIO_C_GET_CIPHER_STATUS 113 424280304Sjkim# define BIO_C_SET_BUF_MEM 114 425280304Sjkim# define BIO_C_GET_BUF_MEM_PTR 115 426280304Sjkim# define BIO_C_GET_BUFF_NUM_LINES 116 427280304Sjkim# define BIO_C_SET_BUFF_SIZE 117 428280304Sjkim# define BIO_C_SET_ACCEPT 118 429280304Sjkim# define BIO_C_SSL_MODE 119 430280304Sjkim# define BIO_C_GET_MD_CTX 120 431280304Sjkim# define BIO_C_GET_PROXY_PARAM 121 432280304Sjkim# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */ 433280304Sjkim# define BIO_C_GET_CONNECT 123 434280304Sjkim# define BIO_C_GET_ACCEPT 124 435280304Sjkim# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 436280304Sjkim# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 437280304Sjkim# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 438280304Sjkim# define BIO_C_FILE_SEEK 128 439280304Sjkim# define BIO_C_GET_CIPHER_CTX 129 440280304Sjkim# define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input 441280304Sjkim * value */ 442280304Sjkim# define BIO_C_SET_BIND_MODE 131 443280304Sjkim# define BIO_C_GET_BIND_MODE 132 444280304Sjkim# define BIO_C_FILE_TELL 133 445280304Sjkim# define BIO_C_GET_SOCKS 134 446280304Sjkim# define BIO_C_SET_SOCKS 135 44755714Skris 448280304Sjkim# define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ 449280304Sjkim# define BIO_C_GET_WRITE_BUF_SIZE 137 450280304Sjkim# define BIO_C_MAKE_BIO_PAIR 138 451280304Sjkim# define BIO_C_DESTROY_BIO_PAIR 139 452280304Sjkim# define BIO_C_GET_WRITE_GUARANTEE 140 453280304Sjkim# define BIO_C_GET_READ_REQUEST 141 454280304Sjkim# define BIO_C_SHUTDOWN_WR 142 455280304Sjkim# define BIO_C_NREAD0 143 456280304Sjkim# define BIO_C_NREAD 144 457280304Sjkim# define BIO_C_NWRITE0 145 458280304Sjkim# define BIO_C_NWRITE 146 459280304Sjkim# define BIO_C_RESET_READ_REQUEST 147 460280304Sjkim# define BIO_C_SET_MD_CTX 148 46155714Skris 462280304Sjkim# define BIO_C_SET_PREFIX 149 463280304Sjkim# define BIO_C_GET_PREFIX 150 464280304Sjkim# define BIO_C_SET_SUFFIX 151 465280304Sjkim# define BIO_C_GET_SUFFIX 152 46655714Skris 467280304Sjkim# define BIO_C_SET_EX_ARG 153 468280304Sjkim# define BIO_C_GET_EX_ARG 154 469238405Sjkim 470280304Sjkim# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) 471280304Sjkim# define BIO_get_app_data(s) BIO_get_ex_data(s,0) 47255714Skris 47355714Skris/* BIO_s_connect() and BIO_s_socks4a_connect() */ 474280304Sjkim# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name) 475280304Sjkim# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port) 476280304Sjkim# define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip) 477280304Sjkim# define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) 478280304Sjkim# define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) 479280304Sjkim# define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) 480280304Sjkim# define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) 481296317Sdelphij# define BIO_get_conn_int_port(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) 48255714Skris 483280304Sjkim# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) 48455714Skris 485295016Sjkim/* BIO_s_accept() */ 486280304Sjkim# define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) 487280304Sjkim# define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) 488280304Sjkim/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ 489280304Sjkim# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?(void *)"a":NULL) 490280304Sjkim# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) 49155714Skris 492280304Sjkim# define BIO_BIND_NORMAL 0 493280304Sjkim# define BIO_BIND_REUSEADDR_IF_UNUSED 1 494280304Sjkim# define BIO_BIND_REUSEADDR 2 495280304Sjkim# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) 496280304Sjkim# define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) 49755714Skris 498295016Sjkim/* BIO_s_accept() and BIO_s_connect() */ 499280304Sjkim# define BIO_do_connect(b) BIO_do_handshake(b) 500280304Sjkim# define BIO_do_accept(b) BIO_do_handshake(b) 501280304Sjkim# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) 50255714Skris 50355714Skris/* BIO_s_proxy_client() */ 504280304Sjkim# define BIO_set_url(b,url) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url)) 505280304Sjkim# define BIO_set_proxies(b,p) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p)) 50655714Skris/* BIO_set_nbio(b,n) */ 507280304Sjkim# define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s)) 50855714Skris/* BIO *BIO_get_filter_bio(BIO *bio); */ 509280304Sjkim# define BIO_set_proxy_cb(b,cb) BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(void *(*cb)())) 510280304Sjkim# define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk) 511280304Sjkim# define BIO_set_no_connect_return(b,bool) BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,bool) 51255714Skris 513280304Sjkim# define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp) 514280304Sjkim# define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p)) 515280304Sjkim# define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url)) 516280304Sjkim# define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL) 51755714Skris 518295016Sjkim/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ 519280304Sjkim# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) 520280304Sjkim# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) 52155714Skris 522295016Sjkim/* BIO_s_file() */ 523280304Sjkim# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp) 524280304Sjkim# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp) 52555714Skris 526295016Sjkim/* BIO_s_fd() and BIO_s_file() */ 527280304Sjkim# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) 528280304Sjkim# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) 52955714Skris 530280304Sjkim/* 531280304Sjkim * name is cast to lose const, but might be better to route through a 532280304Sjkim * function so we can do it safely 533280304Sjkim */ 534280304Sjkim# ifdef CONST_STRICT 535280304Sjkim/* 536280304Sjkim * If you are wondering why this isn't defined, its because CONST_STRICT is 53755714Skris * purely a compile-time kludge to allow const to be checked. 53855714Skris */ 539280304Sjkimint BIO_read_filename(BIO *b, const char *name); 540280304Sjkim# else 541280304Sjkim# define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ 542280304Sjkim BIO_CLOSE|BIO_FP_READ,(char *)name) 543280304Sjkim# endif 544280304Sjkim# define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ 545280304Sjkim BIO_CLOSE|BIO_FP_WRITE,name) 546280304Sjkim# define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ 547280304Sjkim BIO_CLOSE|BIO_FP_APPEND,name) 548280304Sjkim# define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ 549280304Sjkim BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) 55055714Skris 551280304Sjkim/* 552280304Sjkim * WARNING WARNING, this ups the reference count on the read bio of the SSL 553280304Sjkim * structure. This is because the ssl read BIO is now pointed to by the 554280304Sjkim * next_bio field in the bio. So when you free the BIO, make sure you are 555280304Sjkim * doing a BIO_free_all() to catch the underlying BIO. 556280304Sjkim */ 557280304Sjkim# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) 558280304Sjkim# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) 559280304Sjkim# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) 560280304Sjkim# define BIO_set_ssl_renegotiate_bytes(b,num) \ 561280304Sjkim BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL); 562280304Sjkim# define BIO_get_num_renegotiates(b) \ 563280304Sjkim BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL); 564280304Sjkim# define BIO_set_ssl_renegotiate_timeout(b,seconds) \ 565280304Sjkim BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL); 56655714Skris 56755714Skris/* defined in evp.h */ 568280304Sjkim/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */ 56955714Skris 570280304Sjkim# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp) 571280304Sjkim# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm) 572280304Sjkim# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp) 573280304Sjkim# define BIO_set_mem_eof_return(b,v) \ 574280304Sjkim BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) 57555714Skris 57655714Skris/* For the BIO_f_buffer() type */ 577280304Sjkim# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) 578280304Sjkim# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) 579280304Sjkim# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) 580280304Sjkim# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) 581280304Sjkim# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) 58255714Skris 58355714Skris/* Don't use the next one unless you know what you are doing :-) */ 584280304Sjkim# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) 58555714Skris 586280304Sjkim# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) 587280304Sjkim# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) 588280304Sjkim# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) 589280304Sjkim# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) 590280304Sjkim# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) 591280304Sjkim# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) 59255714Skris/* ...pending macros have inappropriate return type */ 59355714Skrissize_t BIO_ctrl_pending(BIO *b); 59455714Skrissize_t BIO_ctrl_wpending(BIO *b); 595280304Sjkim# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) 596280304Sjkim# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ 597280304Sjkim cbp) 598280304Sjkim# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) 59955714Skris 60055714Skris/* For the BIO_f_buffer() type */ 601280304Sjkim# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) 60255714Skris 60355714Skris/* For BIO_s_bio() */ 604280304Sjkim# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) 605280304Sjkim# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) 606280304Sjkim# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) 607280304Sjkim# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) 608280304Sjkim# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) 60955714Skris/* macros with inappropriate type -- but ...pending macros use int too: */ 610280304Sjkim# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) 611280304Sjkim# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) 61255714Skrissize_t BIO_ctrl_get_write_guarantee(BIO *b); 61355714Skrissize_t BIO_ctrl_get_read_request(BIO *b); 61459191Skrisint BIO_ctrl_reset_read_request(BIO *b); 61555714Skris 616160814Ssimon/* ctrl macros for dgram */ 617280304Sjkim# define BIO_ctrl_dgram_connect(b,peer) \ 618160814Ssimon (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer) 619280304Sjkim# define BIO_ctrl_set_connected(b, state, peer) \ 620160814Ssimon (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer) 621280304Sjkim# define BIO_dgram_recv_timedout(b) \ 622160814Ssimon (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) 623280304Sjkim# define BIO_dgram_send_timedout(b) \ 624160814Ssimon (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) 625280304Sjkim# define BIO_dgram_get_peer(b,peer) \ 626205128Ssimon (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)peer) 627280304Sjkim# define BIO_dgram_set_peer(b,peer) \ 628160814Ssimon (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer) 629280304Sjkim# define BIO_dgram_get_mtu_overhead(b) \ 630276864Sjkim (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) 631160814Ssimon 63255714Skris/* These two aren't currently implemented */ 63355714Skris/* int BIO_get_ex_num(BIO *bio); */ 63455714Skris/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ 635280304Sjkimint BIO_set_ex_data(BIO *bio, int idx, void *data); 636280304Sjkimvoid *BIO_get_ex_data(BIO *bio, int idx); 63759191Skrisint BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 638280304Sjkim CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 63959191Skrisunsigned long BIO_number_read(BIO *bio); 64059191Skrisunsigned long BIO_number_written(BIO *bio); 64155714Skris 642238405Sjkim/* For BIO_f_asn1() */ 643238405Sjkimint BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, 644280304Sjkim asn1_ps_func *prefix_free); 645238405Sjkimint BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, 646280304Sjkim asn1_ps_func **pprefix_free); 647238405Sjkimint BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, 648280304Sjkim asn1_ps_func *suffix_free); 649238405Sjkimint BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, 650280304Sjkim asn1_ps_func **psuffix_free); 651238405Sjkim 652109998Smarkm# ifndef OPENSSL_NO_FP_API 653280304SjkimBIO_METHOD *BIO_s_file(void); 65455714SkrisBIO *BIO_new_file(const char *filename, const char *mode); 65555714SkrisBIO *BIO_new_fp(FILE *stream, int close_flag); 656280304Sjkim# define BIO_s_file_internal BIO_s_file 65768651Skris# endif 658280304SjkimBIO *BIO_new(BIO_METHOD *type); 659280304Sjkimint BIO_set(BIO *a, BIO_METHOD *type); 660280304Sjkimint BIO_free(BIO *a); 661280304Sjkimvoid BIO_vfree(BIO *a); 662280304Sjkimint BIO_read(BIO *b, void *data, int len); 663280304Sjkimint BIO_gets(BIO *bp, char *buf, int size); 664280304Sjkimint BIO_write(BIO *b, const void *data, int len); 665280304Sjkimint BIO_puts(BIO *bp, const char *buf); 666280304Sjkimint BIO_indent(BIO *b, int indent, int max); 667280304Sjkimlong BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); 668280304Sjkimlong BIO_callback_ctrl(BIO *b, int cmd, 669280304Sjkim void (*fp) (struct bio_st *, int, const char *, int, 670280304Sjkim long, long)); 671280304Sjkimchar *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); 672280304Sjkimlong BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); 673280304SjkimBIO *BIO_push(BIO *b, BIO *append); 674280304SjkimBIO *BIO_pop(BIO *b); 675280304Sjkimvoid BIO_free_all(BIO *a); 676280304SjkimBIO *BIO_find_type(BIO *b, int bio_type); 677280304SjkimBIO *BIO_next(BIO *b); 678280304SjkimBIO *BIO_get_retry_BIO(BIO *bio, int *reason); 679280304Sjkimint BIO_get_retry_reason(BIO *bio); 680280304SjkimBIO *BIO_dup_chain(BIO *in); 68155714Skris 68259191Skrisint BIO_nread0(BIO *bio, char **buf); 68359191Skrisint BIO_nread(BIO *bio, char **buf, int num); 68459191Skrisint BIO_nwrite0(BIO *bio, char **buf); 68559191Skrisint BIO_nwrite(BIO *bio, char **buf, int num); 68659191Skris 687280304Sjkimlong BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, 688280304Sjkim long argl, long ret); 68955714Skris 69055714SkrisBIO_METHOD *BIO_s_mem(void); 69159191SkrisBIO *BIO_new_mem_buf(void *buf, int len); 69255714SkrisBIO_METHOD *BIO_s_socket(void); 69355714SkrisBIO_METHOD *BIO_s_connect(void); 69455714SkrisBIO_METHOD *BIO_s_accept(void); 69555714SkrisBIO_METHOD *BIO_s_fd(void); 696280304Sjkim# ifndef OPENSSL_SYS_OS2 69755714SkrisBIO_METHOD *BIO_s_log(void); 698280304Sjkim# endif 69955714SkrisBIO_METHOD *BIO_s_bio(void); 70055714SkrisBIO_METHOD *BIO_s_null(void); 70155714SkrisBIO_METHOD *BIO_f_null(void); 70255714SkrisBIO_METHOD *BIO_f_buffer(void); 703280304Sjkim# ifdef OPENSSL_SYS_VMS 70468651SkrisBIO_METHOD *BIO_f_linebuffer(void); 705280304Sjkim# endif 70655714SkrisBIO_METHOD *BIO_f_nbio_test(void); 707280304Sjkim# ifndef OPENSSL_NO_DGRAM 708160814SsimonBIO_METHOD *BIO_s_datagram(void); 709280304Sjkim# ifndef OPENSSL_NO_SCTP 710238405SjkimBIO_METHOD *BIO_s_datagram_sctp(void); 711280304Sjkim# endif 712280304Sjkim# endif 713160814Ssimon 71455714Skris/* BIO_METHOD *BIO_f_ber(void); */ 71555714Skris 71655714Skrisint BIO_sock_should_retry(int i); 71755714Skrisint BIO_sock_non_fatal_error(int error); 718160814Ssimonint BIO_dgram_non_fatal_error(int error); 719160814Ssimon 72055714Skrisint BIO_fd_should_retry(int i); 72155714Skrisint BIO_fd_non_fatal_error(int error); 722280304Sjkimint BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), 723280304Sjkim void *u, const char *s, int len); 724280304Sjkimint BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), 725280304Sjkim void *u, const char *s, int len, int indent); 726280304Sjkimint BIO_dump(BIO *b, const char *bytes, int len); 727280304Sjkimint BIO_dump_indent(BIO *b, const char *bytes, int len, int indent); 728280304Sjkim# ifndef OPENSSL_NO_FP_API 729160814Ssimonint BIO_dump_fp(FILE *fp, const char *s, int len); 730160814Ssimonint BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); 731280304Sjkim# endif 73255714Skrisstruct hostent *BIO_gethostbyname(const char *name); 733280304Sjkim/*- 734280304Sjkim * We might want a thread-safe interface too: 73555714Skris * struct hostent *BIO_gethostbyname_r(const char *name, 73655714Skris * struct hostent *result, void *buffer, size_t buflen); 73755714Skris * or something similar (caller allocates a struct hostent, 73855714Skris * pointed to by "result", and additional buffer space for the various 73955714Skris * substructures; if the buffer does not suffice, NULL is returned 74055714Skris * and an appropriate error code is set). 74155714Skris */ 74255714Skrisint BIO_sock_error(int sock); 743111147Snectarint BIO_socket_ioctl(int fd, long type, void *arg); 744280304Sjkimint BIO_socket_nbio(int fd, int mode); 74555714Skrisint BIO_get_port(const char *str, unsigned short *port_ptr); 74655714Skrisint BIO_get_host_ip(const char *str, unsigned char *ip); 747280304Sjkimint BIO_get_accept_socket(char *host_port, int mode); 748280304Sjkimint BIO_accept(int sock, char **ip_port); 749280304Sjkimint BIO_sock_init(void); 75055714Skrisvoid BIO_sock_cleanup(void); 751280304Sjkimint BIO_set_tcp_ndelay(int sock, int turn_on); 75255714Skris 75355714SkrisBIO *BIO_new_socket(int sock, int close_flag); 754160814SsimonBIO *BIO_new_dgram(int fd, int close_flag); 755280304Sjkim# ifndef OPENSSL_NO_SCTP 756238405SjkimBIO *BIO_new_dgram_sctp(int fd, int close_flag); 757238405Sjkimint BIO_dgram_is_sctp(BIO *bio); 758238405Sjkimint BIO_dgram_sctp_notification_cb(BIO *b, 759280304Sjkim void (*handle_notifications) (BIO *bio, 760280304Sjkim void 761280304Sjkim *context, 762280304Sjkim void *buf), 763238405Sjkim void *context); 764238405Sjkimint BIO_dgram_sctp_wait_for_dry(BIO *b); 765238405Sjkimint BIO_dgram_sctp_msg_waiting(BIO *b); 766280304Sjkim# endif 76755714SkrisBIO *BIO_new_fd(int fd, int close_flag); 76855714SkrisBIO *BIO_new_connect(char *host_port); 76955714SkrisBIO *BIO_new_accept(char *host_port); 77055714Skris 77155714Skrisint BIO_new_bio_pair(BIO **bio1, size_t writebuf1, 772280304Sjkim BIO **bio2, size_t writebuf2); 773280304Sjkim/* 774280304Sjkim * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. 775280304Sjkim * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default 776280304Sjkim * value. 77755714Skris */ 77855714Skris 77955714Skrisvoid BIO_copy_next_retry(BIO *b); 78055714Skris 781280304Sjkim/* 782280304Sjkim * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); 783280304Sjkim */ 78455714Skris 785280304Sjkim# ifdef __GNUC__ 786160814Ssimon# define __bio_h__attr__ __attribute__ 787280304Sjkim# else 788160814Ssimon# define __bio_h__attr__(x) 789280304Sjkim# endif 790160814Ssimonint BIO_printf(BIO *bio, const char *format, ...) 791280304Sjkim__bio_h__attr__((__format__(__printf__, 2, 3))); 792160814Ssimonint BIO_vprintf(BIO *bio, const char *format, va_list args) 793280304Sjkim__bio_h__attr__((__format__(__printf__, 2, 0))); 794160814Ssimonint BIO_snprintf(char *buf, size_t n, const char *format, ...) 795280304Sjkim__bio_h__attr__((__format__(__printf__, 3, 4))); 796160814Ssimonint BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) 797280304Sjkim__bio_h__attr__((__format__(__printf__, 3, 0))); 798280304Sjkim# undef __bio_h__attr__ 79955714Skris 80055714Skris/* BEGIN ERROR CODES */ 801280304Sjkim/* 802280304Sjkim * The following lines are auto generated by the script mkerr.pl. Any changes 80355714Skris * made after this point may be overwritten when the script is next run. 80455714Skris */ 80589837Skrisvoid ERR_load_BIO_strings(void); 80655714Skris 80755714Skris/* Error codes for the BIO functions. */ 80855714Skris 80955714Skris/* Function codes. */ 810280304Sjkim# define BIO_F_ACPT_STATE 100 811280304Sjkim# define BIO_F_BIO_ACCEPT 101 812280304Sjkim# define BIO_F_BIO_BER_GET_HEADER 102 813280304Sjkim# define BIO_F_BIO_CALLBACK_CTRL 131 814280304Sjkim# define BIO_F_BIO_CTRL 103 815280304Sjkim# define BIO_F_BIO_GETHOSTBYNAME 120 816280304Sjkim# define BIO_F_BIO_GETS 104 817280304Sjkim# define BIO_F_BIO_GET_ACCEPT_SOCKET 105 818280304Sjkim# define BIO_F_BIO_GET_HOST_IP 106 819280304Sjkim# define BIO_F_BIO_GET_PORT 107 820280304Sjkim# define BIO_F_BIO_MAKE_PAIR 121 821280304Sjkim# define BIO_F_BIO_NEW 108 822280304Sjkim# define BIO_F_BIO_NEW_FILE 109 823280304Sjkim# define BIO_F_BIO_NEW_MEM_BUF 126 824280304Sjkim# define BIO_F_BIO_NREAD 123 825280304Sjkim# define BIO_F_BIO_NREAD0 124 826280304Sjkim# define BIO_F_BIO_NWRITE 125 827280304Sjkim# define BIO_F_BIO_NWRITE0 122 828280304Sjkim# define BIO_F_BIO_PUTS 110 829280304Sjkim# define BIO_F_BIO_READ 111 830280304Sjkim# define BIO_F_BIO_SOCK_INIT 112 831280304Sjkim# define BIO_F_BIO_WRITE 113 832280304Sjkim# define BIO_F_BUFFER_CTRL 114 833280304Sjkim# define BIO_F_CONN_CTRL 127 834280304Sjkim# define BIO_F_CONN_STATE 115 835280304Sjkim# define BIO_F_DGRAM_SCTP_READ 132 836280304Sjkim# define BIO_F_DGRAM_SCTP_WRITE 133 837280304Sjkim# define BIO_F_FILE_CTRL 116 838280304Sjkim# define BIO_F_FILE_READ 130 839280304Sjkim# define BIO_F_LINEBUFFER_CTRL 129 840280304Sjkim# define BIO_F_MEM_READ 128 841280304Sjkim# define BIO_F_MEM_WRITE 117 842280304Sjkim# define BIO_F_SSL_NEW 118 843280304Sjkim# define BIO_F_WSASTARTUP 119 84455714Skris 84555714Skris/* Reason codes. */ 846280304Sjkim# define BIO_R_ACCEPT_ERROR 100 847280304Sjkim# define BIO_R_BAD_FOPEN_MODE 101 848280304Sjkim# define BIO_R_BAD_HOSTNAME_LOOKUP 102 849280304Sjkim# define BIO_R_BROKEN_PIPE 124 850280304Sjkim# define BIO_R_CONNECT_ERROR 103 851280304Sjkim# define BIO_R_EOF_ON_MEMORY_BIO 127 852280304Sjkim# define BIO_R_ERROR_SETTING_NBIO 104 853280304Sjkim# define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 854280304Sjkim# define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 855280304Sjkim# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 856280304Sjkim# define BIO_R_INVALID_ARGUMENT 125 857280304Sjkim# define BIO_R_INVALID_IP_ADDRESS 108 858280304Sjkim# define BIO_R_IN_USE 123 859280304Sjkim# define BIO_R_KEEPALIVE 109 860280304Sjkim# define BIO_R_NBIO_CONNECT_ERROR 110 861280304Sjkim# define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 862280304Sjkim# define BIO_R_NO_HOSTNAME_SPECIFIED 112 863280304Sjkim# define BIO_R_NO_PORT_DEFINED 113 864280304Sjkim# define BIO_R_NO_PORT_SPECIFIED 114 865280304Sjkim# define BIO_R_NO_SUCH_FILE 128 866280304Sjkim# define BIO_R_NULL_PARAMETER 115 867280304Sjkim# define BIO_R_TAG_MISMATCH 116 868280304Sjkim# define BIO_R_UNABLE_TO_BIND_SOCKET 117 869280304Sjkim# define BIO_R_UNABLE_TO_CREATE_SOCKET 118 870280304Sjkim# define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 871280304Sjkim# define BIO_R_UNINITIALIZED 120 872280304Sjkim# define BIO_R_UNSUPPORTED_METHOD 121 873280304Sjkim# define BIO_R_WRITE_TO_READ_ONLY_BIO 126 874280304Sjkim# define BIO_R_WSASTARTUP 122 87555714Skris 87655714Skris#ifdef __cplusplus 87755714Skris} 87855714Skris#endif 87955714Skris#endif 880