1 // Copyright (c) 2023 Huawei Device Co., Ltd. 2 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // you may not use this file except in compliance with the License. 4 // You may obtain a copy of the License at 5 // 6 // http://www.apache.org/licenses/LICENSE-2.0 7 // 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 use libc::{c_char, c_int, c_long, c_void}; 15 16 pub(crate) enum BIO {} 17 18 // for `BIO` 19 extern "C" { 20 /// Creates a memory BIO using len bytes of data at buf, if len is -1 then 21 /// the buf is assumed to be nul terminated and its length is determined 22 /// by strlen. BIO_new_mem_buf(buf: *const c_void, len: c_int) -> *mut BIO23 pub(crate) fn BIO_new_mem_buf(buf: *const c_void, len: c_int) -> *mut BIO; 24 BIO_set_data(a: *mut BIO, data: *mut c_void)25 pub(crate) fn BIO_set_data(a: *mut BIO, data: *mut c_void); 26 BIO_get_data(a: *mut BIO) -> *mut c_void27 pub(crate) fn BIO_get_data(a: *mut BIO) -> *mut c_void; 28 BIO_free_all(bio: *mut BIO)29 pub(crate) fn BIO_free_all(bio: *mut BIO); 30 BIO_new(b_type: *const BIO_METHOD) -> *mut BIO31 pub(crate) fn BIO_new(b_type: *const BIO_METHOD) -> *mut BIO; 32 BIO_set_init(a: *mut BIO, init: c_int)33 pub(crate) fn BIO_set_init(a: *mut BIO, init: c_int); 34 BIO_set_flags(b: *mut BIO, flags: c_int)35 pub(crate) fn BIO_set_flags(b: *mut BIO, flags: c_int); 36 BIO_clear_flags(b: *mut BIO, flags: c_int)37 pub(crate) fn BIO_clear_flags(b: *mut BIO, flags: c_int); 38 } 39 40 pub(crate) enum BIO_METHOD {} 41 42 // for `BIO_METHOD` 43 extern "C" { BIO_meth_new(type_: c_int, name: *const c_char) -> *mut BIO_METHOD44 pub(crate) fn BIO_meth_new(type_: c_int, name: *const c_char) -> *mut BIO_METHOD; 45 BIO_meth_free(biom: *mut BIO_METHOD)46 pub(crate) fn BIO_meth_free(biom: *mut BIO_METHOD); 47 BIO_meth_set_write( biom: *mut BIO_METHOD, write: unsafe extern "C" fn(*mut BIO, *const c_char, c_int) -> c_int, ) -> c_int48 pub(crate) fn BIO_meth_set_write( 49 biom: *mut BIO_METHOD, 50 write: unsafe extern "C" fn(*mut BIO, *const c_char, c_int) -> c_int, 51 ) -> c_int; 52 BIO_meth_set_read( biom: *mut BIO_METHOD, read: unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int, ) -> c_int53 pub(crate) fn BIO_meth_set_read( 54 biom: *mut BIO_METHOD, 55 read: unsafe extern "C" fn(*mut BIO, *mut c_char, c_int) -> c_int, 56 ) -> c_int; 57 BIO_meth_set_puts( biom: *mut BIO_METHOD, read: unsafe extern "C" fn(*mut BIO, *const c_char) -> c_int, ) -> c_int58 pub(crate) fn BIO_meth_set_puts( 59 biom: *mut BIO_METHOD, 60 read: unsafe extern "C" fn(*mut BIO, *const c_char) -> c_int, 61 ) -> c_int; 62 BIO_meth_set_ctrl( biom: *mut BIO_METHOD, read: unsafe extern "C" fn(*mut BIO, c_int, c_long, *mut c_void) -> c_long, ) -> c_int63 pub(crate) fn BIO_meth_set_ctrl( 64 biom: *mut BIO_METHOD, 65 read: unsafe extern "C" fn(*mut BIO, c_int, c_long, *mut c_void) -> c_long, 66 ) -> c_int; 67 BIO_meth_set_create( biom: *mut BIO_METHOD, create: unsafe extern "C" fn(*mut BIO) -> c_int, ) -> c_int68 pub(crate) fn BIO_meth_set_create( 69 biom: *mut BIO_METHOD, 70 create: unsafe extern "C" fn(*mut BIO) -> c_int, 71 ) -> c_int; 72 BIO_meth_set_destroy( biom: *mut BIO_METHOD, destroy: unsafe extern "C" fn(*mut BIO) -> c_int, ) -> c_int73 pub(crate) fn BIO_meth_set_destroy( 74 biom: *mut BIO_METHOD, 75 destroy: unsafe extern "C" fn(*mut BIO) -> c_int, 76 ) -> c_int; 77 } 78