1 use super::super::*; 2 use libc::*; 3 4 extern "C" { BIO_set_flags(b: *mut BIO, flags: c_int)5 pub fn BIO_set_flags(b: *mut BIO, flags: c_int); BIO_clear_flags(b: *mut BIO, flags: c_int)6 pub fn BIO_clear_flags(b: *mut BIO, flags: c_int); 7 } 8 9 pub type bio_info_cb = 10 Option<unsafe extern "C" fn(*mut BIO, c_int, *const c_char, c_int, c_long, c_long)>; 11 12 cfg_if! { 13 if #[cfg(any(ossl110, libressl280))] { 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 32 const_ptr_api! { 33 extern "C" { 34 pub fn BIO_s_file() -> #[const_ptr_if(any(ossl110, libressl280))] BIO_METHOD; 35 pub fn BIO_new(type_: #[const_ptr_if(any(ossl110, libressl280))] BIO_METHOD) -> *mut BIO; 36 } 37 } 38 extern "C" { 39 #[cfg(not(osslconf = "OPENSSL_NO_STDIO"))] BIO_new_fp(stream: *mut FILE, close_flag: c_int) -> *mut BIO40 pub fn BIO_new_fp(stream: *mut FILE, close_flag: c_int) -> *mut BIO; 41 #[cfg(any(ossl110, libressl273))] BIO_set_data(a: *mut BIO, data: *mut c_void)42 pub fn BIO_set_data(a: *mut BIO, data: *mut c_void); 43 #[cfg(any(ossl110, libressl273))] BIO_get_data(a: *mut BIO) -> *mut c_void44 pub fn BIO_get_data(a: *mut BIO) -> *mut c_void; 45 #[cfg(any(ossl110, libressl273))] BIO_set_init(a: *mut BIO, init: c_int)46 pub fn BIO_set_init(a: *mut BIO, init: c_int); BIO_write(b: *mut BIO, buf: *const c_void, len: c_int) -> c_int47 pub fn BIO_write(b: *mut BIO, buf: *const c_void, len: c_int) -> c_int; BIO_read(b: *mut BIO, buf: *mut c_void, len: c_int) -> c_int48 pub fn BIO_read(b: *mut BIO, buf: *mut c_void, len: c_int) -> c_int; BIO_ctrl(b: *mut BIO, cmd: c_int, larg: c_long, parg: *mut c_void) -> c_long49 pub fn BIO_ctrl(b: *mut BIO, cmd: c_int, larg: c_long, parg: *mut c_void) -> c_long; BIO_free_all(b: *mut BIO)50 pub fn BIO_free_all(b: *mut BIO); 51 } 52 53 const_ptr_api! { 54 extern "C" { 55 pub fn BIO_s_mem() -> #[const_ptr_if(any(ossl110, libressl280))] BIO_METHOD; 56 pub fn BIO_new_mem_buf(buf: #[const_ptr_if(any(ossl102, libressl280))] c_void, len: c_int) -> *mut BIO; 57 } 58 } 59 60 extern "C" { BIO_new_socket(sock: c_int, close_flag: c_int) -> *mut BIO61 pub fn BIO_new_socket(sock: c_int, close_flag: c_int) -> *mut BIO; 62 63 #[cfg(any(ossl110, libressl273))] BIO_meth_new(type_: c_int, name: *const c_char) -> *mut BIO_METHOD64 pub fn BIO_meth_new(type_: c_int, name: *const c_char) -> *mut BIO_METHOD; 65 #[cfg(any(ossl110, libressl273))] BIO_meth_free(biom: *mut BIO_METHOD)66 pub fn BIO_meth_free(biom: *mut BIO_METHOD); 67 } 68 69 #[allow(clashing_extern_declarations)] 70 extern "C" { 71 #[cfg(any(ossl110, libressl273))] 72 #[link_name = "BIO_meth_set_write"] BIO_meth_set_write__fixed_rust( biom: *mut BIO_METHOD, write: Option<unsafe extern "C" fn(*mut BIO, *const c_char, c_int) -> c_int>, ) -> c_int73 pub fn BIO_meth_set_write__fixed_rust( 74 biom: *mut BIO_METHOD, 75 write: Option<unsafe extern "C" fn(*mut BIO, *const c_char, c_int) -> c_int>, 76 ) -> c_int; 77 #[cfg(any(ossl110, libressl273))] 78 #[link_name = "BIO_meth_set_read"] BIO_meth_set_read__fixed_rust( biom: *mut BIO_METHOD, read: Option<unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int>, ) -> c_int79 pub fn BIO_meth_set_read__fixed_rust( 80 biom: *mut BIO_METHOD, 81 read: Option<unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int>, 82 ) -> c_int; 83 #[cfg(any(ossl110, libressl273))] 84 #[link_name = "BIO_meth_set_puts"] BIO_meth_set_puts__fixed_rust( biom: *mut BIO_METHOD, read: Option<unsafe extern "C" fn(*mut BIO, *const c_char) -> c_int>, ) -> c_int85 pub fn BIO_meth_set_puts__fixed_rust( 86 biom: *mut BIO_METHOD, 87 read: Option<unsafe extern "C" fn(*mut BIO, *const c_char) -> c_int>, 88 ) -> c_int; 89 #[cfg(any(ossl110, libressl273))] 90 #[link_name = "BIO_meth_set_ctrl"] BIO_meth_set_ctrl__fixed_rust( biom: *mut BIO_METHOD, read: Option<unsafe extern "C" fn(*mut BIO, c_int, c_long, *mut c_void) -> c_long>, ) -> c_int91 pub fn BIO_meth_set_ctrl__fixed_rust( 92 biom: *mut BIO_METHOD, 93 read: Option<unsafe extern "C" fn(*mut BIO, c_int, c_long, *mut c_void) -> c_long>, 94 ) -> c_int; 95 #[cfg(any(ossl110, libressl273))] 96 #[link_name = "BIO_meth_set_create"] BIO_meth_set_create__fixed_rust( biom: *mut BIO_METHOD, create: Option<unsafe extern "C" fn(*mut BIO) -> c_int>, ) -> c_int97 pub fn BIO_meth_set_create__fixed_rust( 98 biom: *mut BIO_METHOD, 99 create: Option<unsafe extern "C" fn(*mut BIO) -> c_int>, 100 ) -> c_int; 101 #[cfg(any(ossl110, libressl273))] 102 #[link_name = "BIO_meth_set_destroy"] BIO_meth_set_destroy__fixed_rust( biom: *mut BIO_METHOD, destroy: Option<unsafe extern "C" fn(*mut BIO) -> c_int>, ) -> c_int103 pub fn BIO_meth_set_destroy__fixed_rust( 104 biom: *mut BIO_METHOD, 105 destroy: Option<unsafe extern "C" fn(*mut BIO) -> c_int>, 106 ) -> c_int; 107 } 108