diff options
Diffstat (limited to 'src/lib/libcrypto/bio/bio.h')
-rw-r--r-- | src/lib/libcrypto/bio/bio.h | 133 |
1 files changed, 107 insertions, 26 deletions
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index 2eb703830f..cecb6a7207 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
@@ -59,13 +59,14 @@ | |||
59 | #ifndef HEADER_BIO_H | 59 | #ifndef HEADER_BIO_H |
60 | #define HEADER_BIO_H | 60 | #define HEADER_BIO_H |
61 | 61 | ||
62 | #include <openssl/e_os2.h> | ||
63 | |||
62 | #ifndef OPENSSL_NO_FP_API | 64 | #ifndef OPENSSL_NO_FP_API |
63 | # include <stdio.h> | 65 | # include <stdio.h> |
64 | #endif | 66 | #endif |
65 | #include <stdarg.h> | 67 | #include <stdarg.h> |
66 | 68 | ||
67 | #include <openssl/crypto.h> | 69 | #include <openssl/crypto.h> |
68 | #include <openssl/e_os2.h> | ||
69 | 70 | ||
70 | #ifdef __cplusplus | 71 | #ifdef __cplusplus |
71 | extern "C" { | 72 | extern "C" { |
@@ -93,6 +94,8 @@ extern "C" { | |||
93 | #define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ | 94 | #define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ |
94 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ | 95 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ |
95 | #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ | 96 | #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ |
97 | #define BIO_TYPE_DGRAM (21|0x0400|0x0100) | ||
98 | #define BIO_TYPE_COMP (23|0x0200) /* filter */ | ||
96 | 99 | ||
97 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ | 100 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ |
98 | #define BIO_TYPE_FILTER 0x0200 | 101 | #define BIO_TYPE_FILTER 0x0200 |
@@ -124,6 +127,38 @@ extern "C" { | |||
124 | 127 | ||
125 | #define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */ | 128 | #define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */ |
126 | 129 | ||
130 | /* dgram BIO stuff */ | ||
131 | #define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */ | ||
132 | #define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally | ||
133 | * connected socket to be | ||
134 | * passed in */ | ||
135 | #define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */ | ||
136 | #define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */ | ||
137 | #define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */ | ||
138 | #define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */ | ||
139 | |||
140 | #define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ | ||
141 | #define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */ | ||
142 | |||
143 | /* #ifdef IP_MTU_DISCOVER */ | ||
144 | #define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ | ||
145 | /* #endif */ | ||
146 | |||
147 | #define BIO_CTRL_DGRAM_QUERY_MTU 40 /* as kernel for current MTU */ | ||
148 | #define BIO_CTRL_DGRAM_GET_MTU 41 /* get cached value for MTU */ | ||
149 | #define BIO_CTRL_DGRAM_SET_MTU 42 /* set cached value for | ||
150 | * MTU. want to use this | ||
151 | * if asking the kernel | ||
152 | * fails */ | ||
153 | |||
154 | #define BIO_CTRL_DGRAM_MTU_EXCEEDED 43 /* check whether the MTU | ||
155 | * was exceed in the | ||
156 | * previous write | ||
157 | * operation */ | ||
158 | |||
159 | #define BIO_CTRL_DGRAM_SET_PEER 44 /* Destination for the data */ | ||
160 | |||
161 | |||
127 | /* modifiers */ | 162 | /* modifiers */ |
128 | #define BIO_FP_READ 0x02 | 163 | #define BIO_FP_READ 0x02 |
129 | #define BIO_FP_WRITE 0x04 | 164 | #define BIO_FP_WRITE 0x04 |
@@ -135,6 +170,11 @@ extern "C" { | |||
135 | #define BIO_FLAGS_IO_SPECIAL 0x04 | 170 | #define BIO_FLAGS_IO_SPECIAL 0x04 |
136 | #define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) | 171 | #define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) |
137 | #define BIO_FLAGS_SHOULD_RETRY 0x08 | 172 | #define BIO_FLAGS_SHOULD_RETRY 0x08 |
173 | #ifndef BIO_FLAGS_UPLINK | ||
174 | /* "UPLINK" flag denotes file descriptors provided by application. | ||
175 | It defaults to 0, as most platforms don't require UPLINK interface. */ | ||
176 | #define BIO_FLAGS_UPLINK 0 | ||
177 | #endif | ||
138 | 178 | ||
139 | /* Used in BIO_gethostbyname() */ | 179 | /* Used in BIO_gethostbyname() */ |
140 | #define BIO_GHBN_CTRL_HITS 1 | 180 | #define BIO_GHBN_CTRL_HITS 1 |
@@ -157,28 +197,32 @@ extern "C" { | |||
157 | */ | 197 | */ |
158 | #define BIO_FLAGS_MEM_RDONLY 0x200 | 198 | #define BIO_FLAGS_MEM_RDONLY 0x200 |
159 | 199 | ||
160 | #define BIO_set_flags(b,f) ((b)->flags|=(f)) | 200 | typedef struct bio_st BIO; |
161 | #define BIO_get_flags(b) ((b)->flags) | 201 | |
202 | void BIO_set_flags(BIO *b, int flags); | ||
203 | int BIO_test_flags(const BIO *b, int flags); | ||
204 | void BIO_clear_flags(BIO *b, int flags); | ||
205 | |||
206 | #define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) | ||
162 | #define BIO_set_retry_special(b) \ | 207 | #define BIO_set_retry_special(b) \ |
163 | ((b)->flags|=(BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) | 208 | BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) |
164 | #define BIO_set_retry_read(b) \ | 209 | #define BIO_set_retry_read(b) \ |
165 | ((b)->flags|=(BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) | 210 | BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) |
166 | #define BIO_set_retry_write(b) \ | 211 | #define BIO_set_retry_write(b) \ |
167 | ((b)->flags|=(BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) | 212 | BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) |
168 | 213 | ||
169 | /* These are normally used internally in BIOs */ | 214 | /* These are normally used internally in BIOs */ |
170 | #define BIO_clear_flags(b,f) ((b)->flags&= ~(f)) | ||
171 | #define BIO_clear_retry_flags(b) \ | 215 | #define BIO_clear_retry_flags(b) \ |
172 | ((b)->flags&= ~(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) | 216 | BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) |
173 | #define BIO_get_retry_flags(b) \ | 217 | #define BIO_get_retry_flags(b) \ |
174 | ((b)->flags&(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) | 218 | BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) |
175 | 219 | ||
176 | /* These should be used by the application to tell why we should retry */ | 220 | /* These should be used by the application to tell why we should retry */ |
177 | #define BIO_should_read(a) ((a)->flags & BIO_FLAGS_READ) | 221 | #define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) |
178 | #define BIO_should_write(a) ((a)->flags & BIO_FLAGS_WRITE) | 222 | #define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) |
179 | #define BIO_should_io_special(a) ((a)->flags & BIO_FLAGS_IO_SPECIAL) | 223 | #define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) |
180 | #define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS) | 224 | #define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) |
181 | #define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY) | 225 | #define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) |
182 | 226 | ||
183 | /* The next three are used in conjunction with the | 227 | /* The next three are used in conjunction with the |
184 | * BIO_should_io_special() condition. After this returns true, | 228 | * BIO_should_io_special() condition. After this returns true, |
@@ -207,14 +251,14 @@ extern "C" { | |||
207 | #define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) | 251 | #define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) |
208 | #define BIO_cb_post(a) ((a)&BIO_CB_RETURN) | 252 | #define BIO_cb_post(a) ((a)&BIO_CB_RETURN) |
209 | 253 | ||
210 | #define BIO_set_callback(b,cb) ((b)->callback=(cb)) | 254 | long (*BIO_get_callback(const BIO *b)) (struct bio_st *,int,const char *,int, long,long); |
211 | #define BIO_set_callback_arg(b,arg) ((b)->cb_arg=(char *)(arg)) | 255 | void BIO_set_callback(BIO *b, |
212 | #define BIO_get_callback_arg(b) ((b)->cb_arg) | 256 | long (*callback)(struct bio_st *,int,const char *,int, long,long)); |
213 | #define BIO_get_callback(b) ((b)->callback) | 257 | char *BIO_get_callback_arg(const BIO *b); |
214 | #define BIO_method_name(b) ((b)->method->name) | 258 | void BIO_set_callback_arg(BIO *b, char *arg); |
215 | #define BIO_method_type(b) ((b)->method->type) | ||
216 | 259 | ||
217 | typedef struct bio_st BIO; | 260 | const char * BIO_method_name(const BIO *b); |
261 | int BIO_method_type(const BIO *b); | ||
218 | 262 | ||
219 | typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); | 263 | typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); |
220 | 264 | ||
@@ -488,6 +532,18 @@ size_t BIO_ctrl_get_write_guarantee(BIO *b); | |||
488 | size_t BIO_ctrl_get_read_request(BIO *b); | 532 | size_t BIO_ctrl_get_read_request(BIO *b); |
489 | int BIO_ctrl_reset_read_request(BIO *b); | 533 | int BIO_ctrl_reset_read_request(BIO *b); |
490 | 534 | ||
535 | /* ctrl macros for dgram */ | ||
536 | #define BIO_ctrl_dgram_connect(b,peer) \ | ||
537 | (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer) | ||
538 | #define BIO_ctrl_set_connected(b, state, peer) \ | ||
539 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer) | ||
540 | #define BIO_dgram_recv_timedout(b) \ | ||
541 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) | ||
542 | #define BIO_dgram_send_timedout(b) \ | ||
543 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) | ||
544 | #define BIO_dgram_set_peer(b,peer) \ | ||
545 | (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer) | ||
546 | |||
491 | /* These two aren't currently implemented */ | 547 | /* These two aren't currently implemented */ |
492 | /* int BIO_get_ex_num(BIO *bio); */ | 548 | /* int BIO_get_ex_num(BIO *bio); */ |
493 | /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ | 549 | /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ |
@@ -567,15 +623,28 @@ BIO_METHOD *BIO_f_buffer(void); | |||
567 | BIO_METHOD *BIO_f_linebuffer(void); | 623 | BIO_METHOD *BIO_f_linebuffer(void); |
568 | #endif | 624 | #endif |
569 | BIO_METHOD *BIO_f_nbio_test(void); | 625 | BIO_METHOD *BIO_f_nbio_test(void); |
626 | #ifndef OPENSSL_NO_DGRAM | ||
627 | BIO_METHOD *BIO_s_datagram(void); | ||
628 | #endif | ||
629 | |||
570 | /* BIO_METHOD *BIO_f_ber(void); */ | 630 | /* BIO_METHOD *BIO_f_ber(void); */ |
571 | 631 | ||
572 | int BIO_sock_should_retry(int i); | 632 | int BIO_sock_should_retry(int i); |
573 | int BIO_sock_non_fatal_error(int error); | 633 | int BIO_sock_non_fatal_error(int error); |
634 | int BIO_dgram_non_fatal_error(int error); | ||
635 | |||
574 | int BIO_fd_should_retry(int i); | 636 | int BIO_fd_should_retry(int i); |
575 | int BIO_fd_non_fatal_error(int error); | 637 | int BIO_fd_non_fatal_error(int error); |
638 | int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u), | ||
639 | void *u, const char *s, int len); | ||
640 | int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), | ||
641 | void *u, const char *s, int len, int indent); | ||
576 | int BIO_dump(BIO *b,const char *bytes,int len); | 642 | int BIO_dump(BIO *b,const char *bytes,int len); |
577 | int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent); | 643 | int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent); |
578 | 644 | #ifndef OPENSSL_NO_FP_API | |
645 | int BIO_dump_fp(FILE *fp, const char *s, int len); | ||
646 | int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); | ||
647 | #endif | ||
579 | struct hostent *BIO_gethostbyname(const char *name); | 648 | struct hostent *BIO_gethostbyname(const char *name); |
580 | /* We might want a thread-safe interface too: | 649 | /* We might want a thread-safe interface too: |
581 | * struct hostent *BIO_gethostbyname_r(const char *name, | 650 | * struct hostent *BIO_gethostbyname_r(const char *name, |
@@ -597,6 +666,7 @@ void BIO_sock_cleanup(void); | |||
597 | int BIO_set_tcp_ndelay(int sock,int turn_on); | 666 | int BIO_set_tcp_ndelay(int sock,int turn_on); |
598 | 667 | ||
599 | BIO *BIO_new_socket(int sock, int close_flag); | 668 | BIO *BIO_new_socket(int sock, int close_flag); |
669 | BIO *BIO_new_dgram(int fd, int close_flag); | ||
600 | BIO *BIO_new_fd(int fd, int close_flag); | 670 | BIO *BIO_new_fd(int fd, int close_flag); |
601 | BIO *BIO_new_connect(char *host_port); | 671 | BIO *BIO_new_connect(char *host_port); |
602 | BIO *BIO_new_accept(char *host_port); | 672 | BIO *BIO_new_accept(char *host_port); |
@@ -612,10 +682,20 @@ void BIO_copy_next_retry(BIO *b); | |||
612 | 682 | ||
613 | /*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/ | 683 | /*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/ |
614 | 684 | ||
615 | int BIO_printf(BIO *bio, const char *format, ...); | 685 | #ifdef __GNUC__ |
616 | int BIO_vprintf(BIO *bio, const char *format, va_list args); | 686 | # define __bio_h__attr__ __attribute__ |
617 | int BIO_snprintf(char *buf, size_t n, const char *format, ...); | 687 | #else |
618 | int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args); | 688 | # define __bio_h__attr__(x) |
689 | #endif | ||
690 | int BIO_printf(BIO *bio, const char *format, ...) | ||
691 | __bio_h__attr__((__format__(__printf__,2,3))); | ||
692 | int BIO_vprintf(BIO *bio, const char *format, va_list args) | ||
693 | __bio_h__attr__((__format__(__printf__,2,0))); | ||
694 | int BIO_snprintf(char *buf, size_t n, const char *format, ...) | ||
695 | __bio_h__attr__((__format__(__printf__,3,4))); | ||
696 | int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) | ||
697 | __bio_h__attr__((__format__(__printf__,3,0))); | ||
698 | #undef __bio_h__attr__ | ||
619 | 699 | ||
620 | /* BEGIN ERROR CODES */ | 700 | /* BEGIN ERROR CODES */ |
621 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 701 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
@@ -629,6 +709,7 @@ void ERR_load_BIO_strings(void); | |||
629 | #define BIO_F_ACPT_STATE 100 | 709 | #define BIO_F_ACPT_STATE 100 |
630 | #define BIO_F_BIO_ACCEPT 101 | 710 | #define BIO_F_BIO_ACCEPT 101 |
631 | #define BIO_F_BIO_BER_GET_HEADER 102 | 711 | #define BIO_F_BIO_BER_GET_HEADER 102 |
712 | #define BIO_F_BIO_CALLBACK_CTRL 131 | ||
632 | #define BIO_F_BIO_CTRL 103 | 713 | #define BIO_F_BIO_CTRL 103 |
633 | #define BIO_F_BIO_GETHOSTBYNAME 120 | 714 | #define BIO_F_BIO_GETHOSTBYNAME 120 |
634 | #define BIO_F_BIO_GETS 104 | 715 | #define BIO_F_BIO_GETS 104 |