Skip to main content

variant_ssl_sys/handwritten/
bio.rs

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