diff options
Diffstat (limited to 'src/lib/libcrypto/bio/bio.h')
-rw-r--r-- | src/lib/libcrypto/bio/bio.h | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index ebdb18170b..97003b503c 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
@@ -59,14 +59,17 @@ | |||
59 | #ifndef HEADER_BIO_H | 59 | #ifndef HEADER_BIO_H |
60 | #define HEADER_BIO_H | 60 | #define HEADER_BIO_H |
61 | 61 | ||
62 | #ifdef __cplusplus | 62 | #ifndef NO_FP_API |
63 | extern "C" { | 63 | # include <stdio.h> |
64 | #endif | 64 | #endif |
65 | #include <stdarg.h> | ||
65 | 66 | ||
66 | #include <stdio.h> | ||
67 | #include <stdlib.h> | ||
68 | #include <openssl/crypto.h> | 67 | #include <openssl/crypto.h> |
69 | 68 | ||
69 | #ifdef __cplusplus | ||
70 | extern "C" { | ||
71 | #endif | ||
72 | |||
70 | /* These are the 'types' of BIOs */ | 73 | /* These are the 'types' of BIOs */ |
71 | #define BIO_TYPE_NONE 0 | 74 | #define BIO_TYPE_NONE 0 |
72 | #define BIO_TYPE_MEM (1|0x0400) | 75 | #define BIO_TYPE_MEM (1|0x0400) |
@@ -88,6 +91,7 @@ extern "C" { | |||
88 | #define BIO_TYPE_NULL_FILTER (17|0x0200) | 91 | #define BIO_TYPE_NULL_FILTER (17|0x0200) |
89 | #define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ | 92 | #define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ |
90 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ | 93 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ |
94 | #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ | ||
91 | 95 | ||
92 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ | 96 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ |
93 | #define BIO_TYPE_FILTER 0x0200 | 97 | #define BIO_TYPE_FILTER 0x0200 |
@@ -207,19 +211,23 @@ extern "C" { | |||
207 | #define BIO_method_name(b) ((b)->method->name) | 211 | #define BIO_method_name(b) ((b)->method->name) |
208 | #define BIO_method_type(b) ((b)->method->type) | 212 | #define BIO_method_type(b) ((b)->method->type) |
209 | 213 | ||
214 | typedef struct bio_st BIO; | ||
215 | |||
216 | typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); | ||
217 | |||
210 | #ifndef WIN16 | 218 | #ifndef WIN16 |
211 | typedef struct bio_method_st | 219 | typedef struct bio_method_st |
212 | { | 220 | { |
213 | int type; | 221 | int type; |
214 | const char *name; | 222 | const char *name; |
215 | int (*bwrite)(); | 223 | int (*bwrite)(BIO *, const char *, int); |
216 | int (*bread)(); | 224 | int (*bread)(BIO *, char *, int); |
217 | int (*bputs)(); | 225 | int (*bputs)(BIO *, const char *); |
218 | int (*bgets)(); | 226 | int (*bgets)(BIO *, char *, int); |
219 | long (*ctrl)(); | 227 | long (*ctrl)(BIO *, int, long, void *); |
220 | int (*create)(); | 228 | int (*create)(BIO *); |
221 | int (*destroy)(); | 229 | int (*destroy)(BIO *); |
222 | long (*callback_ctrl)(); | 230 | long (*callback_ctrl)(BIO *, int, bio_info_cb *); |
223 | } BIO_METHOD; | 231 | } BIO_METHOD; |
224 | #else | 232 | #else |
225 | typedef struct bio_method_st | 233 | typedef struct bio_method_st |
@@ -237,7 +245,7 @@ typedef struct bio_method_st | |||
237 | } BIO_METHOD; | 245 | } BIO_METHOD; |
238 | #endif | 246 | #endif |
239 | 247 | ||
240 | typedef struct bio_st | 248 | struct bio_st |
241 | { | 249 | { |
242 | BIO_METHOD *method; | 250 | BIO_METHOD *method; |
243 | /* bio, mode, argp, argi, argl, ret */ | 251 | /* bio, mode, argp, argi, argl, ret */ |
@@ -257,7 +265,9 @@ typedef struct bio_st | |||
257 | unsigned long num_write; | 265 | unsigned long num_write; |
258 | 266 | ||
259 | CRYPTO_EX_DATA ex_data; | 267 | CRYPTO_EX_DATA ex_data; |
260 | } BIO; | 268 | }; |
269 | |||
270 | DECLARE_STACK_OF(BIO) | ||
261 | 271 | ||
262 | typedef struct bio_f_buffer_ctx_struct | 272 | typedef struct bio_f_buffer_ctx_struct |
263 | { | 273 | { |
@@ -454,8 +464,8 @@ int BIO_read_filename(BIO *b,const char *name); | |||
454 | size_t BIO_ctrl_pending(BIO *b); | 464 | size_t BIO_ctrl_pending(BIO *b); |
455 | size_t BIO_ctrl_wpending(BIO *b); | 465 | size_t BIO_ctrl_wpending(BIO *b); |
456 | #define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) | 466 | #define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) |
457 | #define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0,(void (**)())(cbp)) | 467 | #define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0,(bio_info_cb **)(cbp)) |
458 | #define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,(void (*)())(cb)) | 468 | #define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,(bio_info_cb *)(cb)) |
459 | 469 | ||
460 | /* For the BIO_f_buffer() type */ | 470 | /* For the BIO_f_buffer() type */ |
461 | #define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) | 471 | #define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) |
@@ -465,6 +475,7 @@ size_t BIO_ctrl_wpending(BIO *b); | |||
465 | #define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) | 475 | #define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) |
466 | #define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) | 476 | #define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) |
467 | #define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) | 477 | #define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) |
478 | #define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) | ||
468 | /* macros with inappropriate type -- but ...pending macros use int too: */ | 479 | /* macros with inappropriate type -- but ...pending macros use int too: */ |
469 | #define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) | 480 | #define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) |
470 | #define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) | 481 | #define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) |
@@ -472,11 +483,6 @@ size_t BIO_ctrl_get_write_guarantee(BIO *b); | |||
472 | size_t BIO_ctrl_get_read_request(BIO *b); | 483 | size_t BIO_ctrl_get_read_request(BIO *b); |
473 | int BIO_ctrl_reset_read_request(BIO *b); | 484 | int BIO_ctrl_reset_read_request(BIO *b); |
474 | 485 | ||
475 | #ifdef NO_STDIO | ||
476 | #define NO_FP_API | ||
477 | #endif | ||
478 | |||
479 | |||
480 | /* These two aren't currently implemented */ | 486 | /* These two aren't currently implemented */ |
481 | /* int BIO_get_ex_num(BIO *bio); */ | 487 | /* int BIO_get_ex_num(BIO *bio); */ |
482 | /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ | 488 | /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ |
@@ -487,6 +493,7 @@ int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | |||
487 | unsigned long BIO_number_read(BIO *bio); | 493 | unsigned long BIO_number_read(BIO *bio); |
488 | unsigned long BIO_number_written(BIO *bio); | 494 | unsigned long BIO_number_written(BIO *bio); |
489 | 495 | ||
496 | # ifndef NO_FP_API | ||
490 | # if defined(WIN16) && defined(_WINDLL) | 497 | # if defined(WIN16) && defined(_WINDLL) |
491 | BIO_METHOD *BIO_s_file_internal(void); | 498 | BIO_METHOD *BIO_s_file_internal(void); |
492 | BIO *BIO_new_file_internal(char *filename, char *mode); | 499 | BIO *BIO_new_file_internal(char *filename, char *mode); |
@@ -502,21 +509,24 @@ BIO *BIO_new_fp(FILE *stream, int close_flag); | |||
502 | # define BIO_new_file_internal BIO_new_file | 509 | # define BIO_new_file_internal BIO_new_file |
503 | # define BIO_new_fp_internal BIO_s_file | 510 | # define BIO_new_fp_internal BIO_s_file |
504 | # endif /* FP_API */ | 511 | # endif /* FP_API */ |
512 | # endif | ||
505 | BIO * BIO_new(BIO_METHOD *type); | 513 | BIO * BIO_new(BIO_METHOD *type); |
506 | int BIO_set(BIO *a,BIO_METHOD *type); | 514 | int BIO_set(BIO *a,BIO_METHOD *type); |
507 | int BIO_free(BIO *a); | 515 | int BIO_free(BIO *a); |
516 | void BIO_vfree(BIO *a); | ||
508 | int BIO_read(BIO *b, void *data, int len); | 517 | int BIO_read(BIO *b, void *data, int len); |
509 | int BIO_gets(BIO *bp,char *buf, int size); | 518 | int BIO_gets(BIO *bp,char *buf, int size); |
510 | int BIO_write(BIO *b, const void *data, int len); | 519 | int BIO_write(BIO *b, const void *data, int len); |
511 | int BIO_puts(BIO *bp,const char *buf); | 520 | int BIO_puts(BIO *bp,const char *buf); |
512 | long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); | 521 | long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); |
513 | long BIO_callback_ctrl(BIO *bp,int cmd,void (*fp)()); | 522 | long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)); |
514 | char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); | 523 | char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); |
515 | long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); | 524 | long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); |
516 | BIO * BIO_push(BIO *b,BIO *append); | 525 | BIO * BIO_push(BIO *b,BIO *append); |
517 | BIO * BIO_pop(BIO *b); | 526 | BIO * BIO_pop(BIO *b); |
518 | void BIO_free_all(BIO *a); | 527 | void BIO_free_all(BIO *a); |
519 | BIO * BIO_find_type(BIO *b,int bio_type); | 528 | BIO * BIO_find_type(BIO *b,int bio_type); |
529 | BIO * BIO_next(BIO *b); | ||
520 | BIO * BIO_get_retry_BIO(BIO *bio, int *reason); | 530 | BIO * BIO_get_retry_BIO(BIO *bio, int *reason); |
521 | int BIO_get_retry_reason(BIO *bio); | 531 | int BIO_get_retry_reason(BIO *bio); |
522 | BIO * BIO_dup_chain(BIO *in); | 532 | BIO * BIO_dup_chain(BIO *in); |
@@ -545,6 +555,9 @@ BIO_METHOD *BIO_s_bio(void); | |||
545 | BIO_METHOD *BIO_s_null(void); | 555 | BIO_METHOD *BIO_s_null(void); |
546 | BIO_METHOD *BIO_f_null(void); | 556 | BIO_METHOD *BIO_f_null(void); |
547 | BIO_METHOD *BIO_f_buffer(void); | 557 | BIO_METHOD *BIO_f_buffer(void); |
558 | #ifdef VMS | ||
559 | BIO_METHOD *BIO_f_linebuffer(void); | ||
560 | #endif | ||
548 | BIO_METHOD *BIO_f_nbio_test(void); | 561 | BIO_METHOD *BIO_f_nbio_test(void); |
549 | /* BIO_METHOD *BIO_f_ber(void); */ | 562 | /* BIO_METHOD *BIO_f_ber(void); */ |
550 | 563 | ||
@@ -553,6 +566,7 @@ int BIO_sock_non_fatal_error(int error); | |||
553 | int BIO_fd_should_retry(int i); | 566 | int BIO_fd_should_retry(int i); |
554 | int BIO_fd_non_fatal_error(int error); | 567 | int BIO_fd_non_fatal_error(int error); |
555 | int BIO_dump(BIO *b,const char *bytes,int len); | 568 | int BIO_dump(BIO *b,const char *bytes,int len); |
569 | int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent); | ||
556 | 570 | ||
557 | struct hostent *BIO_gethostbyname(const char *name); | 571 | struct hostent *BIO_gethostbyname(const char *name); |
558 | /* We might want a thread-safe interface too: | 572 | /* We might want a thread-safe interface too: |
@@ -592,7 +606,10 @@ void BIO_copy_next_retry(BIO *b); | |||
592 | 606 | ||
593 | long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); | 607 | long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); |
594 | 608 | ||
595 | int BIO_printf(BIO *bio, ...); | 609 | int BIO_printf(BIO *bio, const char *format, ...); |
610 | int BIO_vprintf(BIO *bio, const char *format, va_list args); | ||
611 | int BIO_snprintf(char *buf, size_t n, const char *format, ...); | ||
612 | int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args); | ||
596 | 613 | ||
597 | /* BEGIN ERROR CODES */ | 614 | /* BEGIN ERROR CODES */ |
598 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 615 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
@@ -627,6 +644,8 @@ int BIO_printf(BIO *bio, ...); | |||
627 | #define BIO_F_CONN_CTRL 127 | 644 | #define BIO_F_CONN_CTRL 127 |
628 | #define BIO_F_CONN_STATE 115 | 645 | #define BIO_F_CONN_STATE 115 |
629 | #define BIO_F_FILE_CTRL 116 | 646 | #define BIO_F_FILE_CTRL 116 |
647 | #define BIO_F_LINEBUFFER_CTRL 129 | ||
648 | #define BIO_F_MEM_READ 128 | ||
630 | #define BIO_F_MEM_WRITE 117 | 649 | #define BIO_F_MEM_WRITE 117 |
631 | #define BIO_F_SSL_NEW 118 | 650 | #define BIO_F_SSL_NEW 118 |
632 | #define BIO_F_WSASTARTUP 119 | 651 | #define BIO_F_WSASTARTUP 119 |
@@ -637,6 +656,7 @@ int BIO_printf(BIO *bio, ...); | |||
637 | #define BIO_R_BAD_HOSTNAME_LOOKUP 102 | 656 | #define BIO_R_BAD_HOSTNAME_LOOKUP 102 |
638 | #define BIO_R_BROKEN_PIPE 124 | 657 | #define BIO_R_BROKEN_PIPE 124 |
639 | #define BIO_R_CONNECT_ERROR 103 | 658 | #define BIO_R_CONNECT_ERROR 103 |
659 | #define BIO_R_EOF_ON_MEMORY_BIO 127 | ||
640 | #define BIO_R_ERROR_SETTING_NBIO 104 | 660 | #define BIO_R_ERROR_SETTING_NBIO 104 |
641 | #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 | 661 | #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 |
642 | #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 | 662 | #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 |