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