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_ulong};
15 
16 extern "C" {
17     /// ERR_lib_error_string() and ERR_reason_error_string() return the library
18     /// name and reason string respectively. \
19     /// If there is no text string registered for the given error code,
20     /// the error string will contain the numeric code.
ERR_lib_error_string(err: c_ulong) -> *const c_char21     pub(crate) fn ERR_lib_error_string(err: c_ulong) -> *const c_char;
ERR_reason_error_string(err: c_ulong) -> *const c_char22     pub(crate) fn ERR_reason_error_string(err: c_ulong) -> *const c_char;
23 
ERR_peek_last_error() -> c_ulong24     pub(crate) fn ERR_peek_last_error() -> c_ulong;
25 
ERR_clear_error()26     pub(crate) fn ERR_clear_error();
27 
28     /// Returns the earliest error code from the thread's error queue and
29     /// removes the entry. This function can be called repeatedly until
30     /// there are no more error codes to return.
31     #[cfg(feature = "c_openssl_3_0")]
ERR_get_error_all( file: *mut *const c_char, line: *mut c_int, function: *mut *const c_char, data: *mut *const c_char, flags: *mut c_int, ) -> c_ulong32     pub(crate) fn ERR_get_error_all(
33         file: *mut *const c_char,
34         line: *mut c_int,
35         function: *mut *const c_char,
36         data: *mut *const c_char,
37         flags: *mut c_int,
38     ) -> c_ulong;
39 
40     #[cfg(feature = "c_openssl_1_1")]
ERR_get_error_line_data( file: *mut *const c_char, line: *mut c_int, data: *mut *const c_char, flags: *mut c_int, ) -> c_ulong41     pub(crate) fn ERR_get_error_line_data(
42         file: *mut *const c_char,
43         line: *mut c_int,
44         data: *mut *const c_char,
45         flags: *mut c_int,
46     ) -> c_ulong;
47 
48     #[cfg(feature = "c_openssl_1_1")]
ERR_func_error_string(err: c_ulong) -> *const c_char49     pub(crate) fn ERR_func_error_string(err: c_ulong) -> *const c_char;
50 }
51