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" { 61 #[cfg(not(osslconf = "OPENSSL_NO_SOCK"))] BIO_new_socket(sock: c_int, close_flag: c_int) -> *mut BIO62 pub fn BIO_new_socket(sock: c_int, close_flag: c_int) -> *mut BIO; 63 64 #[cfg(any(ossl110, libressl273))] BIO_meth_new(type_: c_int, name: *const c_char) -> *mut BIO_METHOD65 pub fn BIO_meth_new(type_: c_int, name: *const c_char) -> *mut BIO_METHOD; 66 #[cfg(any(ossl110, libressl273))] BIO_meth_free(biom: *mut BIO_METHOD)67 pub fn BIO_meth_free(biom: *mut BIO_METHOD); 68 } 69 70 #[allow(clashing_extern_declarations)] 71 extern "C" { 72 #[cfg(any(ossl110, libressl273))] 73 #[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_int74 pub fn BIO_meth_set_write__fixed_rust( 75 biom: *mut BIO_METHOD, 76 write: Option<unsafe extern "C" fn(*mut BIO, *const c_char, c_int) -> c_int>, 77 ) -> c_int; 78 #[cfg(any(ossl110, libressl273))] 79 #[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_int80 pub fn BIO_meth_set_read__fixed_rust( 81 biom: *mut BIO_METHOD, 82 read: Option<unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int>, 83 ) -> c_int; 84 #[cfg(any(ossl110, libressl273))] 85 #[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_int86 pub fn BIO_meth_set_puts__fixed_rust( 87 biom: *mut BIO_METHOD, 88 read: Option<unsafe extern "C" fn(*mut BIO, *const c_char) -> c_int>, 89 ) -> c_int; 90 #[cfg(any(ossl110, libressl273))] 91 #[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_int92 pub fn BIO_meth_set_ctrl__fixed_rust( 93 biom: *mut BIO_METHOD, 94 read: Option<unsafe extern "C" fn(*mut BIO, c_int, c_long, *mut c_void) -> c_long>, 95 ) -> c_int; 96 #[cfg(any(ossl110, libressl273))] 97 #[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_int98 pub fn BIO_meth_set_create__fixed_rust( 99 biom: *mut BIO_METHOD, 100 create: Option<unsafe extern "C" fn(*mut BIO) -> c_int>, 101 ) -> c_int; 102 #[cfg(any(ossl110, libressl273))] 103 #[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_int104 pub fn BIO_meth_set_destroy__fixed_rust( 105 biom: *mut BIO_METHOD, 106 destroy: Option<unsafe extern "C" fn(*mut BIO) -> c_int>, 107 ) -> c_int; 108 } 109