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.h133
1 files changed, 26 insertions, 107 deletions
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h
index cecb6a7207..2eb703830f 100644
--- a/src/lib/libcrypto/bio/bio.h
+++ b/src/lib/libcrypto/bio/bio.h
@@ -59,14 +59,13 @@
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
64#ifndef OPENSSL_NO_FP_API 62#ifndef OPENSSL_NO_FP_API
65# include <stdio.h> 63# include <stdio.h>
66#endif 64#endif
67#include <stdarg.h> 65#include <stdarg.h>
68 66
69#include <openssl/crypto.h> 67#include <openssl/crypto.h>
68#include <openssl/e_os2.h>
70 69
71#ifdef __cplusplus 70#ifdef __cplusplus
72extern "C" { 71extern "C" {
@@ -94,8 +93,6 @@ extern "C" {
94#define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ 93#define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */
95#define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ 94#define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */
96#define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ 95#define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */
97#define BIO_TYPE_DGRAM (21|0x0400|0x0100)
98#define BIO_TYPE_COMP (23|0x0200) /* filter */
99 96
100#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ 97#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */
101#define BIO_TYPE_FILTER 0x0200 98#define BIO_TYPE_FILTER 0x0200
@@ -127,38 +124,6 @@ extern "C" {
127 124
128#define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */ 125#define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */
129 126
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
162/* modifiers */ 127/* modifiers */
163#define BIO_FP_READ 0x02 128#define BIO_FP_READ 0x02
164#define BIO_FP_WRITE 0x04 129#define BIO_FP_WRITE 0x04
@@ -170,11 +135,6 @@ extern "C" {
170#define BIO_FLAGS_IO_SPECIAL 0x04 135#define BIO_FLAGS_IO_SPECIAL 0x04
171#define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) 136#define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
172#define BIO_FLAGS_SHOULD_RETRY 0x08 137#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
178 138
179/* Used in BIO_gethostbyname() */ 139/* Used in BIO_gethostbyname() */
180#define BIO_GHBN_CTRL_HITS 1 140#define BIO_GHBN_CTRL_HITS 1
@@ -197,32 +157,28 @@ extern "C" {
197 */ 157 */
198#define BIO_FLAGS_MEM_RDONLY 0x200 158#define BIO_FLAGS_MEM_RDONLY 0x200
199 159
200typedef struct bio_st BIO; 160#define BIO_set_flags(b,f) ((b)->flags|=(f))
201 161#define BIO_get_flags(b) ((b)->flags)
202void BIO_set_flags(BIO *b, int flags);
203int BIO_test_flags(const BIO *b, int flags);
204void BIO_clear_flags(BIO *b, int flags);
205
206#define BIO_get_flags(b) BIO_test_flags(b, ~(0x0))
207#define BIO_set_retry_special(b) \ 162#define BIO_set_retry_special(b) \
208 BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) 163 ((b)->flags|=(BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY))
209#define BIO_set_retry_read(b) \ 164#define BIO_set_retry_read(b) \
210 BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) 165 ((b)->flags|=(BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
211#define BIO_set_retry_write(b) \ 166#define BIO_set_retry_write(b) \
212 BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) 167 ((b)->flags|=(BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))
213 168
214/* These are normally used internally in BIOs */ 169/* These are normally used internally in BIOs */
170#define BIO_clear_flags(b,f) ((b)->flags&= ~(f))
215#define BIO_clear_retry_flags(b) \ 171#define BIO_clear_retry_flags(b) \
216 BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) 172 ((b)->flags&= ~(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
217#define BIO_get_retry_flags(b) \ 173#define BIO_get_retry_flags(b) \
218 BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) 174 ((b)->flags&(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
219 175
220/* These should be used by the application to tell why we should retry */ 176/* These should be used by the application to tell why we should retry */
221#define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) 177#define BIO_should_read(a) ((a)->flags & BIO_FLAGS_READ)
222#define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) 178#define BIO_should_write(a) ((a)->flags & BIO_FLAGS_WRITE)
223#define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) 179#define BIO_should_io_special(a) ((a)->flags & BIO_FLAGS_IO_SPECIAL)
224#define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) 180#define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS)
225#define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) 181#define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY)
226 182
227/* The next three are used in conjunction with the 183/* The next three are used in conjunction with the
228 * BIO_should_io_special() condition. After this returns true, 184 * BIO_should_io_special() condition. After this returns true,
@@ -251,14 +207,14 @@ void BIO_clear_flags(BIO *b, int flags);
251#define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) 207#define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN))
252#define BIO_cb_post(a) ((a)&BIO_CB_RETURN) 208#define BIO_cb_post(a) ((a)&BIO_CB_RETURN)
253 209
254long (*BIO_get_callback(const BIO *b)) (struct bio_st *,int,const char *,int, long,long); 210#define BIO_set_callback(b,cb) ((b)->callback=(cb))
255void BIO_set_callback(BIO *b, 211#define BIO_set_callback_arg(b,arg) ((b)->cb_arg=(char *)(arg))
256 long (*callback)(struct bio_st *,int,const char *,int, long,long)); 212#define BIO_get_callback_arg(b) ((b)->cb_arg)
257char *BIO_get_callback_arg(const BIO *b); 213#define BIO_get_callback(b) ((b)->callback)
258void BIO_set_callback_arg(BIO *b, char *arg); 214#define BIO_method_name(b) ((b)->method->name)
215#define BIO_method_type(b) ((b)->method->type)
259 216
260const char * BIO_method_name(const BIO *b); 217typedef struct bio_st BIO;
261int BIO_method_type(const BIO *b);
262 218
263typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); 219typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);
264 220
@@ -532,18 +488,6 @@ size_t BIO_ctrl_get_write_guarantee(BIO *b);
532size_t BIO_ctrl_get_read_request(BIO *b); 488size_t BIO_ctrl_get_read_request(BIO *b);
533int BIO_ctrl_reset_read_request(BIO *b); 489int BIO_ctrl_reset_read_request(BIO *b);
534 490
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
547/* These two aren't currently implemented */ 491/* These two aren't currently implemented */
548/* int BIO_get_ex_num(BIO *bio); */ 492/* int BIO_get_ex_num(BIO *bio); */
549/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ 493/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */
@@ -623,28 +567,15 @@ BIO_METHOD *BIO_f_buffer(void);
623BIO_METHOD *BIO_f_linebuffer(void); 567BIO_METHOD *BIO_f_linebuffer(void);
624#endif 568#endif
625BIO_METHOD *BIO_f_nbio_test(void); 569BIO_METHOD *BIO_f_nbio_test(void);
626#ifndef OPENSSL_NO_DGRAM
627BIO_METHOD *BIO_s_datagram(void);
628#endif
629
630/* BIO_METHOD *BIO_f_ber(void); */ 570/* BIO_METHOD *BIO_f_ber(void); */
631 571
632int BIO_sock_should_retry(int i); 572int BIO_sock_should_retry(int i);
633int BIO_sock_non_fatal_error(int error); 573int BIO_sock_non_fatal_error(int error);
634int BIO_dgram_non_fatal_error(int error);
635
636int BIO_fd_should_retry(int i); 574int BIO_fd_should_retry(int i);
637int BIO_fd_non_fatal_error(int error); 575int BIO_fd_non_fatal_error(int error);
638int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u),
639 void *u, const char *s, int len);
640int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
641 void *u, const char *s, int len, int indent);
642int BIO_dump(BIO *b,const char *bytes,int len); 576int BIO_dump(BIO *b,const char *bytes,int len);
643int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent); 577int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent);
644#ifndef OPENSSL_NO_FP_API 578
645int BIO_dump_fp(FILE *fp, const char *s, int len);
646int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);
647#endif
648struct hostent *BIO_gethostbyname(const char *name); 579struct hostent *BIO_gethostbyname(const char *name);
649/* We might want a thread-safe interface too: 580/* We might want a thread-safe interface too:
650 * struct hostent *BIO_gethostbyname_r(const char *name, 581 * struct hostent *BIO_gethostbyname_r(const char *name,
@@ -666,7 +597,6 @@ void BIO_sock_cleanup(void);
666int BIO_set_tcp_ndelay(int sock,int turn_on); 597int BIO_set_tcp_ndelay(int sock,int turn_on);
667 598
668BIO *BIO_new_socket(int sock, int close_flag); 599BIO *BIO_new_socket(int sock, int close_flag);
669BIO *BIO_new_dgram(int fd, int close_flag);
670BIO *BIO_new_fd(int fd, int close_flag); 600BIO *BIO_new_fd(int fd, int close_flag);
671BIO *BIO_new_connect(char *host_port); 601BIO *BIO_new_connect(char *host_port);
672BIO *BIO_new_accept(char *host_port); 602BIO *BIO_new_accept(char *host_port);
@@ -682,20 +612,10 @@ void BIO_copy_next_retry(BIO *b);
682 612
683/*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/ 613/*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/
684 614
685#ifdef __GNUC__ 615int BIO_printf(BIO *bio, const char *format, ...);
686# define __bio_h__attr__ __attribute__ 616int BIO_vprintf(BIO *bio, const char *format, va_list args);
687#else 617int BIO_snprintf(char *buf, size_t n, const char *format, ...);
688# define __bio_h__attr__(x) 618int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
689#endif
690int BIO_printf(BIO *bio, const char *format, ...)
691 __bio_h__attr__((__format__(__printf__,2,3)));
692int BIO_vprintf(BIO *bio, const char *format, va_list args)
693 __bio_h__attr__((__format__(__printf__,2,0)));
694int BIO_snprintf(char *buf, size_t n, const char *format, ...)
695 __bio_h__attr__((__format__(__printf__,3,4)));
696int 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__
699 619
700/* BEGIN ERROR CODES */ 620/* BEGIN ERROR CODES */
701/* The following lines are auto generated by the script mkerr.pl. Any changes 621/* The following lines are auto generated by the script mkerr.pl. Any changes
@@ -709,7 +629,6 @@ void ERR_load_BIO_strings(void);
709#define BIO_F_ACPT_STATE 100 629#define BIO_F_ACPT_STATE 100
710#define BIO_F_BIO_ACCEPT 101 630#define BIO_F_BIO_ACCEPT 101
711#define BIO_F_BIO_BER_GET_HEADER 102 631#define BIO_F_BIO_BER_GET_HEADER 102
712#define BIO_F_BIO_CALLBACK_CTRL 131
713#define BIO_F_BIO_CTRL 103 632#define BIO_F_BIO_CTRL 103
714#define BIO_F_BIO_GETHOSTBYNAME 120 633#define BIO_F_BIO_GETHOSTBYNAME 120
715#define BIO_F_BIO_GETS 104 634#define BIO_F_BIO_GETS 104