#![allow(unused_imports, non_camel_case_types)]
use libc::{iovec, FILE, off_t};
#[cfg(not(s2n_tls_external_build))]
extern crate aws_lc_rs as _;
use crate::api::*;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct s2n_event_handshake {
#[doc = " The negotiated protocol version\n\n This will be one of the protocol version constants defined in s2n.h"]
pub protocol_version: ::libc::c_int,
pub cipher: *const ::libc::c_char,
pub group: *const ::libc::c_char,
pub security_policy_label: *const ::libc::c_char,
pub handshake_time_ns: u64,
#[doc = " The start of the handshake. This is not an interpretable time, and only has\n meaning in reference to handshake_end_ns.\n\n This is also used as a flag to ensure that the same event isn't emitted\n twice. After the event has been emitted this is set to HANDSHAKE_EVENT_SENT"]
pub handshake_start_ns: u64,
pub handshake_end_ns: u64,
#[doc = " If the handshake failed, this contains the error code.\n 0 indicates no error (successful handshake).\n The error name can be retrieved via s2n_strerror_name(error_code)."]
pub error_code: ::libc::c_int,
}
#[test]
fn bindgen_test_layout_s2n_event_handshake() {
const UNINIT: ::core::mem::MaybeUninit<s2n_event_handshake> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<s2n_event_handshake>(),
64usize,
concat!("Size of: ", stringify!(s2n_event_handshake))
);
assert_eq!(
::core::mem::align_of::<s2n_event_handshake>(),
8usize,
concat!("Alignment of ", stringify!(s2n_event_handshake))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).protocol_version) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(s2n_event_handshake),
"::",
stringify!(protocol_version)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cipher) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(s2n_event_handshake),
"::",
stringify!(cipher)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).group) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(s2n_event_handshake),
"::",
stringify!(group)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).security_policy_label) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(s2n_event_handshake),
"::",
stringify!(security_policy_label)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).handshake_time_ns) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(s2n_event_handshake),
"::",
stringify!(handshake_time_ns)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).handshake_start_ns) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(s2n_event_handshake),
"::",
stringify!(handshake_start_ns)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).handshake_end_ns) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(s2n_event_handshake),
"::",
stringify!(handshake_end_ns)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).error_code) as usize - ptr as usize },
56usize,
concat!(
"Offset of field: ",
stringify!(s2n_event_handshake),
"::",
stringify!(error_code)
)
);
}
pub type s2n_event_on_handshake_cb = ::core::option::Option<
unsafe extern "C" fn(
conn: *mut s2n_connection,
subscriber: *mut ::libc::c_void,
event: *mut s2n_event_handshake,
),
>;
extern "C" {
pub fn s2n_config_set_subscriber(
config: *mut s2n_config,
subscriber: *mut ::libc::c_void,
) -> ::libc::c_int;
}
extern "C" {
#[doc = " Set a callback to receive a handshake event.\n\n The `struct s2n_event_handshake *event` is only valid over the lifetime of the\n callbacks, and must not be referenced after the callback returned.\n\n An event is emitted both on success and failure. On failure, the event's\n error_code field will be set with the relevant error information."]
pub fn s2n_config_set_handshake_event(
config: *mut s2n_config,
callback: s2n_event_on_handshake_cb,
) -> ::libc::c_int;
}