s2n-tls-sys 0.3.37

A C99 implementation of the TLS/SSL protocols
Documentation
/* automatically generated by rust-bindgen 0.69.5 */


// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0


#![allow(unused_imports, non_camel_case_types)]

use libc::{iovec, FILE, off_t};
// specify that aws-lc-rs is used, so that the rust compiler will link in the appropriate
// libcrypto artifact.
#[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 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,
}
#[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>(),
        48usize,
        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).handshake_time_ns) as usize - ptr as usize },
        24usize,
        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 },
        32usize,
        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 },
        40usize,
        concat!(
            "Offset of field: ",
            stringify!(s2n_event_handshake),
            "::",
            stringify!(handshake_end_ns)
        )
    );
}
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 not emitted if the handshake fails."]
    pub fn s2n_config_set_handshake_event(
        config: *mut s2n_config,
        callback: s2n_event_on_handshake_cb,
    ) -> ::libc::c_int;
}