bio.h
1 /* bio.h
2  *
3  * Copyright (C) 2006-2020 wolfSSL Inc.
4  *
5  * This file is part of wolfSSL.
6  *
7  * wolfSSL is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * wolfSSL is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20  */
21 
22 /* bio.h for openssl */
23 
24 
25 #ifndef WOLFSSL_BIO_H_
26 #define WOLFSSL_BIO_H_
27 
28 #include <wolfssl/openssl/ssl.h>
29 
30 
31 #ifdef __cplusplus
32  extern "C" {
33 #endif
34 
35 
36 #define BIO_FLAG_BASE64_NO_NL WOLFSSL_BIO_FLAG_BASE64_NO_NL
37 #define BIO_FLAG_READ WOLFSSL_BIO_FLAG_READ
38 #define BIO_FLAG_WRITE WOLFSSL_BIO_FLAG_WRITE
39 #define BIO_FLAG_IO_SPECIAL WOLFSSL_BIO_FLAG_IO_SPECIAL
40 #define BIO_FLAG_RETRY WOLFSSL_BIO_FLAG_RETRY
41 
42 #define BIO_new_fp wolfSSL_BIO_new_fp
43 #define BIO_new_file wolfSSL_BIO_new_file
44 #define BIO_new_fp wolfSSL_BIO_new_fp
45 #define BIO_ctrl wolfSSL_BIO_ctrl
46 #define BIO_ctrl_pending wolfSSL_BIO_ctrl_pending
47 #define BIO_wpending wolfSSL_BIO_wpending
48 #define BIO_get_mem_ptr wolfSSL_BIO_get_mem_ptr
49 #define BIO_int_ctrl wolfSSL_BIO_int_ctrl
50 #define BIO_reset wolfSSL_BIO_reset
51 #define BIO_s_file wolfSSL_BIO_s_file
52 #define BIO_s_bio wolfSSL_BIO_s_bio
53 #define BIO_s_socket wolfSSL_BIO_s_socket
54 #define BIO_set_fd wolfSSL_BIO_set_fd
55 #define BIO_set_close wolfSSL_BIO_set_close
56 #define BIO_ctrl_reset_read_request wolfSSL_BIO_ctrl_reset_read_request
57 #define BIO_set_write_buf_size wolfSSL_BIO_set_write_buf_size
58 #define BIO_make_bio_pair wolfSSL_BIO_make_bio_pair
59 
60 #define BIO_set_fp wolfSSL_BIO_set_fp
61 #define BIO_get_fp wolfSSL_BIO_get_fp
62 #define BIO_seek wolfSSL_BIO_seek
63 #define BIO_write_filename wolfSSL_BIO_write_filename
64 #define BIO_set_mem_eof_return wolfSSL_BIO_set_mem_eof_return
65 
66 #define BIO_find_type wolfSSL_BIO_find_type
67 #define BIO_next wolfSSL_BIO_next
68 #define BIO_gets wolfSSL_BIO_gets
69 #define BIO_puts wolfSSL_BIO_puts
70 
71 #define BIO_should_retry wolfSSL_BIO_should_retry
72 
73 #define BIO_TYPE_FILE WOLFSSL_BIO_FILE
74 #define BIO_TYPE_BIO WOLFSSL_BIO_BIO
75 #define BIO_TYPE_MEM WOLFSSL_BIO_MEMORY
76 #define BIO_TYPE_BASE64 WOLFSSL_BIO_BASE64
77 
78 #define BIO_vprintf wolfSSL_BIO_vprintf
79 #define BIO_printf wolfSSL_BIO_printf
80 #define BIO_dump wolfSSL_BIO_dump
81 
82 /* BIO info callback */
83 #define BIO_CB_FREE WOLFSSL_BIO_CB_FREE
84 #define BIO_CB_READ WOLFSSL_BIO_CB_READ
85 #define BIO_CB_WRITE WOLFSSL_BIO_CB_WRITE
86 #define BIO_CB_PUTS WOLFSSL_BIO_CB_PUTS
87 #define BIO_CB_GETS WOLFSSL_BIO_CB_GETS
88 #define BIO_CB_CTRL WOLFSSL_BIO_CB_CTRL
89 #define BIO_CB_RETURN WOLFSSL_BIO_CB_RETURN
90 
91 #define BIO_set_callback wolfSSL_BIO_set_callback
92 #define BIO_get_callback wolfSSL_BIO_get_callback
93 #define BIO_set_callback_arg wolfSSL_BIO_set_callback_arg
94 #define BIO_get_callback_arg wolfSSL_BIO_get_callback_arg
95 
96 /* BIO for 1.1.0 or later */
97 #define BIO_set_init wolfSSL_BIO_set_init
98 #define BIO_get_data wolfSSL_BIO_get_data
99 #define BIO_set_data wolfSSL_BIO_set_data
100 #define BIO_get_shutdown wolfSSL_BIO_get_shutdown
101 #define BIO_set_shutdown wolfSSL_BIO_set_shutdown
102 
103 #define BIO_clear_flags wolfSSL_BIO_clear_flags
104 #define BIO_set_ex_data wolfSSL_BIO_set_ex_data
105 #define BIO_get_ex_data wolfSSL_BIO_get_ex_data
106 
107 /* helper to set specific retry/read flags */
108 #define BIO_set_retry_read(bio)\
109  wolfSSL_BIO_set_flags((bio), WOLFSSL_BIO_FLAG_RETRY | WOLFSSL_BIO_FLAG_READ)
110 #define BIO_set_retry_write(bio)\
111  wolfSSL_BIO_set_flags((bio), WOLFSSL_BIO_FLAG_RETRY | WOLFSSL_BIO_FLAG_WRITE)
112 
113 #define BIO_clear_retry_flags wolfSSL_BIO_clear_retry_flags
114 
115 #define BIO_meth_new wolfSSL_BIO_meth_new
116 #define BIO_meth_set_write wolfSSL_BIO_meth_set_write
117 #define BIO_meth_free wolfSSL_BIO_meth_free
118 #define BIO_meth_set_write wolfSSL_BIO_meth_set_write
119 #define BIO_meth_set_read wolfSSL_BIO_meth_set_read
120 #define BIO_meth_set_puts wolfSSL_BIO_meth_set_puts
121 #define BIO_meth_set_gets wolfSSL_BIO_meth_set_gets
122 #define BIO_meth_set_ctrl wolfSSL_BIO_meth_set_ctrl
123 #define BIO_meth_set_create wolfSSL_BIO_meth_set_create
124 #define BIO_meth_set_destroy wolfSSL_BIO_meth_set_destroy
125 
126 
127 /* BIO CTRL */
128 #define BIO_CTRL_RESET 1
129 #define BIO_CTRL_EOF 2
130 #define BIO_CTRL_INFO 3
131 #define BIO_CTRL_PUSH 6
132 #define BIO_CTRL_POP 7
133 #define BIO_CTRL_GET_CLOSE 8
134 #define BIO_CTRL_SET_CLOSE 9
135 #define BIO_CTRL_PENDING 10
136 #define BIO_CTRL_FLUSH 11
137 #define BIO_CTRL_DUP 12
138 #define BIO_CTRL_WPENDING 13
139 
140 #define BIO_C_SET_FILE_PTR 106
141 #define BIO_C_GET_FILE_PTR 107
142 #define BIO_C_SET_FILENAME 108
143 #define BIO_C_SET_BUF_MEM 114
144 #define BIO_C_GET_BUF_MEM_PTR 115
145 #define BIO_C_FILE_SEEK 128
146 #define BIO_C_SET_BUF_MEM_EOF_RETURN 130
147 #define BIO_C_SET_WRITE_BUF_SIZE 136
148 #define BIO_C_MAKE_BIO_PAIR 138
149 
150 #define BIO_CTRL_DGRAM_QUERY_MTU 40
151 
152 #define BIO_NOCLOSE 0x00
153 #define BIO_CLOSE 0x01
154 
155 #define BIO_FP_WRITE 0x04
156 
157 
158 #ifdef __cplusplus
159  } /* extern "C" */
160 #endif
161 
162 
163 #endif /* WOLFSSL_BIO_H_ */
164