/* 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::*;


#[doc = " Opaque struct for the async offloading operation"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct s2n_async_offload_op {
    _unused: [u8; 0],
}
pub mod s2n_async_offload_op_type {
    #[doc = " The type of operations supported by the async offloading callback. Each type is represented by a different bit.\n\n S2N_ASYNC_OFFLOAD_ALLOW_ALL will automatically opt in to all the new types added in the future."]
    pub type Type = ::libc::c_uint;
    pub const OFFLOAD_PKEY_VERIFY: Type = 1;
    pub const OFFLOAD_ALLOW_ALL: Type = 2147483647;
}
#[doc = " The callback function invoked every time an allowed async operation is encountered during the handshake.\n\n To perform an operation asynchronously, the following condiditions must be satisfied:\n 1) This op type must be included in the allow list;\n 2) Async offloading callback returns success and s2n_async_offload_op_perform() is invoked outside the callback.\n\n If s2n_async_offload_op_perform() is invoked inside the callback, it is equivalent to the synchronous use case.\n\n `op` is owned by s2n-tls and will be freed along with s2n_connection eventually.\n\n @param conn Connection which triggered the async offloading callback\n @param op An opaque object representing the async operation\n @param ctx Application data provided to the callback via s2n_config_set_async_offload_callback()"]
pub type s2n_async_offload_cb = ::core::option::Option<
    unsafe extern "C" fn(
        conn: *mut s2n_connection,
        op: *mut s2n_async_offload_op,
        ctx: *mut ::libc::c_void,
    ) -> ::libc::c_int,
>;
extern "C" {
    #[doc = " Sets up the custom async offloading callback and configures the offloaded handshake operations via allow_list.\n\n The value of allow_list should be the Bit-OR of all the allowed s2n_async_offload_op_type values.\n\n S2N_ASYNC_OFFLOAD_ALLOW_ALL provides the performance benefit of offloading all the supported operations;\n ensure your callback can support arbitrary operations. Otherwise, only allow operations that fit your use case.\n\n @param config Config to set the callback\n @param allow_list A bit representation of allowed operations\n @param fn The function that should be called for each allowed async operation\n @param ctx Optional application data passed to the callback"]
    pub fn s2n_config_set_async_offload_callback(
        config: *mut s2n_config,
        allow_list: u32,
        fn_: s2n_async_offload_cb,
        ctx: *mut ::libc::c_void,
    ) -> ::libc::c_int;
}
extern "C" {
    #[doc = " Performs the operation triggered by the async offloading callback.\n\n To execute operations asynchronously, users should spawn a separate thread to invoke s2n_async_offload_op_perform()\n and immediately return S2N_SUCCESS from the callback without waiting for that separate thread to complete.\n\n s2n_negotiate() will throw an `S2N_ERR_T_BLOCKED` error if the handshake is pending on the async offloading callback.\n Retrying s2n_negotiate() will produce the same result until s2n_async_offload_op_perform() is completed.\n\n s2n_async_offload_op_perform() can only be called once for each triggered operation.\n\n @param op An opaque object representing the async operation"]
    pub fn s2n_async_offload_op_perform(op: *mut s2n_async_offload_op) -> ::libc::c_int;
}
