diff options
Diffstat (limited to 'src/lib/libcrypto/bio/bio.h')
-rw-r--r-- | src/lib/libcrypto/bio/bio.h | 343 |
1 files changed, 149 insertions, 194 deletions
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index 300b330e00..54bf622a3b 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
@@ -63,7 +63,9 @@ | |||
63 | extern "C" { | 63 | extern "C" { |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #include "crypto.h" | 66 | #include <stdio.h> |
67 | #include <stdlib.h> | ||
68 | #include <openssl/crypto.h> | ||
67 | 69 | ||
68 | /* These are the 'types' of BIOs */ | 70 | /* These are the 'types' of BIOs */ |
69 | #define BIO_TYPE_NONE 0 | 71 | #define BIO_TYPE_NONE 0 |
@@ -84,6 +86,8 @@ extern "C" { | |||
84 | #define BIO_TYPE_PROXY_SERVER (15|0x0200) /* server proxy BIO */ | 86 | #define BIO_TYPE_PROXY_SERVER (15|0x0200) /* server proxy BIO */ |
85 | #define BIO_TYPE_NBIO_TEST (16|0x0200) /* server proxy BIO */ | 87 | #define BIO_TYPE_NBIO_TEST (16|0x0200) /* server proxy BIO */ |
86 | #define BIO_TYPE_NULL_FILTER (17|0x0200) | 88 | #define BIO_TYPE_NULL_FILTER (17|0x0200) |
89 | #define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ | ||
90 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ | ||
87 | 91 | ||
88 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ | 92 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ |
89 | #define BIO_TYPE_FILTER 0x0200 | 93 | #define BIO_TYPE_FILTER 0x0200 |
@@ -202,7 +206,7 @@ extern "C" { | |||
202 | typedef struct bio_method_st | 206 | typedef struct bio_method_st |
203 | { | 207 | { |
204 | int type; | 208 | int type; |
205 | char *name; | 209 | const char *name; |
206 | int (*bwrite)(); | 210 | int (*bwrite)(); |
207 | int (*bread)(); | 211 | int (*bread)(); |
208 | int (*bputs)(); | 212 | int (*bputs)(); |
@@ -215,7 +219,7 @@ typedef struct bio_method_st | |||
215 | typedef struct bio_method_st | 219 | typedef struct bio_method_st |
216 | { | 220 | { |
217 | int type; | 221 | int type; |
218 | char *name; | 222 | const char *name; |
219 | int (_far *bwrite)(); | 223 | int (_far *bwrite)(); |
220 | int (_far *bread)(); | 224 | int (_far *bread)(); |
221 | int (_far *bputs)(); | 225 | int (_far *bputs)(); |
@@ -229,12 +233,8 @@ typedef struct bio_method_st | |||
229 | typedef struct bio_st | 233 | typedef struct bio_st |
230 | { | 234 | { |
231 | BIO_METHOD *method; | 235 | BIO_METHOD *method; |
232 | #ifndef NOPROTO | ||
233 | /* bio, mode, argp, argi, argl, ret */ | 236 | /* bio, mode, argp, argi, argl, ret */ |
234 | long (*callback)(struct bio_st *,int,char *,int, long,long); | 237 | long (*callback)(struct bio_st *,int,const char *,int, long,long); |
235 | #else | ||
236 | long (*callback)(); | ||
237 | #endif | ||
238 | char *cb_arg; /* first argument for the callback */ | 238 | char *cb_arg; /* first argument for the callback */ |
239 | 239 | ||
240 | int init; | 240 | int init; |
@@ -242,7 +242,7 @@ typedef struct bio_st | |||
242 | int flags; /* extra storage */ | 242 | int flags; /* extra storage */ |
243 | int retry_reason; | 243 | int retry_reason; |
244 | int num; | 244 | int num; |
245 | char *ptr; | 245 | void *ptr; |
246 | struct bio_st *next_bio; /* used by filter BIOs */ | 246 | struct bio_st *next_bio; /* used by filter BIOs */ |
247 | struct bio_st *prev_bio; /* used by filter BIOs */ | 247 | struct bio_st *prev_bio; /* used by filter BIOs */ |
248 | int references; | 248 | int references; |
@@ -276,7 +276,7 @@ typedef struct bio_f_buffer_ctx_struct | |||
276 | #define BIO_CONN_S_OK 6 | 276 | #define BIO_CONN_S_OK 6 |
277 | #define BIO_CONN_S_BLOCKED_CONNECT 7 | 277 | #define BIO_CONN_S_BLOCKED_CONNECT 7 |
278 | #define BIO_CONN_S_NBIO 8 | 278 | #define BIO_CONN_S_NBIO 8 |
279 | #define BIO_CONN_get_param_hostname BIO_ctrl | 279 | /*#define BIO_CONN_get_param_hostname BIO_ctrl */ |
280 | 280 | ||
281 | #define BIO_number_read(b) ((b)->num_read) | 281 | #define BIO_number_read(b) ((b)->num_read) |
282 | #define BIO_number_written(b) ((b)->num_write) | 282 | #define BIO_number_written(b) ((b)->num_write) |
@@ -309,18 +309,28 @@ typedef struct bio_f_buffer_ctx_struct | |||
309 | #define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 | 309 | #define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 |
310 | #define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 | 310 | #define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 |
311 | #define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 | 311 | #define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 |
312 | #define BIO_C_FILE_SEEK 128 | ||
313 | #define BIO_C_GET_CIPHER_CTX 129 | ||
314 | #define BIO_C_SET_BUF_MEM_EOF_RETURN 130/*return end of input value*/ | ||
315 | #define BIO_C_SET_BIND_MODE 131 | ||
316 | #define BIO_C_GET_BIND_MODE 132 | ||
317 | #define BIO_C_FILE_TELL 133 | ||
318 | #define BIO_C_GET_SOCKS 134 | ||
319 | #define BIO_C_SET_SOCKS 135 | ||
320 | |||
321 | #define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ | ||
322 | #define BIO_C_GET_WRITE_BUF_SIZE 137 | ||
323 | #define BIO_C_MAKE_BIO_PAIR 138 | ||
324 | #define BIO_C_DESTROY_BIO_PAIR 139 | ||
325 | #define BIO_C_GET_WRITE_GUARANTEE 140 | ||
326 | #define BIO_C_GET_READ_REQUEST 141 | ||
327 | #define BIO_C_SHUTDOWN_WR 142 | ||
328 | |||
312 | 329 | ||
313 | #define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,(char *)arg) | 330 | #define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,(char *)arg) |
314 | #define BIO_get_app_data(s) BIO_get_ex_data(s,0) | 331 | #define BIO_get_app_data(s) BIO_get_ex_data(s,0) |
315 | 332 | ||
316 | int BIO_get_ex_num(BIO *bio); | 333 | /* BIO_s_connect() and BIO_s_socks4a_connect() */ |
317 | int BIO_set_ex_data(BIO *bio,int idx,char *data); | ||
318 | char *BIO_get_ex_data(BIO *bio,int idx); | ||
319 | void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); | ||
320 | int BIO_get_ex_new_index(long argl, char *argp, int (*new_func)(), | ||
321 | int (*dup_func)(), void (*free_func)()); | ||
322 | |||
323 | /* BIO_s_connect_socket() */ | ||
324 | #define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name) | 334 | #define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name) |
325 | #define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port) | 335 | #define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port) |
326 | #define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip) | 336 | #define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip) |
@@ -328,7 +338,8 @@ int BIO_get_ex_new_index(long argl, char *argp, int (*new_func)(), | |||
328 | #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) | 338 | #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) |
329 | #define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) | 339 | #define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) |
330 | #define BIO_get_conn_ip(b,ip) BIO_ptr_ctrl(b,BIO_C_SET_CONNECT,2) | 340 | #define BIO_get_conn_ip(b,ip) BIO_ptr_ctrl(b,BIO_C_SET_CONNECT,2) |
331 | #define BIO_get_conn_int port(b,port) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,port) | 341 | #define BIO_get_conn_int_port(b,port) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,port) |
342 | |||
332 | 343 | ||
333 | #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) | 344 | #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) |
334 | 345 | ||
@@ -339,6 +350,12 @@ int BIO_get_ex_new_index(long argl, char *argp, int (*new_func)(), | |||
339 | #define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a":NULL) | 350 | #define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a":NULL) |
340 | #define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) | 351 | #define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) |
341 | 352 | ||
353 | #define BIO_BIND_NORMAL 0 | ||
354 | #define BIO_BIND_REUSEADDR_IF_UNUSED 1 | ||
355 | #define BIO_BIND_REUSEADDR 2 | ||
356 | #define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) | ||
357 | #define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) | ||
358 | |||
342 | #define BIO_do_connect(b) BIO_do_handshake(b) | 359 | #define BIO_do_connect(b) BIO_do_handshake(b) |
343 | #define BIO_do_accept(b) BIO_do_handshake(b) | 360 | #define BIO_do_accept(b) BIO_do_handshake(b) |
344 | #define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) | 361 | #define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) |
@@ -364,12 +381,26 @@ int BIO_get_ex_new_index(long argl, char *argp, int (*new_func)(), | |||
364 | #define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp) | 381 | #define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp) |
365 | #define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp) | 382 | #define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp) |
366 | 383 | ||
384 | #define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) | ||
385 | #define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) | ||
386 | |||
387 | /* name is cast to lose const, but might be better to route through a function | ||
388 | so we can do it safely */ | ||
389 | #ifdef CONST_STRICT | ||
390 | /* If you are wondering why this isn't defined, its because CONST_STRICT is | ||
391 | * purely a compile-time kludge to allow const to be checked. | ||
392 | */ | ||
393 | int BIO_read_filename(BIO *b,const char *name); | ||
394 | #else | ||
367 | #define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ | 395 | #define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ |
368 | BIO_CLOSE|BIO_FP_READ,name) | 396 | BIO_CLOSE|BIO_FP_READ,(char *)name) |
397 | #endif | ||
369 | #define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ | 398 | #define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ |
370 | BIO_CLOSE|BIO_FP_WRITE,name) | 399 | BIO_CLOSE|BIO_FP_WRITE,name) |
371 | #define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ | 400 | #define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ |
372 | BIO_CLOSE|BIO_FP_APPEND,name) | 401 | BIO_CLOSE|BIO_FP_APPEND,name) |
402 | #define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ | ||
403 | BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) | ||
373 | 404 | ||
374 | /* WARNING WARNING, this ups the reference count on the read bio of the | 405 | /* WARNING WARNING, this ups the reference count on the read bio of the |
375 | * SSL structure. This is because the ssl read BIO is now pointed to by | 406 | * SSL structure. This is because the ssl read BIO is now pointed to by |
@@ -388,8 +419,11 @@ int BIO_get_ex_new_index(long argl, char *argp, int (*new_func)(), | |||
388 | /* defined in evp.h */ | 419 | /* defined in evp.h */ |
389 | /* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */ | 420 | /* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */ |
390 | 421 | ||
422 | #define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp) | ||
391 | #define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm) | 423 | #define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm) |
392 | #define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp) | 424 | #define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp) |
425 | #define BIO_set_mem_eof_return(b,v) \ | ||
426 | BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) | ||
393 | 427 | ||
394 | /* For the BIO_f_buffer() type */ | 428 | /* For the BIO_f_buffer() type */ |
395 | #define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) | 429 | #define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) |
@@ -407,6 +441,9 @@ int BIO_get_ex_new_index(long argl, char *argp, int (*new_func)(), | |||
407 | #define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) | 441 | #define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) |
408 | #define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) | 442 | #define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) |
409 | #define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) | 443 | #define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) |
444 | /* ...pending macros have inappropriate return type */ | ||
445 | size_t BIO_ctrl_pending(BIO *b); | ||
446 | size_t BIO_ctrl_wpending(BIO *b); | ||
410 | #define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) | 447 | #define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) |
411 | #define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0,(char *)cbp) | 448 | #define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0,(char *)cbp) |
412 | #define BIO_set_info_callback(b,cb) (int)BIO_ctrl(b,BIO_CTRL_SET_CALLBACK,0,(char *)cb) | 449 | #define BIO_set_info_callback(b,cb) (int)BIO_ctrl(b,BIO_CTRL_SET_CALLBACK,0,(char *)cb) |
@@ -414,11 +451,32 @@ int BIO_get_ex_new_index(long argl, char *argp, int (*new_func)(), | |||
414 | /* For the BIO_f_buffer() type */ | 451 | /* For the BIO_f_buffer() type */ |
415 | #define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) | 452 | #define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) |
416 | 453 | ||
454 | /* For BIO_s_bio() */ | ||
455 | #define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) | ||
456 | #define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) | ||
457 | #define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) | ||
458 | #define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) | ||
459 | /* macros with inappropriate type -- but ...pending macros use int too: */ | ||
460 | #define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) | ||
461 | #define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) | ||
462 | size_t BIO_ctrl_get_write_guarantee(BIO *b); | ||
463 | size_t BIO_ctrl_get_read_request(BIO *b); | ||
464 | |||
465 | |||
466 | |||
417 | #ifdef NO_STDIO | 467 | #ifdef NO_STDIO |
418 | #define NO_FP_API | 468 | #define NO_FP_API |
419 | #endif | 469 | #endif |
420 | 470 | ||
421 | #ifndef NOPROTO | 471 | |
472 | /* These two aren't currently implemented */ | ||
473 | /* int BIO_get_ex_num(BIO *bio); */ | ||
474 | /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ | ||
475 | int BIO_set_ex_data(BIO *bio,int idx,char *data); | ||
476 | char *BIO_get_ex_data(BIO *bio,int idx); | ||
477 | int BIO_get_ex_new_index(long argl, char *argp, int (*new_func)(), | ||
478 | int (*dup_func)(), void (*free_func)()); | ||
479 | |||
422 | # if defined(WIN16) && defined(_WINDLL) | 480 | # if defined(WIN16) && defined(_WINDLL) |
423 | BIO_METHOD *BIO_s_file_internal(void); | 481 | BIO_METHOD *BIO_s_file_internal(void); |
424 | BIO *BIO_new_file_internal(char *filename, char *mode); | 482 | BIO *BIO_new_file_internal(char *filename, char *mode); |
@@ -428,39 +486,20 @@ BIO *BIO_new_fp_internal(FILE *stream, int close_flag); | |||
428 | # define BIO_new_fp BIO_new_fp_internal | 486 | # define BIO_new_fp BIO_new_fp_internal |
429 | # else /* FP_API */ | 487 | # else /* FP_API */ |
430 | BIO_METHOD *BIO_s_file(void ); | 488 | BIO_METHOD *BIO_s_file(void ); |
431 | BIO *BIO_new_file(char *filename, char *mode); | 489 | BIO *BIO_new_file(const char *filename, const char *mode); |
432 | BIO *BIO_new_fp(FILE *stream, int close_flag); | 490 | BIO *BIO_new_fp(FILE *stream, int close_flag); |
433 | # define BIO_s_file_internal BIO_s_file | 491 | # define BIO_s_file_internal BIO_s_file |
434 | # define BIO_new_file_internal BIO_new_file | 492 | # define BIO_new_file_internal BIO_new_file |
435 | # define BIO_new_fp_internal BIO_s_file | 493 | # define BIO_new_fp_internal BIO_s_file |
436 | # endif /* FP_API */ | 494 | # endif /* FP_API */ |
437 | #else | ||
438 | # if defined(WIN16) && defined(_WINDLL) | ||
439 | BIO_METHOD *BIO_s_file_internal(); | ||
440 | BIO *BIO_new_file_internal(); | ||
441 | BIO *BIO_new_fp_internal(); | ||
442 | # define BIO_s_file BIO_s_file_internal | ||
443 | # define BIO_new_file BIO_new_file_internal | ||
444 | # define BIO_new_fp BIO_new_fp_internal | ||
445 | # else /* FP_API */ | ||
446 | BIO_METHOD *BIO_s_file(); | ||
447 | BIO *BIO_new_file(); | ||
448 | BIO *BIO_new_fp(); | ||
449 | # define BIO_s_file_internal BIO_s_file | ||
450 | # define BIO_new_file_internal BIO_new_file | ||
451 | # define BIO_new_fp_internal BIO_s_file | ||
452 | # endif /* FP_API */ | ||
453 | #endif | ||
454 | |||
455 | #ifndef NOPROTO | ||
456 | BIO * BIO_new(BIO_METHOD *type); | 495 | BIO * BIO_new(BIO_METHOD *type); |
457 | int BIO_set(BIO *a,BIO_METHOD *type); | 496 | int BIO_set(BIO *a,BIO_METHOD *type); |
458 | int BIO_free(BIO *a); | 497 | int BIO_free(BIO *a); |
459 | int BIO_read(BIO *b, char *data, int len); | 498 | int BIO_read(BIO *b, void *data, int len); |
460 | int BIO_gets(BIO *bp,char *buf, int size); | 499 | int BIO_gets(BIO *bp,char *buf, int size); |
461 | int BIO_write(BIO *b, char *data, int len); | 500 | int BIO_write(BIO *b, const char *data, int len); |
462 | int BIO_puts(BIO *bp,char *buf); | 501 | int BIO_puts(BIO *bp,const char *buf); |
463 | long BIO_ctrl(BIO *bp,int cmd,long larg,char *parg); | 502 | long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); |
464 | char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); | 503 | char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); |
465 | long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); | 504 | long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); |
466 | BIO * BIO_push(BIO *b,BIO *append); | 505 | BIO * BIO_push(BIO *b,BIO *append); |
@@ -472,10 +511,10 @@ int BIO_get_retry_reason(BIO *bio); | |||
472 | BIO * BIO_dup_chain(BIO *in); | 511 | BIO * BIO_dup_chain(BIO *in); |
473 | 512 | ||
474 | #ifndef WIN16 | 513 | #ifndef WIN16 |
475 | long BIO_debug_callback(BIO *bio,int cmd,char *argp,int argi, | 514 | long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, |
476 | long argl,long ret); | 515 | long argl,long ret); |
477 | #else | 516 | #else |
478 | long _far _loadds BIO_debug_callback(BIO *bio,int cmd,char *argp,int argi, | 517 | long _far _loadds BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, |
479 | long argl,long ret); | 518 | long argl,long ret); |
480 | #endif | 519 | #endif |
481 | 520 | ||
@@ -484,23 +523,35 @@ BIO_METHOD *BIO_s_socket(void); | |||
484 | BIO_METHOD *BIO_s_connect(void); | 523 | BIO_METHOD *BIO_s_connect(void); |
485 | BIO_METHOD *BIO_s_accept(void); | 524 | BIO_METHOD *BIO_s_accept(void); |
486 | BIO_METHOD *BIO_s_fd(void); | 525 | BIO_METHOD *BIO_s_fd(void); |
526 | BIO_METHOD *BIO_s_log(void); | ||
527 | BIO_METHOD *BIO_s_bio(void); | ||
487 | BIO_METHOD *BIO_s_null(void); | 528 | BIO_METHOD *BIO_s_null(void); |
488 | BIO_METHOD *BIO_f_null(void); | 529 | BIO_METHOD *BIO_f_null(void); |
489 | BIO_METHOD *BIO_f_nbio_test(void); | ||
490 | BIO_METHOD *BIO_f_buffer(void); | 530 | BIO_METHOD *BIO_f_buffer(void); |
531 | BIO_METHOD *BIO_f_nbio_test(void); | ||
532 | /* BIO_METHOD *BIO_f_ber(void); */ | ||
491 | 533 | ||
492 | int BIO_sock_should_retry(int i); | 534 | int BIO_sock_should_retry(int i); |
493 | int BIO_sock_non_fatal_error(int error); | 535 | int BIO_sock_non_fatal_error(int error); |
494 | int BIO_fd_should_retry(int i); | 536 | int BIO_fd_should_retry(int i); |
495 | int BIO_fd_non_fatal_error(int error); | 537 | int BIO_fd_non_fatal_error(int error); |
496 | int BIO_dump(BIO *b,char *bytes,int len); | 538 | int BIO_dump(BIO *b,const char *bytes,int len); |
497 | 539 | ||
498 | struct hostent *BIO_gethostbyname(char *name); | 540 | struct hostent *BIO_gethostbyname(const char *name); |
541 | /* We might want a thread-safe interface too: | ||
542 | * struct hostent *BIO_gethostbyname_r(const char *name, | ||
543 | * struct hostent *result, void *buffer, size_t buflen); | ||
544 | * or something similar (caller allocates a struct hostent, | ||
545 | * pointed to by "result", and additional buffer space for the various | ||
546 | * substructures; if the buffer does not suffice, NULL is returned | ||
547 | * and an appropriate error code is set). | ||
548 | */ | ||
499 | int BIO_sock_error(int sock); | 549 | int BIO_sock_error(int sock); |
500 | int BIO_socket_ioctl(int fd, long type, unsigned long *arg); | 550 | int BIO_socket_ioctl(int fd, long type, unsigned long *arg); |
501 | int BIO_get_port(char *str, short *port_ptr); | 551 | int BIO_socket_nbio(int fd,int mode); |
502 | int BIO_get_host_ip(char *str, unsigned char *ip); | 552 | int BIO_get_port(const char *str, unsigned short *port_ptr); |
503 | int BIO_get_accept_socket(char *host_port); | 553 | int BIO_get_host_ip(const char *str, unsigned char *ip); |
554 | int BIO_get_accept_socket(char *host_port,int mode); | ||
504 | int BIO_accept(int sock,char **ip_port); | 555 | int BIO_accept(int sock,char **ip_port); |
505 | int BIO_sock_init(void ); | 556 | int BIO_sock_init(void ); |
506 | void BIO_sock_cleanup(void); | 557 | void BIO_sock_cleanup(void); |
@@ -513,174 +564,78 @@ BIO *BIO_new_fd(int fd, int close_flag); | |||
513 | BIO *BIO_new_connect(char *host_port); | 564 | BIO *BIO_new_connect(char *host_port); |
514 | BIO *BIO_new_accept(char *host_port); | 565 | BIO *BIO_new_accept(char *host_port); |
515 | 566 | ||
567 | int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, | ||
568 | BIO **bio2, size_t writebuf2); | ||
569 | /* If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. | ||
570 | * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. | ||
571 | * Size 0 uses default value. | ||
572 | */ | ||
573 | |||
516 | void BIO_copy_next_retry(BIO *b); | 574 | void BIO_copy_next_retry(BIO *b); |
517 | 575 | ||
518 | long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); | 576 | long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); |
519 | 577 | ||
520 | #else | 578 | int BIO_printf(BIO *bio, ...); |
521 | |||
522 | BIO * BIO_new(); | ||
523 | int BIO_set(); | ||
524 | int BIO_free(); | ||
525 | int BIO_read(); | ||
526 | int BIO_gets(); | ||
527 | int BIO_write(); | ||
528 | int BIO_puts(); | ||
529 | char * BIO_ptr_ctrl(); | ||
530 | long BIO_ctrl(); | ||
531 | long BIO_int_ctrl(); | ||
532 | BIO * BIO_push(); | ||
533 | BIO * BIO_pop(); | ||
534 | void BIO_free_all(); | ||
535 | BIO * BIO_find_type(); | ||
536 | BIO * BIO_get_retry_BIO(); | ||
537 | int BIO_get_retry_reason(); | ||
538 | BIO * BIO_dup_chain(); | ||
539 | |||
540 | #ifndef WIN16 | ||
541 | long BIO_debug_callback(); | ||
542 | #else | ||
543 | long _far _loadds BIO_debug_callback(); | ||
544 | #endif | ||
545 | |||
546 | BIO_METHOD *BIO_s_mem(); | ||
547 | BIO_METHOD *BIO_s_socket(); | ||
548 | BIO_METHOD *BIO_s_connect(); | ||
549 | BIO_METHOD *BIO_s_accept(); | ||
550 | BIO_METHOD *BIO_s_fd(); | ||
551 | BIO_METHOD *BIO_s_null(); | ||
552 | BIO_METHOD *BIO_f_null(); | ||
553 | BIO_METHOD *BIO_f_buffer(); | ||
554 | BIO_METHOD *BIO_f_nbio_test(); | ||
555 | |||
556 | int BIO_sock_should_retry(); | ||
557 | int BIO_sock_non_fatal_error(); | ||
558 | int BIO_fd_should_retry(); | ||
559 | int BIO_fd_non_fatal_error(); | ||
560 | int BIO_dump(); | ||
561 | |||
562 | struct hostent *BIO_gethostbyname(); | ||
563 | int BIO_sock_error(); | ||
564 | int BIO_socket_ioctl(); | ||
565 | int BIO_get_port(); | ||
566 | int BIO_get_host_ip(); | ||
567 | int BIO_get_accept_socket(); | ||
568 | int BIO_accept(); | ||
569 | int BIO_sock_init(); | ||
570 | void BIO_sock_cleanup(); | ||
571 | int BIO_set_tcp_ndelay(); | ||
572 | |||
573 | void ERR_load_BIO_strings(); | ||
574 | |||
575 | BIO *BIO_new_socket(); | ||
576 | BIO *BIO_new_fd(); | ||
577 | BIO *BIO_new_connect(); | ||
578 | BIO *BIO_new_accept(); | ||
579 | |||
580 | void BIO_copy_next_retry(); | ||
581 | |||
582 | int BIO_ghbn_ctrl(); | ||
583 | |||
584 | #endif | ||
585 | |||
586 | /* Tim Hudson's portable varargs stuff */ | ||
587 | |||
588 | #ifndef NOPROTO | ||
589 | #define VAR_ANSI /* select ANSI version by default */ | ||
590 | #endif | ||
591 | |||
592 | #ifdef VAR_ANSI | ||
593 | /* ANSI version of a "portable" macro set for variable length args */ | ||
594 | #ifndef __STDARG_H__ /**/ | ||
595 | #include <stdarg.h> | ||
596 | #endif /**/ | ||
597 | |||
598 | #define VAR_PLIST(arg1type,arg1) arg1type arg1, ... | ||
599 | #define VAR_PLIST2(arg1type,arg1,arg2type,arg2) arg1type arg1,arg2type arg2,... | ||
600 | #define VAR_ALIST | ||
601 | #define VAR_BDEFN(args,arg1type,arg1) va_list args | ||
602 | #define VAR_BDEFN2(args,arg1type,arg1,arg2type,arg2) va_list args | ||
603 | #define VAR_INIT(args,arg1type,arg1) va_start(args,arg1); | ||
604 | #define VAR_INIT2(args,arg1type,arg1,arg2type,arg2) va_start(args,arg2); | ||
605 | #define VAR_ARG(args,type,arg) arg=va_arg(args,type) | ||
606 | #define VAR_END(args) va_end(args); | ||
607 | |||
608 | #else | ||
609 | |||
610 | /* K&R version of a "portable" macro set for variable length args */ | ||
611 | #ifndef __VARARGS_H__ | ||
612 | #include <varargs.h> | ||
613 | #endif | ||
614 | |||
615 | #define VAR_PLIST(arg1type,arg1) va_alist | ||
616 | #define VAR_PLIST2(arg1type,arg1,arg2type,arg2) va_alist | ||
617 | #define VAR_ALIST va_dcl | ||
618 | #define VAR_BDEFN(args,arg1type,arg1) va_list args; arg1type arg1 | ||
619 | #define VAR_BDEFN2(args,arg1type,arg1,arg2type,arg2) va_list args; \ | ||
620 | arg1type arg1; arg2type arg2 | ||
621 | #define VAR_INIT(args,arg1type,arg1) va_start(args); \ | ||
622 | arg1=va_arg(args,arg1type); | ||
623 | #define VAR_INIT2(args,arg1type,arg1,arg2type,arg2) va_start(args); \ | ||
624 | arg1=va_arg(args,arg1type); arg2=va_arg(args,arg2type); | ||
625 | #define VAR_ARG(args,type,arg) arg=va_arg(args,type) | ||
626 | #define VAR_END(args) va_end(args); | ||
627 | |||
628 | #endif | ||
629 | |||
630 | #ifndef NOPROTO | ||
631 | int BIO_printf( VAR_PLIST( BIO *, bio ) ); | ||
632 | #else | ||
633 | int BIO_printf(); | ||
634 | #endif | ||
635 | 579 | ||
636 | /* BEGIN ERROR CODES */ | 580 | /* BEGIN ERROR CODES */ |
581 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
582 | * made after this point may be overwritten when the script is next run. | ||
583 | */ | ||
584 | |||
637 | /* Error codes for the BIO functions. */ | 585 | /* Error codes for the BIO functions. */ |
638 | 586 | ||
639 | /* Function codes. */ | 587 | /* Function codes. */ |
640 | #define BIO_F_ACPT_STATE 100 | 588 | #define BIO_F_ACPT_STATE 100 |
641 | #define BIO_F_BIO_ACCEPT 101 | 589 | #define BIO_F_BIO_ACCEPT 101 |
642 | #define BIO_F_BIO_CTRL 102 | 590 | #define BIO_F_BIO_BER_GET_HEADER 102 |
643 | #define BIO_F_BIO_GETS 103 | 591 | #define BIO_F_BIO_CTRL 103 |
644 | #define BIO_F_BIO_GET_ACCEPT_SOCKET 104 | 592 | #define BIO_F_BIO_GETHOSTBYNAME 120 |
645 | #define BIO_F_BIO_GET_HOST_IP 105 | 593 | #define BIO_F_BIO_GETS 104 |
646 | #define BIO_F_BIO_GET_PORT 106 | 594 | #define BIO_F_BIO_GET_ACCEPT_SOCKET 105 |
647 | #define BIO_F_BIO_NEW 107 | 595 | #define BIO_F_BIO_GET_HOST_IP 106 |
648 | #define BIO_F_BIO_NEW_FILE 108 | 596 | #define BIO_F_BIO_GET_PORT 107 |
649 | #define BIO_F_BIO_PUTS 109 | 597 | #define BIO_F_BIO_MAKE_PAIR 121 |
650 | #define BIO_F_BIO_READ 110 | 598 | #define BIO_F_BIO_NEW 108 |
651 | #define BIO_F_BIO_SOCK_INIT 111 | 599 | #define BIO_F_BIO_NEW_FILE 109 |
652 | #define BIO_F_BIO_WRITE 112 | 600 | #define BIO_F_BIO_PUTS 110 |
653 | #define BIO_F_BUFFER_CTRL 113 | 601 | #define BIO_F_BIO_READ 111 |
654 | #define BIO_F_CONN_STATE 114 | 602 | #define BIO_F_BIO_SOCK_INIT 112 |
655 | #define BIO_F_FILE_CTRL 115 | 603 | #define BIO_F_BIO_WRITE 113 |
656 | #define BIO_F_MEM_WRITE 116 | 604 | #define BIO_F_BUFFER_CTRL 114 |
657 | #define BIO_F_SSL_NEW 117 | 605 | #define BIO_F_CONN_STATE 115 |
658 | #define BIO_F_WSASTARTUP 118 | 606 | #define BIO_F_FILE_CTRL 116 |
607 | #define BIO_F_MEM_WRITE 117 | ||
608 | #define BIO_F_SSL_NEW 118 | ||
609 | #define BIO_F_WSASTARTUP 119 | ||
659 | 610 | ||
660 | /* Reason codes. */ | 611 | /* Reason codes. */ |
661 | #define BIO_R_ACCEPT_ERROR 100 | 612 | #define BIO_R_ACCEPT_ERROR 100 |
662 | #define BIO_R_BAD_FOPEN_MODE 101 | 613 | #define BIO_R_BAD_FOPEN_MODE 101 |
663 | #define BIO_R_BAD_HOSTNAME_LOOKUP 102 | 614 | #define BIO_R_BAD_HOSTNAME_LOOKUP 102 |
615 | #define BIO_R_BROKEN_PIPE 124 | ||
664 | #define BIO_R_CONNECT_ERROR 103 | 616 | #define BIO_R_CONNECT_ERROR 103 |
665 | #define BIO_R_ERROR_SETTING_NBIO 104 | 617 | #define BIO_R_ERROR_SETTING_NBIO 104 |
666 | #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 | 618 | #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 |
667 | #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 | 619 | #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 |
668 | #define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 | 620 | #define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 |
621 | #define BIO_R_INVALID_ARGUMENT 125 | ||
669 | #define BIO_R_INVALID_IP_ADDRESS 108 | 622 | #define BIO_R_INVALID_IP_ADDRESS 108 |
623 | #define BIO_R_IN_USE 123 | ||
670 | #define BIO_R_KEEPALIVE 109 | 624 | #define BIO_R_KEEPALIVE 109 |
671 | #define BIO_R_NBIO_CONNECT_ERROR 110 | 625 | #define BIO_R_NBIO_CONNECT_ERROR 110 |
672 | #define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 | 626 | #define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 |
673 | #define BIO_R_NO_HOSTHNAME_SPECIFIED 112 | 627 | #define BIO_R_NO_HOSTNAME_SPECIFIED 112 |
674 | #define BIO_R_NO_PORT_DEFINED 113 | 628 | #define BIO_R_NO_PORT_DEFINED 113 |
675 | #define BIO_R_NO_PORT_SPECIFIED 114 | 629 | #define BIO_R_NO_PORT_SPECIFIED 114 |
676 | #define BIO_R_NULL_PARAMETER 115 | 630 | #define BIO_R_NULL_PARAMETER 115 |
677 | #define BIO_R_UNABLE_TO_BIND_SOCKET 116 | 631 | #define BIO_R_TAG_MISMATCH 116 |
678 | #define BIO_R_UNABLE_TO_CREATE_SOCKET 117 | 632 | #define BIO_R_UNABLE_TO_BIND_SOCKET 117 |
679 | #define BIO_R_UNABLE_TO_LISTEN_SOCKET 118 | 633 | #define BIO_R_UNABLE_TO_CREATE_SOCKET 118 |
680 | #define BIO_R_UNINITALISED 119 | 634 | #define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 |
681 | #define BIO_R_UNSUPPORTED_METHOD 120 | 635 | #define BIO_R_UNINITIALIZED 120 |
682 | #define BIO_R_WSASTARTUP 121 | 636 | #define BIO_R_UNSUPPORTED_METHOD 121 |
683 | 637 | #define BIO_R_WSASTARTUP 122 | |
638 | |||
684 | #ifdef __cplusplus | 639 | #ifdef __cplusplus |
685 | } | 640 | } |
686 | #endif | 641 | #endif |