summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bio.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bio/bio.h')
-rw-r--r--src/lib/libcrypto/bio/bio.h66
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
63extern "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
70extern "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
214typedef struct bio_st BIO;
215
216typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);
217
210#ifndef WIN16 218#ifndef WIN16
211typedef struct bio_method_st 219typedef 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
225typedef struct bio_method_st 233typedef 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
240typedef struct bio_st 248struct 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
270DECLARE_STACK_OF(BIO)
261 271
262typedef struct bio_f_buffer_ctx_struct 272typedef struct bio_f_buffer_ctx_struct
263 { 273 {
@@ -454,8 +464,8 @@ int BIO_read_filename(BIO *b,const char *name);
454size_t BIO_ctrl_pending(BIO *b); 464size_t BIO_ctrl_pending(BIO *b);
455size_t BIO_ctrl_wpending(BIO *b); 465size_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);
472size_t BIO_ctrl_get_read_request(BIO *b); 483size_t BIO_ctrl_get_read_request(BIO *b);
473int BIO_ctrl_reset_read_request(BIO *b); 484int 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,
487unsigned long BIO_number_read(BIO *bio); 493unsigned long BIO_number_read(BIO *bio);
488unsigned long BIO_number_written(BIO *bio); 494unsigned 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)
491BIO_METHOD *BIO_s_file_internal(void); 498BIO_METHOD *BIO_s_file_internal(void);
492BIO *BIO_new_file_internal(char *filename, char *mode); 499BIO *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
505BIO * BIO_new(BIO_METHOD *type); 513BIO * BIO_new(BIO_METHOD *type);
506int BIO_set(BIO *a,BIO_METHOD *type); 514int BIO_set(BIO *a,BIO_METHOD *type);
507int BIO_free(BIO *a); 515int BIO_free(BIO *a);
516void BIO_vfree(BIO *a);
508int BIO_read(BIO *b, void *data, int len); 517int BIO_read(BIO *b, void *data, int len);
509int BIO_gets(BIO *bp,char *buf, int size); 518int BIO_gets(BIO *bp,char *buf, int size);
510int BIO_write(BIO *b, const void *data, int len); 519int BIO_write(BIO *b, const void *data, int len);
511int BIO_puts(BIO *bp,const char *buf); 520int BIO_puts(BIO *bp,const char *buf);
512long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); 521long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
513long BIO_callback_ctrl(BIO *bp,int cmd,void (*fp)()); 522long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long));
514char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); 523char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg);
515long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); 524long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg);
516BIO * BIO_push(BIO *b,BIO *append); 525BIO * BIO_push(BIO *b,BIO *append);
517BIO * BIO_pop(BIO *b); 526BIO * BIO_pop(BIO *b);
518void BIO_free_all(BIO *a); 527void BIO_free_all(BIO *a);
519BIO * BIO_find_type(BIO *b,int bio_type); 528BIO * BIO_find_type(BIO *b,int bio_type);
529BIO * BIO_next(BIO *b);
520BIO * BIO_get_retry_BIO(BIO *bio, int *reason); 530BIO * BIO_get_retry_BIO(BIO *bio, int *reason);
521int BIO_get_retry_reason(BIO *bio); 531int BIO_get_retry_reason(BIO *bio);
522BIO * BIO_dup_chain(BIO *in); 532BIO * BIO_dup_chain(BIO *in);
@@ -545,6 +555,9 @@ BIO_METHOD *BIO_s_bio(void);
545BIO_METHOD *BIO_s_null(void); 555BIO_METHOD *BIO_s_null(void);
546BIO_METHOD *BIO_f_null(void); 556BIO_METHOD *BIO_f_null(void);
547BIO_METHOD *BIO_f_buffer(void); 557BIO_METHOD *BIO_f_buffer(void);
558#ifdef VMS
559BIO_METHOD *BIO_f_linebuffer(void);
560#endif
548BIO_METHOD *BIO_f_nbio_test(void); 561BIO_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);
553int BIO_fd_should_retry(int i); 566int BIO_fd_should_retry(int i);
554int BIO_fd_non_fatal_error(int error); 567int BIO_fd_non_fatal_error(int error);
555int BIO_dump(BIO *b,const char *bytes,int len); 568int BIO_dump(BIO *b,const char *bytes,int len);
569int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent);
556 570
557struct hostent *BIO_gethostbyname(const char *name); 571struct 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
593long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); 607long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);
594 608
595int BIO_printf(BIO *bio, ...); 609int BIO_printf(BIO *bio, const char *format, ...);
610int BIO_vprintf(BIO *bio, const char *format, va_list args);
611int BIO_snprintf(char *buf, size_t n, const char *format, ...);
612int 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