blob: 89ce4597fe5238925b24cf21853597fb286f9538 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* bio.h
2 *
3 * Copyright (C) 2006-2021 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_FLAGS_BASE64_NO_NL WOLFSSL_BIO_FLAG_BASE64_NO_NL
37#define BIO_FLAGS_READ WOLFSSL_BIO_FLAG_READ
38#define BIO_FLAGS_WRITE WOLFSSL_BIO_FLAG_WRITE
39#define BIO_FLAGS_IO_SPECIAL WOLFSSL_BIO_FLAG_IO_SPECIAL
40#define BIO_FLAGS_SHOULD_RETRY WOLFSSL_BIO_FLAG_RETRY
41
42#define BIO_new_fp wolfSSL_BIO_new_fp
43#if defined(OPENSSL_ALL) \
44 || defined(HAVE_STUNNEL) \
45 || defined(HAVE_LIGHTY) \
46 || defined(WOLFSSL_MYSQL_COMPATIBLE) \
47 || defined(WOLFSSL_HAPROXY) \
48 || defined(OPENSSL_EXTRA)
49#define BIO_new_file wolfSSL_BIO_new_file
50#endif
51#define BIO_new_fp wolfSSL_BIO_new_fp
52#define BIO_ctrl wolfSSL_BIO_ctrl
53#define BIO_ctrl_pending wolfSSL_BIO_ctrl_pending
54#define BIO_wpending wolfSSL_BIO_wpending
55#define BIO_get_mem_ptr wolfSSL_BIO_get_mem_ptr
56#define BIO_int_ctrl wolfSSL_BIO_int_ctrl
57#define BIO_reset wolfSSL_BIO_reset
58#define BIO_s_file wolfSSL_BIO_s_file
59#define BIO_s_bio wolfSSL_BIO_s_bio
60#define BIO_s_socket wolfSSL_BIO_s_socket
61#define BIO_set_fd wolfSSL_BIO_set_fd
62#define BIO_set_close wolfSSL_BIO_set_close
63#define BIO_ctrl_reset_read_request wolfSSL_BIO_ctrl_reset_read_request
64#define BIO_set_write_buf_size wolfSSL_BIO_set_write_buf_size
65#define BIO_make_bio_pair wolfSSL_BIO_make_bio_pair
66
67#define BIO_new_fd wolfSSL_BIO_new_fd
68#define BIO_set_fp wolfSSL_BIO_set_fp
69#define BIO_get_fp wolfSSL_BIO_get_fp
70#define BIO_seek wolfSSL_BIO_seek
71#define BIO_tell wolfSSL_BIO_tell
72#define BIO_write_filename wolfSSL_BIO_write_filename
73#define BIO_set_mem_eof_return wolfSSL_BIO_set_mem_eof_return
74
75#define BIO_find_type wolfSSL_BIO_find_type
76#define BIO_next wolfSSL_BIO_next
77#define BIO_gets wolfSSL_BIO_gets
78#define BIO_puts wolfSSL_BIO_puts
79
80#define BIO_should_retry wolfSSL_BIO_should_retry
81
82#define BIO_TYPE_FILE WOLFSSL_BIO_FILE
83#define BIO_TYPE_BIO WOLFSSL_BIO_BIO
84#define BIO_TYPE_MEM WOLFSSL_BIO_MEMORY
85#define BIO_TYPE_BASE64 WOLFSSL_BIO_BASE64
86
87#define BIO_vprintf wolfSSL_BIO_vprintf
88#define BIO_printf wolfSSL_BIO_printf
89#define BIO_dump wolfSSL_BIO_dump
90
91/* BIO info callback */
92#define BIO_CB_FREE WOLFSSL_BIO_CB_FREE
93#define BIO_CB_READ WOLFSSL_BIO_CB_READ
94#define BIO_CB_WRITE WOLFSSL_BIO_CB_WRITE
95#define BIO_CB_PUTS WOLFSSL_BIO_CB_PUTS
96#define BIO_CB_GETS WOLFSSL_BIO_CB_GETS
97#define BIO_CB_CTRL WOLFSSL_BIO_CB_CTRL
98#define BIO_CB_RETURN WOLFSSL_BIO_CB_RETURN
99
100#define BIO_set_callback wolfSSL_BIO_set_callback
101#define BIO_get_callback wolfSSL_BIO_get_callback
102#define BIO_set_callback_arg wolfSSL_BIO_set_callback_arg
103#define BIO_get_callback_arg wolfSSL_BIO_get_callback_arg
104
105/* BIO for 1.1.0 or later */
106#define BIO_set_init wolfSSL_BIO_set_init
107#define BIO_get_data wolfSSL_BIO_get_data
108#define BIO_set_data wolfSSL_BIO_set_data
109#define BIO_get_shutdown wolfSSL_BIO_get_shutdown
110#define BIO_set_shutdown wolfSSL_BIO_set_shutdown
111
112#define BIO_clear_flags wolfSSL_BIO_clear_flags
113#define BIO_set_ex_data wolfSSL_BIO_set_ex_data
114#define BIO_get_ex_data wolfSSL_BIO_get_ex_data
115
116/* helper to set specific retry/read flags */
117#define BIO_set_retry_read(bio)\
118 wolfSSL_BIO_set_flags((bio), WOLFSSL_BIO_FLAG_RETRY | WOLFSSL_BIO_FLAG_READ)
119#define BIO_set_retry_write(bio)\
120 wolfSSL_BIO_set_flags((bio), WOLFSSL_BIO_FLAG_RETRY | WOLFSSL_BIO_FLAG_WRITE)
121
122#define BIO_clear_retry_flags wolfSSL_BIO_clear_retry_flags
123
124#define BIO_meth_new wolfSSL_BIO_meth_new
125#define BIO_meth_set_write wolfSSL_BIO_meth_set_write
126#define BIO_meth_free wolfSSL_BIO_meth_free
127#define BIO_meth_set_write wolfSSL_BIO_meth_set_write
128#define BIO_meth_set_read wolfSSL_BIO_meth_set_read
129#define BIO_meth_set_puts wolfSSL_BIO_meth_set_puts
130#define BIO_meth_set_gets wolfSSL_BIO_meth_set_gets
131#define BIO_meth_set_ctrl wolfSSL_BIO_meth_set_ctrl
132#define BIO_meth_set_create wolfSSL_BIO_meth_set_create
133#define BIO_meth_set_destroy wolfSSL_BIO_meth_set_destroy
134
135#define BIO_snprintf XSNPRINTF
136
137/* BIO CTRL */
138#define BIO_CTRL_RESET 1
139#define BIO_CTRL_EOF 2
140#define BIO_CTRL_INFO 3
141#define BIO_CTRL_PUSH 6
142#define BIO_CTRL_POP 7
143#define BIO_CTRL_GET_CLOSE 8
144#define BIO_CTRL_SET_CLOSE 9
145#define BIO_CTRL_PENDING 10
146#define BIO_CTRL_FLUSH 11
147#define BIO_CTRL_DUP 12
148#define BIO_CTRL_WPENDING 13
149
150#define BIO_C_SET_FILE_PTR 106
151#define BIO_C_GET_FILE_PTR 107
152#define BIO_C_SET_FILENAME 108
153#define BIO_C_SET_BUF_MEM 114
154#define BIO_C_GET_BUF_MEM_PTR 115
155#define BIO_C_FILE_SEEK 128
156#define BIO_C_SET_BUF_MEM_EOF_RETURN 130
157#define BIO_C_SET_WRITE_BUF_SIZE 136
158#define BIO_C_MAKE_BIO_PAIR 138
159
160#define BIO_CTRL_DGRAM_QUERY_MTU 40
161
162#define BIO_FP_TEXT 0x00
163#define BIO_NOCLOSE 0x00
164#define BIO_CLOSE 0x01
165
166#define BIO_FP_WRITE 0x04
167
168
169#ifdef __cplusplus
170 } /* extern "C" */
171#endif
172
173
174#endif /* WOLFSSL_BIO_H_ */
175