#![allow(non_camel_case_types)]
use std::os::raw::{c_void, c_char, c_int};
pub type SSL_METHOD = c_void;
pub type SSL_CTX = c_void;
pub type SSL = c_void;
pub const TLS1_VERSION: u16 = 0x0301;
pub const TLS1_1_VERSION: u16 = 0x0302;
pub const TLS1_2_VERSION: u16 = 0x0303;
pub const TLS1_3_VERSION: u16 = 0x0304;
pub const SSL_VERIFY_NONE: c_int = 0;
pub const SSL_VERIFY_PEER: c_int = 1;
pub const SSL_VERIFY_FAIL_IF_NO_PEER_CERT: c_int = 2;
pub const SSL_VERIFY_PEER_IF_NO_OBC: c_int = 4;
extern "C" {
pub fn TLS_method() -> *const SSL_METHOD;
pub fn SSL_CTX_new(method: *const SSL_METHOD) -> *mut SSL_CTX;
pub fn SSL_CTX_free(ctx: *mut SSL_CTX);
pub fn SSL_CTX_set_cipher_list(ssl: *mut SSL_CTX, list: *const c_char) -> c_int;
pub fn SSL_CTX_set_min_version(ssl: *mut SSL_CTX, version: u16);
pub fn SSL_CTX_set_verify(ctx: *mut SSL_CTX,
mode: c_int,
callback: Option<extern "C" fn(c_int, *mut c_void) -> c_int>);
pub fn SSL_CTX_enable_signed_cert_timestamps(ctx: *mut SSL_CTX);
pub fn SSL_CTX_enable_ocsp_stapling(ctx: *mut SSL_CTX);
pub fn SSL_CTX_enable_tls_channel_id(ctx: *mut SSL_CTX) -> c_int;
}
extern "C" {
pub fn SSL_new(ctx: *mut SSL_CTX) -> *mut SSL;
pub fn SSL_free(ssl: *mut SSL);
pub fn SSL_set_connect_state(ssl: *mut SSL);
pub fn SSL_do_handshake(ssl: *mut SSL) -> c_int;
pub fn SSL_connect(ssl: *mut SSL) -> c_int;
pub fn SSL_set_tlsext_host_name(ssl: *mut SSL, name: *const c_char) -> c_int;
pub fn SSL_set_bio(ssl: *mut SSL, rbio: *mut BIO, wbio: *mut BIO);
pub fn SSL_set_fd(ssl: *mut SSL, fd: c_int) -> c_int;
pub fn SSL_read(ssl: *mut SSL, buf: *mut c_void, num: c_int) -> c_int;
pub fn SSL_pending(ssl: *const SSL) -> c_int;
pub fn SSL_write(ssl: *mut SSL, buf: *const c_void, num: c_int) -> c_int;
pub fn SSL_shutdown(ssl: *mut SSL) -> c_int;
pub fn SSL_get_error(ssl: *const SSL, ret_code: c_int) -> c_int;
}
pub const BIO_NOCLOSE: c_int = 0;
pub const BIO_CLOSE: c_int = 1;
pub type BIO_METHOD = c_void;
pub type BIO = c_void;
extern "C" {
pub fn BIO_new(method: *const BIO_METHOD) -> *mut BIO;
pub fn BIO_free(bio: *mut BIO) -> c_int;
pub fn BIO_read(bio: *mut BIO, data: *mut c_void, len: c_int) -> c_int;
pub fn BIO_write(bio: *mut BIO, data: *const c_void, len: c_int) -> c_int;
pub fn BIO_new_socket(fd: c_int, close_flag: c_int) -> *mut BIO;
}
pub const SSL_ERROR_NONE: c_int = 0;
pub const SSL_ERROR_SSL: c_int = 1;
pub const SSL_ERROR_WANT_READ: c_int = 2;
pub const SSL_ERROR_WANT_WRITE: c_int = 3;
pub const SSL_ERROR_WANT_X509_LOOKUP: c_int = 4;
pub const SSL_ERROR_SYSCALL: c_int = 5;
pub const SSL_ERROR_ZERO_RETURN: c_int = 6;
pub const SSL_ERROR_WANT_CONNECT: c_int = 7;
pub const SSL_ERROR_WANT_ACCEPT: c_int = 8;
pub const SSL_ERROR_WANT_CHANNEL_ID_LOOKUP: c_int = 9;
pub const SSL_ERROR_PENDING_SESSION: c_int = 11;
pub const SSL_ERROR_PENDING_CERTIFICATE: c_int = 12;
pub const SSL_ERROR_WANT_PRIVATE_KEY_OPERATION: c_int = 13;
extern "C" {
pub fn ERR_get_error() -> u32;
pub fn ERR_peek_error() -> u32;
pub fn ERR_lib_error_string(err: u32) -> *const c_char;
pub fn ERR_reason_error_string(err: u32) -> *const c_char;
pub fn ERR_clear_error();
}