variant_ssl_sys/handwritten/
bio.rs1use super::super::*;
2use libc::*;
3
4extern "C" {
5 pub fn BIO_set_flags(b: *mut BIO, flags: c_int);
6 pub fn BIO_clear_flags(b: *mut BIO, flags: c_int);
7}
8
9pub type bio_info_cb =
10 Option<unsafe extern "C" fn(*mut BIO, c_int, *const c_char, c_int, c_long, c_long)>;
11
12cfg_if! {
13 if #[cfg(any(ossl110, libressl))] {
14 pub enum BIO_METHOD {}
15 } else {
16 #[repr(C)]
17 pub struct BIO_METHOD {
18 pub type_: c_int,
19 pub name: *const c_char,
20 pub bwrite: Option<unsafe extern "C" fn(*mut BIO, *const c_char, c_int) -> c_int>,
21 pub bread: Option<unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int>,
22 pub bputs: Option<unsafe extern "C" fn(*mut BIO, *const c_char) -> c_int>,
23 pub bgets: Option<unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int>,
24 pub ctrl: Option<unsafe extern "C" fn(*mut BIO, c_int, c_long, *mut c_void) -> c_long>,
25 pub create: Option<unsafe extern "C" fn(*mut BIO) -> c_int>,
26 pub destroy: Option<unsafe extern "C" fn(*mut BIO) -> c_int>,
27 pub callback_ctrl: Option<unsafe extern "C" fn(*mut BIO, c_int, bio_info_cb) -> c_long>,
28 }
29 }
30}
31
32const_ptr_api! {
33 extern "C" {
34 pub fn BIO_s_file() -> #[const_ptr_if(any(ossl110, libressl))] BIO_METHOD;
35 pub fn BIO_new(type_: #[const_ptr_if(any(ossl110, libressl))] BIO_METHOD) -> *mut BIO;
36 }
37}
38extern "C" {
39 #[cfg(not(osslconf = "OPENSSL_NO_STDIO"))]
40 pub fn BIO_new_fp(stream: *mut FILE, close_flag: c_int) -> *mut BIO;
41 #[cfg(any(ossl110, libressl))]
42 pub fn BIO_set_data(a: *mut BIO, data: *mut c_void);
43 #[cfg(any(ossl110, libressl))]
44 pub fn BIO_get_data(a: *mut BIO) -> *mut c_void;
45 #[cfg(any(ossl110, libressl))]
46 pub fn BIO_set_init(a: *mut BIO, init: c_int);
47 pub fn BIO_write(b: *mut BIO, buf: *const c_void, len: c_int) -> c_int;
48 pub fn BIO_read(b: *mut BIO, buf: *mut c_void, len: c_int) -> c_int;
49 pub fn BIO_ctrl(b: *mut BIO, cmd: c_int, larg: c_long, parg: *mut c_void) -> c_long;
50 pub fn BIO_free_all(b: *mut BIO);
51 pub fn BIO_new_mem_buf(buf: *const c_void, len: c_int) -> *mut BIO;
52}
53
54extern "C" {
55 pub fn BIO_method_name(b: *const BIO) -> *const c_char;
56 pub fn BIO_method_type(b: *const BIO) -> c_int;
57 pub fn BIO_find_type(b: *mut BIO, bio_type: c_int) -> *mut BIO;
58 pub fn BIO_next(b: *mut BIO) -> *mut BIO;
59}
60
61const_ptr_api! {
62 extern "C" {
63 pub fn BIO_s_mem() -> #[const_ptr_if(any(ossl110, libressl))] BIO_METHOD;
64 }
65}
66
67extern "C" {
68 #[cfg(not(osslconf = "OPENSSL_NO_SOCK"))]
69 pub fn BIO_new_socket(sock: c_int, close_flag: c_int) -> *mut BIO;
70
71 #[cfg(any(ossl110, libressl))]
72 pub fn BIO_meth_new(type_: c_int, name: *const c_char) -> *mut BIO_METHOD;
73 #[cfg(any(ossl110, libressl))]
74 pub fn BIO_meth_free(biom: *mut BIO_METHOD);
75}
76
77#[allow(clashing_extern_declarations)]
78extern "C" {
79 #[cfg(any(ossl110, libressl))]
80 pub fn BIO_meth_set_write(
81 biom: *mut BIO_METHOD,
82 write: Option<unsafe extern "C" fn(*mut BIO, *const c_char, c_int) -> c_int>,
83 ) -> c_int;
84 #[cfg(any(ossl110, libressl))]
85 pub fn BIO_meth_set_read(
86 biom: *mut BIO_METHOD,
87 read: Option<unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int>,
88 ) -> c_int;
89 #[cfg(any(ossl110, libressl))]
90 pub fn BIO_meth_set_puts(
91 biom: *mut BIO_METHOD,
92 read: Option<unsafe extern "C" fn(*mut BIO, *const c_char) -> c_int>,
93 ) -> c_int;
94 #[cfg(any(ossl110, libressl))]
95 pub fn BIO_meth_set_ctrl(
96 biom: *mut BIO_METHOD,
97 read: Option<unsafe extern "C" fn(*mut BIO, c_int, c_long, *mut c_void) -> c_long>,
98 ) -> c_int;
99 #[cfg(any(ossl110, libressl))]
100 pub fn BIO_meth_set_create(
101 biom: *mut BIO_METHOD,
102 create: Option<unsafe extern "C" fn(*mut BIO) -> c_int>,
103 ) -> c_int;
104 #[cfg(any(ossl110, libressl))]
105 pub fn BIO_meth_set_destroy(
106 biom: *mut BIO_METHOD,
107 destroy: Option<unsafe extern "C" fn(*mut BIO) -> c_int>,
108 ) -> c_int;
109}
110
111#[cfg(ossl320)]
112extern "C" {
113 pub fn BIO_meth_set_sendmmsg(
114 biom: *mut BIO_METHOD,
115 f: Option<
116 unsafe extern "C" fn(
117 arg1: *mut BIO,
118 arg2: *mut BIO_MSG,
119 arg3: usize,
120 arg4: usize,
121 arg5: u64,
122 arg6: *mut usize,
123 ) -> c_int,
124 >,
125 ) -> c_int;
126 pub fn BIO_meth_set_recvmmsg(
127 biom: *mut BIO_METHOD,
128 f: Option<
129 unsafe extern "C" fn(
130 arg1: *mut BIO,
131 arg2: *mut BIO_MSG,
132 arg3: usize,
133 arg4: usize,
134 arg5: u64,
135 arg6: *mut usize,
136 ) -> c_int,
137 >,
138 ) -> c_int;
139 pub fn BIO_new_bio_dgram_pair(
140 bio1: *mut *mut BIO,
141 writebuf1: usize,
142 bio2: *mut *mut BIO,
143 writebuf2: usize,
144 ) -> c_int;
145 pub fn BIO_s_dgram_pair() -> *const BIO_METHOD;
146 pub fn BIO_s_datagram() -> *const BIO_METHOD;
147 pub fn BIO_get_rpoll_descriptor(b: *mut BIO, desc: *mut BIO_POLL_DESCRIPTOR) -> c_int;
148 pub fn BIO_get_wpoll_descriptor(b: *mut BIO, desc: *mut BIO_POLL_DESCRIPTOR) -> c_int;
149 pub fn BIO_sendmmsg(
150 b: *mut BIO,
151 msg: *mut BIO_MSG,
152 stride: usize,
153 num_msg: usize,
154 flags: u64,
155 msgs_processed: *mut usize,
156 ) -> c_int;
157 pub fn BIO_recvmmsg(
158 b: *mut BIO,
159 msg: *mut BIO_MSG,
160 stride: usize,
161 num_msg: usize,
162 flags: u64,
163 msgs_processed: *mut usize,
164 ) -> c_int;
165 pub fn BIO_err_is_non_fatal(errcode: c_uint) -> c_int;
166}