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


pub mod s2n_fingerprint_type {
    #[doc = " @file fingerprint.h\n\n The following APIs enable applications to calculate fingerprints to\n identify ClientHellos.\n\n The fingerprinting APIs are currently considered unstable. They will be finalized\n and marked as stable after an initial customer integration and feedback."]
    pub type Type = ::libc::c_uint;
    pub const FINGERPRINT_JA3: Type = 0;
    pub const FINGERPRINT_JA4: Type = 1;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct s2n_fingerprint {
    _unused: [u8; 0],
}
extern "C" {
    #[doc = " Create a reusable fingerprint structure.\n\n Fingerprinting is primarily used to identify malicious or abusive clients,\n so fingerprinting needs to be efficient and require minimal resources.\n The `s2n_client_hello_get_fingerprint_hash` and `s2n_client_hello_get_fingerprint_string`\n methods may require additional memory to calculate the fingerprint. Reusing\n the same `s2n_fingerprint` structure to calculate multiple fingerprints reduces\n the cost of each individual fingerprint.\n\n @param type The algorithm to use for the fingerprint.\n @returns S2N_SUCCESS on success, S2N_FAILURE on failure."]
    pub fn s2n_fingerprint_new(type_: s2n_fingerprint_type::Type) -> *mut s2n_fingerprint;
}
extern "C" {
    #[doc = " Frees the memory allocated by `s2n_fingerprint_new` for a fingerprint structure.\n\n @param fingerprint The s2n_fingerprint structure to be freed.\n @returns S2N_SUCCESS on success, S2N_FAILURE on failure."]
    pub fn s2n_fingerprint_free(fingerprint: *mut *mut s2n_fingerprint) -> ::libc::c_int;
}
extern "C" {
    #[doc = " Resets the fingerprint for safe reuse with a different ClientHello.\n\n @param fingerprint The s2n_fingerprint structure to be reset.\n @returns S2N_SUCCESS on success, S2N_FAILURE on failure."]
    pub fn s2n_fingerprint_wipe(fingerprint: *mut s2n_fingerprint) -> ::libc::c_int;
}
extern "C" {
    #[doc = " Sets the ClientHello to be fingerprinted.\n\n @param fingerprint The s2n_fingerprint to be modified\n @param ch The client hello to be fingerprinted. It will not be copied, so needs\n to live at least as long as this fingerprinting operation.\n @returns S2N_SUCCESS on success, S2N_FAILURE on failure."]
    pub fn s2n_fingerprint_set_client_hello(
        fingerprint: *mut s2n_fingerprint,
        ch: *mut s2n_client_hello,
    ) -> ::libc::c_int;
}
extern "C" {
    #[doc = " Get the size of the fingerprint hash.\n\n Fingerprint hashes should be a constant size, but that size will vary based\n on the fingerprinting method used.\n\n @param fingerprint The s2n_fingerprint to be used for the hash\n @param size Output variable to be set to the size of the hash\n @returns S2N_SUCCESS on success, S2N_FAILURE on failure."]
    pub fn s2n_fingerprint_get_hash_size(
        fingerprint: *const s2n_fingerprint,
        size: *mut u32,
    ) -> ::libc::c_int;
}
extern "C" {
    #[doc = " Calculates a fingerprint hash.\n\n The output of this method depends on the type of fingerprint.\n\n JA3: A hex-encoded string representing the MD5 hash of the raw string.\n - See https://engineering.salesforce.com/tls-fingerprinting-with-ja3-and-ja3s-247362855967\n - Example: \"c34a54599a1fbaf1786aa6d633545a60\"\n\n JA4: A string consisting of three parts, separated by underscores: the prefix,\n and the hex-encoded truncated SHA256 hashes of the other two parts of the raw string.\n - See https://github.com/FoxIO-LLC/ja4/blob/df3c067/technical_details/JA4.md\n - Example: \"t13i310900_e8f1e7e78f70_1f22a2ca17c4\"\n\n @param fingerprint The s2n_fingerprint to be used for the hash\n @param max_output_size The maximum size of data that may be written to `output`.\n If `output` is too small, an S2N_ERR_T_USAGE error will occur.\n @param output The location that the requested hash will be written to.\n @param output_size Output variable to be set to the actual size of the data\n written to `output`.\n @returns S2N_SUCCESS on success, S2N_FAILURE on failure."]
    pub fn s2n_fingerprint_get_hash(
        fingerprint: *mut s2n_fingerprint,
        max_output_size: u32,
        output: *mut u8,
        output_size: *mut u32,
    ) -> ::libc::c_int;
}
extern "C" {
    #[doc = " Get the size of the raw fingerprint string.\n\n The size of the raw string depends on the ClientHello and cannot be known\n without calculating the fingerprint. Either `s2n_fingerprint_get_hash` or\n `s2n_fingerprint_get_raw` must be called before this method.\n\n @param fingerprint The s2n_fingerprint to be used for the raw string\n @param size Output variable to be set to the size of the raw string\n @returns S2N_SUCCESS on success, S2N_FAILURE on failure."]
    pub fn s2n_fingerprint_get_raw_size(
        fingerprint: *const s2n_fingerprint,
        size: *mut u32,
    ) -> ::libc::c_int;
}
extern "C" {
    #[doc = " Calculates the raw string for a fingerprint.\n\n The output of this method depends on the type of fingerprint.\n\n JA3: A string consisting of lists of decimal values.\n - See https://engineering.salesforce.com/tls-fingerprinting-with-ja3-and-ja3s-247362855967\n - Example: \"771,4866-4867-4865-49196-49200-159-52393-52392-52394-49195-49199-158-\n             49188-49192-107-49187-49191-103-49162-49172-57-49161-49171-51-157-\n             156-61-60-53-47-255,11-10-35-22-23-13-43-45-51,29-23-30-25-24,0-1-2\"\n\n JA4: A string consisting of three parts: a prefix, and two lists of hex values.\n - See https://github.com/FoxIO-LLC/ja4/blob/df3c067/technical_details/JA4.md\n - Example: \"t13i310900_002f,0033,0035,0039,003c,003d,0067,006b,009c,009d,009e,\n             009f,00ff,1301,1302,1303,c009,c00a,c013,c014,c023,c024,c027,c028,\n             c02b,c02c,c02f,c030,cca8,cca9,ccaa_000a,000b,000d,0016,0017,0023,\n             002b,002d,0033_0403,0503,0603,0807,0808,0809,080a,080b,0804,0805,\n             0806,0401,0501,0601,0303,0301,0302,0402,0502,0602\"\n\n @param fingerprint The s2n_fingerprint to be used for the raw string\n @param max_output_size The maximum size of data that may be written to `output`.\n If `output` is too small, an S2N_ERR_T_USAGE error will occur.\n @param output The location that the requested raw string will be written to.\n @param output_size Output variable to be set to the actual size of the data\n written to `output`.\n @returns S2N_SUCCESS on success, S2N_FAILURE on failure."]
    pub fn s2n_fingerprint_get_raw(
        fingerprint: *mut s2n_fingerprint,
        max_output_size: u32,
        output: *mut u8,
        output_size: *mut u32,
    ) -> ::libc::c_int;
}
extern "C" {
    #[doc = " Calculates a fingerprint hash for a given ClientHello.\n\n Currently the only type supported is S2N_FINGERPRINT_JA3, which uses MD5 and\n requires at least 16 bytes of memory.\n\n @param ch The ClientHello to fingerprint.\n @param type The algorithm to use for the fingerprint. Currently only JA3 is supported.\n @param max_hash_size The maximum size of data that may be written to `hash`.\n If too small for the requested hash, an S2N_ERR_T_USAGE error will occur.\n @param hash The location that the requested hash will be written to.\n @param hash_size The actual size of the data written to `hash`.\n @param str_size The actual size of the full string associated with this hash.\n This size can be used to ensure that sufficient memory is provided for the\n output of `s2n_client_hello_get_fingerprint_string`.\n @returns S2N_SUCCESS on success, S2N_FAILURE on failure."]
    pub fn s2n_client_hello_get_fingerprint_hash(
        ch: *mut s2n_client_hello,
        type_: s2n_fingerprint_type::Type,
        max_hash_size: u32,
        hash: *mut u8,
        hash_size: *mut u32,
        str_size: *mut u32,
    ) -> ::libc::c_int;
}
extern "C" {
    #[doc = " Calculates a full, variable-length fingerprint string for a given ClientHello.\n\n Because the length of the string is variable and unknown until the string is\n calculated, `s2n_client_hello_get_fingerprint_hash` can be called first to\n determine `max_size` and ensure `output` is sufficiently large.\n\n @param ch The ClientHello to fingerprint.\n @param type The algorithm to use for the fingerprint. Currently only JA3 is supported.\n @param max_size The maximum size of data that may be written to `output`.\n If too small for the requested string, an S2N_ERR_T_USAGE error will occur.\n @param output The location that the requested string will be written to.\n @param output_size The actual size of the data written to `output`.\n @returns S2N_SUCCESS on success, S2N_FAILURE on failure."]
    pub fn s2n_client_hello_get_fingerprint_string(
        ch: *mut s2n_client_hello,
        type_: s2n_fingerprint_type::Type,
        max_size: u32,
        output: *mut u8,
        output_size: *mut u32,
    ) -> ::libc::c_int;
}
