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 int BIO_get_new_index(); 243 void BIO_set_flags(BIO* b, int flags); 244 int BIO_test_flags(const(BIO)* b, int flags); 245 void BIO_clear_flags(BIO* b, int flags); 246 247 auto BIO_get_flags()(const(BIO)* b) { return BIO_test_flags(b, ~(0x0)); } 248 auto BIO_set_retry_special()(BIO* b) { 249 return BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)); 250 } 251 auto BIO_set_retry_read()(BIO* b) { 252 return BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)); 253 } 254 auto BIO_set_retry_write()(BIO* b) { 255 return BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)); 256 } 257 258 /* These are normally used internally in BIOs */ 259 auto BIO_clear_retry_flags()(BIO* b) { 260 return BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)); 261 } 262 auto BIO_get_retry_flags()(const(BIO)* b) { 263 return BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)); 264 } 265 266 /* These should be used by the application to tell why we should retry */ 267 auto BIO_should_read()(const(BIO)* a) { return BIO_test_flags(a, BIO_FLAGS_READ); } 268 auto BIO_should_write()(const(BIO)* a) { return BIO_test_flags(a, BIO_FLAGS_WRITE); } 269 auto BIO_should_io_special()(const(BIO)* a) { return BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL); } 270 auto BIO_retry_type()(const(BIO)* a) { return BIO_test_flags(a, BIO_FLAGS_RWS); } 271 auto BIO_should_retry()(const(BIO)* a) { return BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY); } 272 273 /* The next three are used in conjunction with the 274 * BIO_should_io_special() condition. After this returns true, 275 * BIO* BIO_get_retry_BIO(BIO* bio, int* reason); will walk the BIO 276 * stack and return the 'reason' for the special and the offending BIO. 277 * Given a BIO, BIO_get_retry_reason(bio) will return the code. */ 278 /* Returned from the SSL bio when the certificate retrieval code had an error */ 279 enum BIO_RR_SSL_X509_LOOKUP = 0x01; 280 /* Returned from the connect BIO when a connect would have blocked */ 281 enum BIO_RR_CONNECT = 0x02; 282 /* Returned from the accept BIO when an accept would have blocked */ 283 enum BIO_RR_ACCEPT = 0x03; 284 285 /* These are passed by the BIO callback */ 286 enum BIO_CB_FREE = 0x01; 287 enum BIO_CB_READ = 0x02; 288 enum BIO_CB_WRITE = 0x03; 289 enum BIO_CB_PUTS = 0x04; 290 enum BIO_CB_GETS = 0x05; 291 enum BIO_CB_CTRL = 0x06; 292 293 /* The callback is called before and after the underling operation, 294 * The BIO_CB_RETURN flag indicates if it is after the call */ 295 enum BIO_CB_RETURN = 0x80; 296 auto BIO_CB_return()(int a) { return a|BIO_CB_RETURN; } 297 auto BIO_cb_pre()(int a) { return !((a)&BIO_CB_RETURN); } 298 auto BIO_cb_post()(int a) { return a&BIO_CB_RETURN; } 299 300 ExternC!(c_long function(bio_st*,int,const(char)*,int, c_long,long)) BIO_get_callback(const(BIO)* b); 301 void BIO_set_callback(BIO* b, 302 ExternC!(c_long function(bio_st*,int,const(char)*,int, c_long,long)) callback); 303 char* BIO_get_callback_arg(const(BIO)* b); 304 void BIO_set_callback_arg(BIO* b, char* arg); 305 306 const(char)* BIO_method_name(const(BIO)* b); 307 int BIO_method_type(const(BIO)* b); 308 309 alias typeof(*(ExternC!(void function(bio_st*, int, const(char)*, int, c_long, c_long))).init) bio_info_cb; 310 alias BIO_info_cb = bio_info_cb; 311 312 struct bio_method_st { 313 int type; 314 const(char)* name; 315 ExternC!(int function(BIO*, const(char)*, int)) bwrite; 316 ExternC!(int function(BIO*, char*, int)) bread; 317 ExternC!(int function(BIO*, const(char)*)) bputs; 318 ExternC!(int function(BIO*, char*, int)) bgets; 319 ExternC!(c_long function(BIO*, int, c_long, void*)) ctrl; 320 ExternC!(int function(BIO*)) create; 321 ExternC!(int function(BIO*)) destroy; 322 ExternC!(c_long function(BIO*, int, bio_info_cb*)) callback_ctrl; 323 } 324 alias bio_method_st BIO_METHOD; 325 326 struct bio_st 327 { 328 BIO_METHOD* method; 329 /* bio, mode, argp, argi, argl, ret */ 330 ExternC!(c_long function(bio_st*,int,const(char)*,int, c_long,long)) callback; 331 char* cb_arg; /* first argument for the callback */ 332 333 int init_; 334 int shutdown; 335 int flags; /* extra storage */ 336 int retry_reason; 337 int num; 338 void* ptr; 339 bio_st* next_bio; /* used by filter BIOs */ 340 bio_st* prev_bio; /* used by filter BIOs */ 341 int references; 342 c_ulong num_read; 343 c_ulong num_write; 344 345 CRYPTO_EX_DATA ex_data; 346 }; 347 348 /+mixin DECLARE_STACK_OF!(BIO);+/ 349 350 struct bio_f_buffer_ctx_struct { 351 352 /* Buffers are setup like this: 353 * 354 * <---------------------- size -----------------------> 355 * +---------------------------------------------------+ 356 * | consumed | remaining | free space | 357 * +---------------------------------------------------+ 358 * <-- off --><------- len -------> 359 */ 360 361 /* BIO* bio; */ /* this is now in the BIO struct */ 362 int ibuf_size; /* how big is the input buffer */ 363 int obuf_size; /* how big is the output buffer */ 364 365 char* ibuf; /* the char array */ 366 int ibuf_len; /* how many bytes are in it */ 367 int ibuf_off; /* write/read offset */ 368 369 char* obuf; /* the char array */ 370 int obuf_len; /* how many bytes are in it */ 371 int obuf_off; /* write/read offset */ 372 } 373 alias bio_f_buffer_ctx_struct BIO_F_BUFFER_CTX; 374 375 /* Prefix and suffix callback in ASN1 BIO */ 376 alias typeof(*(ExternC!(int function(BIO* b, ubyte** pbuf, int* plen, void* parg))).init) asn1_ps_func; 377 378 version(OPENSSL_NO_SCTP) {} else { 379 /* SCTP parameter structs */ 380 struct bio_dgram_sctp_sndinfo 381 { 382 uint16_t snd_sid; 383 uint16_t snd_flags; 384 uint32_t snd_ppid; 385 uint32_t snd_context; 386 }; 387 388 struct bio_dgram_sctp_rcvinfo 389 { 390 uint16_t rcv_sid; 391 uint16_t rcv_ssn; 392 uint16_t rcv_flags; 393 uint32_t rcv_ppid; 394 uint32_t rcv_tsn; 395 uint32_t rcv_cumtsn; 396 uint32_t rcv_context; 397 }; 398 399 struct bio_dgram_sctp_prinfo 400 { 401 uint16_t pr_policy; 402 uint32_t pr_value; 403 }; 404 } 405 406 /* connect BIO stuff */ 407 enum BIO_CONN_S_BEFORE = 1; 408 enum BIO_CONN_S_GET_IP = 2; 409 enum BIO_CONN_S_GET_PORT = 3; 410 enum BIO_CONN_S_CREATE_SOCKET = 4; 411 enum BIO_CONN_S_CONNECT = 5; 412 enum BIO_CONN_S_OK = 6; 413 enum BIO_CONN_S_BLOCKED_CONNECT = 7; 414 enum BIO_CONN_S_NBIO = 8; 415 /*alias BIO_ctrl BIO_CONN_get_param_hostname; */ 416 417 enum BIO_C_SET_CONNECT = 100; 418 enum BIO_C_DO_STATE_MACHINE = 101; 419 enum BIO_C_SET_NBIO = 102; 420 enum BIO_C_SET_PROXY_PARAM = 103; 421 enum BIO_C_SET_FD = 104; 422 enum BIO_C_GET_FD = 105; 423 enum BIO_C_SET_FILE_PTR = 106; 424 enum BIO_C_GET_FILE_PTR = 107; 425 enum BIO_C_SET_FILENAME = 108; 426 enum BIO_C_SET_SSL = 109; 427 enum BIO_C_GET_SSL = 110; 428 enum BIO_C_SET_MD = 111; 429 enum BIO_C_GET_MD = 112; 430 enum BIO_C_GET_CIPHER_STATUS = 113; 431 enum BIO_C_SET_BUF_MEM = 114; 432 enum BIO_C_GET_BUF_MEM_PTR = 115; 433 enum BIO_C_GET_BUFF_NUM_LINES = 116; 434 enum BIO_C_SET_BUFF_SIZE = 117; 435 enum BIO_C_SET_ACCEPT = 118; 436 enum BIO_C_SSL_MODE = 119; 437 enum BIO_C_GET_MD_CTX = 120; 438 enum BIO_C_GET_PROXY_PARAM = 121; 439 enum BIO_C_SET_BUFF_READ_DATA = 122; /* data to read first */ 440 enum BIO_C_GET_CONNECT = 123; 441 enum BIO_C_GET_ACCEPT = 124; 442 enum BIO_C_SET_SSL_RENEGOTIATE_BYTES = 125; 443 enum BIO_C_GET_SSL_NUM_RENEGOTIATES = 126; 444 enum BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT = 127; 445 enum BIO_C_FILE_SEEK = 128; 446 enum BIO_C_GET_CIPHER_CTX = 129; 447 enum BIO_C_SET_BUF_MEM_EOF_RETURN = 130;/*return end of input value*/ 448 enum BIO_C_SET_BIND_MODE = 131; 449 enum BIO_C_GET_BIND_MODE = 132; 450 enum BIO_C_FILE_TELL = 133; 451 enum BIO_C_GET_SOCKS = 134; 452 enum BIO_C_SET_SOCKS = 135; 453 454 enum BIO_C_SET_WRITE_BUF_SIZE = 136;/* for BIO_s_bio */ 455 enum BIO_C_GET_WRITE_BUF_SIZE = 137; 456 enum BIO_C_MAKE_BIO_PAIR = 138; 457 enum BIO_C_DESTROY_BIO_PAIR = 139; 458 enum BIO_C_GET_WRITE_GUARANTEE = 140; 459 enum BIO_C_GET_READ_REQUEST = 141; 460 enum BIO_C_SHUTDOWN_WR = 142; 461 enum BIO_C_NREAD0 = 143; 462 enum BIO_C_NREAD = 144; 463 enum BIO_C_NWRITE0 = 145; 464 enum BIO_C_NWRITE = 146; 465 enum BIO_C_RESET_READ_REQUEST = 147; 466 enum BIO_C_SET_MD_CTX = 148; 467 468 enum BIO_C_SET_PREFIX = 149; 469 enum BIO_C_GET_PREFIX = 150; 470 enum BIO_C_SET_SUFFIX = 151; 471 enum BIO_C_GET_SUFFIX = 152; 472 473 enum BIO_C_SET_EX_ARG = 153; 474 enum BIO_C_GET_EX_ARG = 154; 475 476 auto BIO_set_app_data()(BIO* s, void* arg) { return BIO_set_ex_data(s,0,arg); } 477 auto BIO_get_app_data()(BIO* s) { return BIO_get_ex_data(s,0); } 478 479 /* BIO_s_connect() and BIO_s_socks4a_connect() */ 480 auto BIO_set_conn_hostname()(BIO* b, char* name) { return BIO_ctrl(b,BIO_C_SET_CONNECT,0,name); } 481 auto BIO_set_conn_port()(BIO* b,char* port) { return BIO_ctrl(b,BIO_C_SET_CONNECT,1,port); } 482 auto BIO_set_conn_ip()(BIO* b,char* ip) { return BIO_ctrl(b,BIO_C_SET_CONNECT,2,ip); } 483 auto BIO_set_conn_int_port()(BIO* b,char* port) { return BIO_ctrl(b,BIO_C_SET_CONNECT,3,port); } 484 auto BIO_get_conn_hostname()(BIO* b) { return { return BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0); }; } 485 auto BIO_get_conn_port()(BIO* b) { return { return BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1); }; } 486 auto BIO_get_conn_ip()(BIO* b) { return { return BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2); }; } 487 auto BIO_get_conn_int_port()(BIO* b) { return { return BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0); }; } 488 489 490 auto BIO_set_nbio()(BIO* b, int n) { return BIO_ctrl(b,BIO_C_SET_NBIO,(n),null); } 491 492 /* BIO_s_accept_socket() */ 493 auto BIO_set_accept_port()(BIO* b,char* name) { return BIO_ctrl(b,BIO_C_SET_ACCEPT,0,name); } 494 auto BIO_get_accept_port()(BIO* b) { return BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0); } 495 /* auto BIO_set_nbio()(BIO* b,n) { return BIO_ctrl(b,BIO_C_SET_NBIO,(n),null); } */ 496 auto BIO_set_nbio_accept()(BIO* b,int n) { return BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a".ptr:null); } 497 auto BIO_set_accept_bios()(BIO* b,char* bio) { return BIO_ctrl(b,BIO_C_SET_ACCEPT,2,bio); } 498 499 enum BIO_BIND_NORMAL = 0; 500 enum BIO_BIND_REUSEADDR_IF_UNUSED = 1; 501 enum BIO_BIND_REUSEADDR = 2; 502 auto BIO_set_bind_mode()(BIO* b,c_long mode) { return BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,null); } 503 auto BIO_get_bind_mode()(BIO* b, c_long dummy) { return BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,null); } 504 505 alias BIO_do_handshake BIO_do_connect; 506 alias BIO_do_handshake BIO_do_accept; 507 auto BIO_do_handshake()(BIO* b) { return BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,null); } 508 509 /* BIO_s_proxy_client() */ 510 auto BIO_set_url()(BIO* b,char* url) { return BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,url); } 511 auto BIO_set_proxies()(BIO* b,char* p) { return BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,p); } 512 /* BIO_set_nbio()(BIO* b,n) */ 513 auto BIO_set_filter_bio()(BIO* b,char* s) { return BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,s); } 514 /* BIO* BIO_get_filter_bio(BIO* bio); */ 515 auto BIO_set_proxy_cb()(BIO* b,ExternC!(void* function()) cb) { return BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,cb); } 516 auto BIO_set_proxy_header()(BIO* b,char* sk) { return BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,sk); } 517 auto BIO_set_no_connect_return()(BIO* b,bool t) { return BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,t); } 518 519 auto BIO_get_proxy_header()(BIO* b,char* skp) { return BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,skp); } 520 auto BIO_get_proxies()(BIO* b,char* pxy_p) { return BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(pxy_p)); } 521 auto BIO_get_url()(BIO* b,char*url) { return BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(url)); } 522 auto BIO_get_no_connect_return()(BIO* b) { return BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,null); } 523 524 auto BIO_set_fd()(BIO* b,int fd, c_long c) { return BIO_int_ctrl(b,BIO_C_SET_FD,c,fd); } 525 auto BIO_get_fd()(BIO* b,c_long c) { return BIO_ctrl(b,BIO_C_GET_FD,0,cast(void*)c); } 526 527 auto BIO_set_fp()(BIO* b,FILE* fp,c_long c) { return BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,fp); } 528 auto BIO_get_fp()(BIO* b,FILE** fpp) { return BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,fpp); } 529 530 auto BIO_seek()(BIO* b,ofs) { return cast(int) BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,null); } 531 auto BIO_tell()(BIO* b) { return cast(int) BIO_ctrl(b,BIO_C_FILE_TELL,0,null); } 532 533 /* name is cast to lose const, but might be better to route through a function 534 so we can do it safely */ 535 //#ifdef CONST_STRICT 536 ///* If you are wondering why this isn't defined, its because CONST_STRICT is 537 // * purely a compile-time kludge to allow const to be checked. 538 // */ 539 //int BIO_read_filename(BIO* b,const(char)* name); 540 //#else 541 auto BIO_read_filename()(BIO* b,const(char)* name) { return BIO_ctrl(b,BIO_C_SET_FILENAME,BIO_CLOSE|BIO_FP_READ,name); } 542 //#endif 543 auto BIO_write_filename()(BIO* b,const(char)* name) { return BIO_ctrl(b,BIO_C_SET_FILENAME,BIO_CLOSE|BIO_FP_WRITE,name); } 544 auto BIO_append_filename()(BIO* b,const(char)* name) { return BIO_ctrl(b,BIO_C_SET_FILENAME,BIO_CLOSE|BIO_FP_APPEND,name); } 545 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); } 546 547 /* WARNING WARNING, this ups the reference count on the read bio of the 548 * SSL structure. This is because the ssl read BIO is now pointed to by 549 * the next_bio field in the bio. So when you free the BIO, make sure 550 * you are doing a BIO_free_all() to catch the underlying BIO. */ 551 auto BIO_set_ssl()(BIO* b,SSL* ssl,c_long c) { return BIO_ctrl(b,BIO_C_SET_SSL,c,ssl); } 552 auto BIO_get_ssl()(BIO* b,SSL** sslp) { return BIO_ctrl(b,BIO_C_GET_SSL,0,sslp); } 553 auto BIO_set_ssl_mode()(BIO* b,c_long client) { return BIO_ctrl(b,BIO_C_SSL_MODE,client,null); } 554 auto BIO_set_ssl_renegotiate_bytes()(BIO* b,c_long num) { 555 return BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,null); 556 }; 557 auto BIO_get_num_renegotiates()(BIO* b) { 558 return BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,null); 559 }; 560 auto BIO_set_ssl_renegotiate_timeout()(BIO* b,c_long seconds) { 561 return BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,null); 562 }; 563 564 /* defined in evp.h */ 565 /* auto BIO_set_md()(BIO* b,md) { return BIO_ctrl(b,BIO_C_SET_MD,1,(char*)md); } */ 566 567 auto BIO_get_mem_data()(BIO* b,BUF_MEM** pp) { return BIO_ctrl(b,BIO_CTRL_INFO,0,pp); } 568 auto BIO_set_mem_buf()(BIO* b,BUF_MEM* bm,c_long c) { return BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,bm); } 569 auto BIO_get_mem_ptr()(BIO* b,BUF_MEM** pp) { return BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,pp); } 570 auto BIO_set_mem_eof_return()(BIO* b,c_long v) { return BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,null); } 571 572 /* For the BIO_f_buffer() type */ 573 auto BIO_get_buffer_num_lines()(BIO* b) { return BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,null); } 574 auto BIO_set_buffer_size()(BIO* b,size) { return BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,null); } 575 auto BIO_set_read_buffer_size()(BIO* b,size) { return BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0); } 576 auto BIO_set_write_buffer_size()(BIO* b,size) { return BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1); } 577 auto BIO_set_buffer_read_data()(BIO* b,buf,num) { return BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf); } 578 579 /* Don't use the next one unless you know what you are doing :-) */ 580 auto BIO_dup_state()(BIO* b,void* ret) { return BIO_ctrl(b,BIO_CTRL_DUP,0,ret); } 581 582 auto BIO_reset()(BIO* b) { return cast(int) BIO_ctrl(b,BIO_CTRL_RESET,0,null); } 583 auto BIO_eof()(BIO* b) { return cast(int) BIO_ctrl(b,BIO_CTRL_EOF,0,null); } 584 auto BIO_set_close()(BIO* b,int c) { return cast(int) BIO_ctrl(b,BIO_CTRL_SET_CLOSE,c,null); } 585 auto BIO_get_close()(BIO* b) { return cast(int) BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,null); } 586 auto BIO_pending()(BIO* b) { return cast(int) BIO_ctrl(b,BIO_CTRL_PENDING,0,null); } 587 auto BIO_wpending()(BIO* b) { return cast(int) BIO_ctrl(b,BIO_CTRL_WPENDING,0,null); } 588 /* ...pending macros have inappropriate return type */ 589 size_t BIO_ctrl_pending(BIO* b); 590 size_t BIO_ctrl_wpending(BIO* b); 591 auto BIO_flush()(BIO* b) { return cast(int) BIO_ctrl(b,BIO_CTRL_FLUSH,0,null); } 592 auto BIO_get_info_callback()(BIO* b,bio_info_cb** cbp) { return cast(int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0,cbp); } 593 auto BIO_set_info_callback()(BIO* b,bio_info_cb* cb) { return cast(int) BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb); } 594 595 /* For the BIO_f_buffer() type */ 596 auto BIO_buffer_get_num_lines()(BIO* b) { return BIO_ctrl(b,BIO_CTRL_GET,0,null); } 597 598 /* For BIO_s_bio() */ 599 auto BIO_set_write_buf_size()(BIO* b,size) { return cast(int) BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,null); } 600 auto BIO_get_write_buf_size()(BIO* b,size) { return cast(size_t) BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,null); } 601 auto BIO_make_bio_pair()(BIO* b1,b2) { return cast(int) BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2); } 602 auto BIO_destroy_bio_pair()(BIO* b) { return cast(int) BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,null); } 603 auto BIO_shutdown_wr()(BIO* b) { return cast(int) BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, null); } 604 /* macros with inappropriate type -- but ...pending macros use int too: */ 605 auto BIO_get_write_guarantee()(BIO* b) { return cast(int) BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,null); } 606 auto BIO_get_read_request()(BIO* b) { return cast(int) BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,null); } 607 size_t BIO_ctrl_get_write_guarantee(BIO* b); 608 size_t BIO_ctrl_get_read_request(BIO* b); 609 int BIO_ctrl_reset_read_request(BIO* b); 610 611 /* ctrl macros for dgram */ 612 auto BIO_ctrl_dgram_connect()(BIO* b,void* peer) { return cast(int) BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, peer); } 613 auto BIO_ctrl_set_connected()(BIO* b, c_long state, peer) { return cast(int) BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, peer); } 614 auto BIO_dgram_recv_timedout()(BIO* b) { return cast(int) BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, null); } 615 auto BIO_dgram_send_timedout()(BIO* b) { return cast(int) BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, null); } 616 auto BIO_dgram_get_peer()(BIO* b,void* peer) { return cast(int) BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, peer); } 617 auto BIO_dgram_set_peer()(BIO* b,void* peer) { return cast(int) BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, peer); } 618 619 /* These two aren't currently implemented */ 620 /* int BIO_get_ex_num(BIO* bio); */ 621 /* void BIO_set_ex_free_func(BIO* bio,int idx,ExternC!(void function()) cb); */ 622 int BIO_set_ex_data(BIO* bio,int idx,void* data); 623 void* BIO_get_ex_data(BIO* bio,int idx); 624 int BIO_get_ex_new_index(c_long argl, void* argp, CRYPTO_EX_new* new_func, 625 CRYPTO_EX_dup* dup_func, CRYPTO_EX_free* free_func); 626 c_ulong BIO_number_read(BIO* bio); 627 c_ulong BIO_number_written(BIO* bio); 628 629 /* For BIO_f_asn1() */ 630 int BIO_asn1_set_prefix(BIO* b, asn1_ps_func* prefix, 631 asn1_ps_func* prefix_free); 632 int BIO_asn1_get_prefix(BIO* b, asn1_ps_func** pprefix, 633 asn1_ps_func** pprefix_free); 634 int BIO_asn1_set_suffix(BIO* b, asn1_ps_func* suffix, 635 asn1_ps_func* suffix_free); 636 int BIO_asn1_get_suffix(BIO* b, asn1_ps_func** psuffix, 637 asn1_ps_func** psuffix_free); 638 639 version (OPENSSL_NO_FP_API) {} else { 640 BIO_METHOD* BIO_s_file(); 641 BIO* BIO_new_file(const(char)* filename, const(char)* mode); 642 BIO* BIO_new_fp(FILE* stream, int close_flag); 643 alias BIO_s_file BIO_s_file_internal; 644 } 645 BIO* BIO_new(BIO_METHOD* type); 646 int BIO_set(BIO* a,BIO_METHOD* type); 647 int BIO_free(BIO* a); 648 void BIO_vfree(BIO* a); 649 int BIO_read(BIO* b, void* data, int len); 650 int BIO_gets(BIO* bp,char* buf, int size); 651 int BIO_write(BIO* b, const(void)* data, int len); 652 int BIO_puts(BIO* bp,const(char)* buf); 653 int BIO_indent(BIO* b,int indent,int max); 654 c_long BIO_ctrl(BIO* bp,int cmd,c_long larg,void* parg); 655 c_long BIO_callback_ctrl(BIO* b, int cmd, ExternC!(void function(bio_st*, int, const(char)*, int, c_long, c_long)) fp); 656 char* BIO_ptr_ctrl(BIO* bp,int cmd,c_long larg); 657 c_long BIO_int_ctrl(BIO* bp,int cmd,c_long larg,int iarg); 658 BIO* BIO_push(BIO* b,BIO* append); 659 BIO* BIO_pop(BIO* b); 660 void BIO_free_all(BIO* a); 661 BIO* BIO_find_type(BIO* b,int bio_type); 662 BIO* BIO_next(BIO* b); 663 BIO* BIO_get_retry_BIO(BIO* bio, int* reason); 664 int BIO_get_retry_reason(BIO* bio); 665 BIO* BIO_dup_chain(BIO* in_); 666 667 int BIO_nread0(BIO* bio, char** buf); 668 int BIO_nread(BIO* bio, char** buf, int num); 669 int BIO_nwrite0(BIO* bio, char** buf); 670 int BIO_nwrite(BIO* bio, char** buf, int num); 671 672 c_long BIO_debug_callback(BIO* bio,int cmd,const(char)* argp,int argi, 673 c_long argl,c_long ret); 674 675 BIO_METHOD* BIO_s_mem(); 676 BIO* BIO_new_mem_buf(void* buf, int len); 677 BIO_METHOD* BIO_s_socket(); 678 BIO_METHOD* BIO_s_connect(); 679 BIO_METHOD* BIO_s_accept(); 680 BIO_METHOD* BIO_s_fd(); 681 // #ifndef OPENSSL_SYS_OS2 682 BIO_METHOD* BIO_s_log(); 683 // #endif 684 BIO_METHOD* BIO_s_bio(); 685 BIO_METHOD* BIO_s_null(); 686 BIO_METHOD* BIO_f_null(); 687 BIO_METHOD* BIO_f_buffer(); 688 //#ifdef OPENSSL_SYS_VMS 689 //BIO_METHOD* BIO_f_linebuffer(); 690 //#endif 691 BIO_METHOD* BIO_f_nbio_test(); 692 version (OPENSSL_NO_DGRAM) {} else { 693 BIO_METHOD* BIO_s_datagram(); 694 version(OPENSSL_NO_SCTP) {} else { 695 BIO_METHOD *BIO_s_datagram_sctp(); 696 } 697 } 698 699 /* BIO_METHOD* BIO_f_ber(); */ 700 701 int BIO_sock_should_retry(int i); 702 int BIO_sock_non_fatal_error(int error); 703 int BIO_dgram_non_fatal_error(int error); 704 705 int BIO_fd_should_retry(int i); 706 int BIO_fd_non_fatal_error(int error); 707 int BIO_dump_cb(ExternC!(int function(const(void)* data, size_t len, void* u)) cb, 708 void* u, const(char)* s, int len); 709 int BIO_dump_indent_cb(ExternC!(int function(const(void)* data, size_t len, void* u)) cb, 710 void* u, const(char)* s, int len, int indent); 711 int BIO_dump(BIO* b,const(char)* bytes,int len); 712 int BIO_dump_indent(BIO* b,const(char)* bytes,int len,int indent); 713 version (OPENSSL_NO_FP_API) {} else { 714 int BIO_dump_fp(FILE* fp, const(char)* s, int len); 715 int BIO_dump_indent_fp(FILE* fp, const(char)* s, int len, int indent); 716 } 717 hostent* BIO_gethostbyname(const(char)* name); 718 /* We might want a thread-safe interface too: 719 * hostent* BIO_gethostbyname_r(const(char)* name, 720 * hostent* result, void* buffer, size_t buflen); 721 * or something similar (caller allocates a struct hostent, 722 * pointed to by "result", and additional buffer space for the various 723 * substructures; if the buffer does not suffice, NULL is returned 724 * and an appropriate error code is set). 725 */ 726 int BIO_sock_error(int sock); 727 int BIO_socket_ioctl(int fd, c_long type, void* arg); 728 int BIO_socket_nbio(int fd,int mode); 729 int BIO_get_port(const(char)* str, ushort* port_ptr); 730 int BIO_get_host_ip(const(char)* str, ubyte* ip); 731 int BIO_get_accept_socket(char* host_port,int mode); 732 int BIO_accept(int sock,char** ip_port); 733 int BIO_sock_init(); 734 void BIO_sock_cleanup(); 735 int BIO_set_tcp_ndelay(int sock,int turn_on); 736 737 BIO* BIO_new_socket(int sock, int close_flag); 738 BIO* BIO_new_dgram(int fd, int close_flag); 739 version(OPENSSL_NO_SCTP) {} else { 740 BIO *BIO_new_dgram_sctp(int fd, int close_flag); 741 int BIO_dgram_is_sctp(BIO *bio); 742 int BIO_dgram_sctp_notification_cb(BIO *b, 743 ExternC!(void function(BIO *bio, void *context, void *buf)) handle_notifications, 744 void *context); 745 int BIO_dgram_sctp_wait_for_dry(BIO *b); 746 int BIO_dgram_sctp_msg_waiting(BIO *b); 747 } 748 BIO* BIO_new_fd(int fd, int close_flag); 749 BIO* BIO_new_connect(char* host_port); 750 BIO* BIO_new_accept(char* host_port); 751 752 int BIO_new_bio_pair(BIO** bio1, size_t writebuf1, 753 BIO** bio2, size_t writebuf2); 754 /* If successful, returns 1 and in* bio1, *bio2 two BIO pair endpoints. 755 * Otherwise returns 0 and sets* bio1 and* bio2 to NULL. 756 * Size 0 uses default value. 757 */ 758 759 void BIO_copy_next_retry(BIO* b); 760 761 /*long BIO_ghbn_ctrl(int cmd,int iarg,char* parg);*/ 762 763 int BIO_printf(BIO* bio, const(char)* format, ...); 764 int BIO_vprintf(BIO* bio, const(char)* format, va_list args); 765 int BIO_snprintf(char* buf, size_t n, const(char)* format, ...); 766 int BIO_vsnprintf(char* buf, size_t n, const(char)* format, va_list args); 767 768 BIO_METHOD *BIO_meth_new(int type, const char *name); 769 void BIO_meth_free(BIO_METHOD *biom); 770 int function(BIO_METHOD *biom) BIO_meth_get_write(BIO *, const char *, int); 771 int BIO_meth_set_write(BIO_METHOD *biom, 772 int function(BIO *, const char *, int) write); 773 int function(BIO_METHOD *biom) BIO_meth_get_read(BIO *, char *, int); 774 int BIO_meth_set_read(BIO_METHOD *biom, 775 int function(BIO *, char *, int) read); 776 int function(BIO_METHOD *biom) BIO_meth_get_puts(BIO *, const char *); 777 int BIO_meth_set_puts(BIO_METHOD *biom, 778 int function(BIO *, const char *) puts); 779 int function(BIO_METHOD *biom) BIO_meth_get_gets(BIO *, char *, int); 780 int BIO_meth_set_gets(BIO_METHOD *biom, 781 int function(BIO *, char *, int) gets); 782 long function(BIO_METHOD *biom) BIO_meth_get_ctrl(BIO *, int, long, void *); 783 int BIO_meth_set_ctrl(BIO_METHOD *biom, 784 long function(BIO *, int, long, void *) ctrl); 785 int function(BIO_METHOD *bion) BIO_meth_get_create(BIO *); 786 int BIO_meth_set_create(BIO_METHOD *biom, int function(BIO *) create); 787 int function(BIO_METHOD *biom) BIO_meth_get_destroy(BIO *); 788 int BIO_meth_set_destroy(BIO_METHOD *biom, int function(BIO *) destroy); 789 long function(BIO *, int, BIO_info_cb *) BIO_meth_get_callback_ctrl(BIO_METHOD *biom); 790 int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, long function(BIO *, int, BIO_info_cb *) callback_ctrl); 791 792 /* BEGIN ERROR CODES */ 793 /* The following lines are auto generated by the script mkerr.pl. Any changes 794 * made after this point may be overwritten when the script is next run. 795 */ 796 void ERR_load_BIO_strings(); 797 798 /* Error codes for the BIO functions. */ 799 800 /* Function codes. */ 801 enum BIO_F_ACPT_STATE = 100; 802 enum BIO_F_BIO_ACCEPT = 101; 803 enum BIO_F_BIO_BER_GET_HEADER = 102; 804 enum BIO_F_BIO_CALLBACK_CTRL = 131; 805 enum BIO_F_BIO_CTRL = 103; 806 enum BIO_F_BIO_GETHOSTBYNAME = 120; 807 enum BIO_F_BIO_GETS = 104; 808 enum BIO_F_BIO_GET_ACCEPT_SOCKET = 105; 809 enum BIO_F_BIO_GET_HOST_IP = 106; 810 enum BIO_F_BIO_GET_PORT = 107; 811 enum BIO_F_BIO_MAKE_PAIR = 121; 812 enum BIO_F_BIO_NEW = 108; 813 enum BIO_F_BIO_NEW_FILE = 109; 814 enum BIO_F_BIO_NEW_MEM_BUF = 126; 815 enum BIO_F_BIO_NREAD = 123; 816 enum BIO_F_BIO_NREAD0 = 124; 817 enum BIO_F_BIO_NWRITE = 125; 818 enum BIO_F_BIO_NWRITE0 = 122; 819 enum BIO_F_BIO_PUTS = 110; 820 enum BIO_F_BIO_READ = 111; 821 enum BIO_F_BIO_SOCK_INIT = 112; 822 enum BIO_F_BIO_WRITE = 113; 823 enum BIO_F_BUFFER_CTRL = 114; 824 enum BIO_F_CONN_CTRL = 127; 825 enum BIO_F_CONN_STATE = 115; 826 enum BIO_F_DGRAM_SCTP_READ = 132; 827 enum BIO_F_FILE_CTRL = 116; 828 enum BIO_F_FILE_READ = 130; 829 enum BIO_F_LINEBUFFER_CTRL = 129; 830 enum BIO_F_MEM_READ = 128; 831 enum BIO_F_MEM_WRITE = 117; 832 enum BIO_F_SSL_NEW = 118; 833 enum BIO_F_WSASTARTUP = 119; 834 835 /* Reason codes. */ 836 enum BIO_R_ACCEPT_ERROR = 100; 837 enum BIO_R_BAD_FOPEN_MODE = 101; 838 enum BIO_R_BAD_HOSTNAME_LOOKUP = 102; 839 enum BIO_R_BROKEN_PIPE = 124; 840 enum BIO_R_CONNECT_ERROR = 103; 841 enum BIO_R_EOF_ON_MEMORY_BIO = 127; 842 enum BIO_R_ERROR_SETTING_NBIO = 104; 843 enum BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET = 105; 844 enum BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET = 106; 845 enum BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET = 107; 846 enum BIO_R_INVALID_ARGUMENT = 125; 847 enum BIO_R_INVALID_IP_ADDRESS = 108; 848 enum BIO_R_IN_USE = 123; 849 enum BIO_R_KEEPALIVE = 109; 850 enum BIO_R_NBIO_CONNECT_ERROR = 110; 851 enum BIO_R_NO_ACCEPT_PORT_SPECIFIED = 111; 852 enum BIO_R_NO_HOSTNAME_SPECIFIED = 112; 853 enum BIO_R_NO_PORT_DEFINED = 113; 854 enum BIO_R_NO_PORT_SPECIFIED = 114; 855 enum BIO_R_NO_SUCH_FILE = 128; 856 enum BIO_R_NULL_PARAMETER = 115; 857 enum BIO_R_TAG_MISMATCH = 116; 858 enum BIO_R_UNABLE_TO_BIND_SOCKET = 117; 859 enum BIO_R_UNABLE_TO_CREATE_SOCKET = 118; 860 enum BIO_R_UNABLE_TO_LISTEN_SOCKET = 119; 861 enum BIO_R_UNINITIALIZED = 120; 862 enum BIO_R_UNSUPPORTED_METHOD = 121; 863 enum BIO_R_WRITE_TO_READ_ONLY_BIO = 126; 864 enum BIO_R_WSASTARTUP = 122;