| 1 | use libc::*; |
| 2 | |
| 3 | cfg_if! { |
| 4 | if #[cfg(ossl110)] { |
| 5 | pub enum OPENSSL_STACK {} |
| 6 | } else if #[cfg(libressl390)] { |
| 7 | pub enum _STACK {} |
| 8 | } else { |
| 9 | #[repr (C)] |
| 10 | pub struct _STACK { |
| 11 | pub num: c_int, |
| 12 | pub data: *mut *mut c_char, |
| 13 | pub sorted: c_int, |
| 14 | pub num_alloc: c_int, |
| 15 | pub comp: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, |
| 16 | } |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | cfg_if! { |
| 21 | if #[cfg(ossl110)] { |
| 22 | extern "C" { |
| 23 | pub fn OPENSSL_sk_num(stack: *const OPENSSL_STACK) -> c_int; |
| 24 | pub fn OPENSSL_sk_value(stack: *const OPENSSL_STACK, idx: c_int) -> *mut c_void; |
| 25 | |
| 26 | pub fn OPENSSL_sk_new_null() -> *mut OPENSSL_STACK; |
| 27 | pub fn OPENSSL_sk_free(st: *mut OPENSSL_STACK); |
| 28 | pub fn OPENSSL_sk_pop_free( |
| 29 | st: *mut OPENSSL_STACK, |
| 30 | free: Option<unsafe extern "C" fn(*mut c_void)>, |
| 31 | ); |
| 32 | pub fn OPENSSL_sk_push(st: *mut OPENSSL_STACK, data: *const c_void) -> c_int; |
| 33 | pub fn OPENSSL_sk_pop(st: *mut OPENSSL_STACK) -> *mut c_void; |
| 34 | } |
| 35 | } else { |
| 36 | extern "C" { |
| 37 | pub fn sk_num(st: *const _STACK) -> c_int; |
| 38 | pub fn sk_value(st: *const _STACK, n: c_int) -> *mut c_void; |
| 39 | |
| 40 | pub fn sk_new_null() -> *mut _STACK; |
| 41 | pub fn sk_free(st: *mut _STACK); |
| 42 | pub fn sk_pop_free(st: *mut _STACK, free: Option<unsafe extern "C" fn(*mut c_void)>); |
| 43 | pub fn sk_push(st: *mut _STACK, data: *mut c_void) -> c_int; |
| 44 | pub fn sk_pop(st: *mut _STACK) -> *mut c_void; |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |