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