diff --git a/ci/01-base.sh b/ci/01-base.sh index da9384eb36a1ef3f9aa62d6a0d9918ef3da69bc6..f5a3f3145adfa38d8167341d5b3b135e37ffc36f 100755 --- a/ci/01-base.sh +++ b/ci/01-base.sh @@ -6,7 +6,7 @@ set +e aclocal automake -LIBS=-ldl ./configure --with-openssl --disable-shared --without-ngtcp2 --enable-debug +LIBS=-ldl ./configure --without-ssl --disable-shared --without-ngtcp2 cd lib make diff --git a/rust/rust_ffi/src/ffi_alias/mod.rs b/rust/rust_ffi/src/ffi_alias/mod.rs index f371f1641d3759d0880fd45d24f5764b354163c8..f0e012bfe7725140f277b8f3ce30bfac520373a7 100644 --- a/rust/rust_ffi/src/ffi_alias/mod.rs +++ b/rust/rust_ffi/src/ffi_alias/mod.rs @@ -8,7 +8,7 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: pnext, + * Author: pnext, * Create: 2022-10-31 * Description: Rust module declaration ******************************************************************************/ diff --git a/rust/rust_ffi/src/ffi_alias/type_alias.rs b/rust/rust_ffi/src/ffi_alias/type_alias.rs index 9b4ff40192a40ef4ce40aa2cfcb884b320f14fdd..e20bf1dbef1f6116f1fe9333e1860b9fa70fee8f 100644 --- a/rust/rust_ffi/src/ffi_alias/type_alias.rs +++ b/rust/rust_ffi/src/ffi_alias/type_alias.rs @@ -8,7 +8,7 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: pnext, + * Author: pnext, * Create: 2022-10-31 * Description: type alias that ffi needed ******************************************************************************/ @@ -39,7 +39,7 @@ extern "C" { // pub type ftp_parselist_data; // pub type http_connect_state; - // mbedtls ftp + // mbedtls ftp // pub type ssl_backend_data; // http2.rs @@ -62,7 +62,7 @@ extern "C" { pub type gnutls_x509_crt_int; pub type gnutls_ocsp_resp_int; - // wolfssl.rs + // wolfssl.rs pub type WOLFSSL; pub type WOLFSSL_CTX; pub type WOLFSSL_SESSION; @@ -90,7 +90,7 @@ extern "C" { pub type rustls_client_config_builder; pub type rustls_root_cert_store; pub type rustls_slice_slice_bytes; - + // openssl.rs pub type x509_st; pub type ssl_st; @@ -134,7 +134,7 @@ extern "C" { pub type PKCS12_st; pub type ssl_method_st; pub type ossl_init_settings_st; - + // mesalink.rs pub type MESALINK_SSL; pub type MESALINK_CTX; @@ -221,17 +221,14 @@ pub type __off64_t = libc::c_long; pub type size_t = libc::c_ulong; pub type _IO_lock_t = (); pub type FILE = _IO_FILE; -pub type curl_free_callback = Option:: ()>; +pub type curl_free_callback = Option ()>; // vtls.rs pub type curl_sslbackend = libc::c_uint; pub type bit = libc::c_uint; pub type CURLcode = libc::c_uint; -pub type curl_malloc_callback = Option::< - unsafe extern "C" fn(size_t) -> *mut libc::c_void, ->; -pub type curl_strdup_callback = Option::< - unsafe extern "C" fn(*const libc::c_char) -> *mut libc::c_char, ->; +pub type curl_malloc_callback = Option *mut libc::c_void>; +pub type curl_strdup_callback = + Option *mut libc::c_char>; pub type CURLsslset = libc::c_uint; // ftp.rs pub type __uint8_t = libc::c_uchar; @@ -249,60 +246,41 @@ pub type sa_family_t = libc::c_ushort; pub type curl_socklen_t = socklen_t; pub type curl_off_t = libc::c_long; pub type CURLproxycode = libc::c_uint; -pub type wildcard_dtor = Option:: ()>; -pub type Curl_llist_dtor = Option::< - unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void) -> (), ->; +pub type wildcard_dtor = Option ()>; +pub type Curl_llist_dtor = Option ()>; pub type wildcard_states = libc::c_uint; pub type trailers_state = libc::c_uint; pub type Curl_HttpReq = libc::c_uint; pub type CURLU = Curl_URL; -pub type curl_read_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t, size_t, *mut libc::c_void) -> size_t, ->; +pub type curl_read_callback = + Option size_t>; pub type expire_id = libc::c_uint; -pub type Curl_hash_dtor = Option:: ()>; -pub type comp_function = Option::< - unsafe extern "C" fn(*mut libc::c_void, size_t, *mut libc::c_void, size_t) -> size_t, ->; -pub type hash_function = Option::< - unsafe extern "C" fn(*mut libc::c_void, size_t, size_t) -> size_t, ->; +pub type Curl_hash_dtor = Option ()>; +pub type comp_function = + Option size_t>; +pub type hash_function = Option size_t>; pub type timediff_t = curl_off_t; -pub type curl_trailer_callback = Option::< - unsafe extern "C" fn(*mut *mut curl_slist, *mut libc::c_void) -> libc::c_int, +pub type curl_trailer_callback = + Option libc::c_int>; +pub type multidone_func = Option libc::c_int>; +pub type curl_resolver_start_callback = Option< + unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void, *mut libc::c_void) -> libc::c_int, >; -pub type multidone_func = Option::< - unsafe extern "C" fn(*mut Curl_easy, CURLcode) -> libc::c_int, ->; -pub type curl_resolver_start_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut libc::c_void, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_fnmatch_callback = Option::< +pub type curl_fnmatch_callback = Option< unsafe extern "C" fn( *mut libc::c_void, *const libc::c_char, *const libc::c_char, ) -> libc::c_int, >; -pub type curl_chunk_end_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void) -> libc::c_long, ->; -pub type curl_chunk_bgn_callback = Option::< - unsafe extern "C" fn( - *const libc::c_void, - *mut libc::c_void, - libc::c_int, - ) -> libc::c_long, +pub type curl_chunk_end_callback = Option libc::c_long>; +pub type curl_chunk_bgn_callback = Option< + unsafe extern "C" fn(*const libc::c_void, *mut libc::c_void, libc::c_int) -> libc::c_long, >; pub type Curl_RtspReq = libc::c_uint; pub type curl_usessl = libc::c_uint; pub type CURL_NETRC_OPTION = libc::c_uint; -pub type curl_sshkeycallback = Option::< +pub type curl_sshkeycallback = Option< unsafe extern "C" fn( *mut CURL, *const curl_khkey, @@ -317,39 +295,28 @@ pub type CURL = Curl_easy; pub type curl_ftpccc = libc::c_uint; pub type curl_ftpauth = libc::c_uint; pub type curl_ftpfile = libc::c_uint; -pub type curl_ssl_ctx_callback = Option::< - unsafe extern "C" fn(*mut CURL, *mut libc::c_void, *mut libc::c_void) -> CURLcode, ->; +pub type curl_ssl_ctx_callback = + Option CURLcode>; pub type curl_proxytype = libc::c_uint; pub type curl_TimeCond = libc::c_uint; pub type mimestate = libc::c_uint; -pub type curl_seek_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_off_t, libc::c_int) -> libc::c_int, ->; +pub type curl_seek_callback = + Option libc::c_int>; pub type mimekind = libc::c_uint; -pub type curl_conv_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t) -> CURLcode, ->; -pub type curl_closesocket_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_socket_t) -> libc::c_int, ->; +pub type curl_conv_callback = Option CURLcode>; +pub type curl_closesocket_callback = + Option libc::c_int>; pub type curl_socket_t = libc::c_int; -pub type curl_opensocket_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - curlsocktype, - *mut curl_sockaddr, - ) -> curl_socket_t, +pub type curl_opensocket_callback = Option< + unsafe extern "C" fn(*mut libc::c_void, curlsocktype, *mut curl_sockaddr) -> curl_socket_t, >; pub type curlsocktype = libc::c_uint; -pub type curl_sockopt_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_socket_t, curlsocktype) -> libc::c_int, ->; -pub type curl_ioctl_callback = Option::< - unsafe extern "C" fn(*mut CURL, libc::c_int, *mut libc::c_void) -> curlioerr, ->; +pub type curl_sockopt_callback = + Option libc::c_int>; +pub type curl_ioctl_callback = + Option curlioerr>; pub type curlioerr = libc::c_uint; -pub type curl_debug_callback = Option::< +pub type curl_debug_callback = Option< unsafe extern "C" fn( *mut CURL, curl_infotype, @@ -359,7 +326,7 @@ pub type curl_debug_callback = Option::< ) -> libc::c_int, >; pub type curl_infotype = libc::c_uint; -pub type curl_xferinfo_callback = Option::< +pub type curl_xferinfo_callback = Option< unsafe extern "C" fn( *mut libc::c_void, curl_off_t, @@ -368,7 +335,7 @@ pub type curl_xferinfo_callback = Option::< curl_off_t, ) -> libc::c_int, >; -pub type curl_progress_callback = Option::< +pub type curl_progress_callback = Option< unsafe extern "C" fn( *mut libc::c_void, libc::c_double, @@ -377,9 +344,8 @@ pub type curl_progress_callback = Option::< libc::c_double, ) -> libc::c_int, >; -pub type curl_write_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t, size_t, *mut libc::c_void) -> size_t, ->; +pub type curl_write_callback = + Option size_t>; pub type curl_pp_transfer = libc::c_uint; pub type uint8_t = __uint8_t; pub type uint32_t = __uint32_t; @@ -388,11 +354,10 @@ pub type upgrade101 = libc::c_uint; pub type expect100 = libc::c_uint; pub type C2RustUnnamed_1 = libc::c_uint; pub type psl_ctx_t = psl_ctx_st; -pub type curl_multi_timer_callback = Option::< - unsafe extern "C" fn(*mut CURLM, libc::c_long, *mut libc::c_void) -> libc::c_int, ->; +pub type curl_multi_timer_callback = + Option libc::c_int>; pub type CURLM = Curl_multi; -pub type curl_push_callback = Option::< +pub type curl_push_callback = Option< unsafe extern "C" fn( *mut CURL, *mut CURL, @@ -401,7 +366,7 @@ pub type curl_push_callback = Option::< *mut libc::c_void, ) -> libc::c_int, >; -pub type curl_socket_callback = Option::< +pub type curl_socket_callback = Option< unsafe extern "C" fn( *mut CURL, curl_socket_t, @@ -442,9 +407,7 @@ pub type ssl_connection_state = libc::c_uint; pub type ChunkyState = libc::c_uint; pub type connect_t = libc::c_uint; pub type curlfiletype = libc::c_uint; -pub type curl_calloc_callback = Option::< - unsafe extern "C" fn(size_t, size_t) -> *mut libc::c_void, ->; +pub type curl_calloc_callback = Option *mut libc::c_void>; pub type uint16_t = __uint16_t; pub type in_addr_t = uint32_t; pub type in_port_t = uint16_t; @@ -456,39 +419,30 @@ pub type timerid = libc::c_uint; pub type CURLofft = libc::c_uint; pub type dupstring = libc::c_uint; // ftplistparser.rs -pub type curl_realloc_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, size_t) -> *mut libc::c_void, ->; +pub type curl_realloc_callback = + Option *mut libc::c_void>; pub type ftpl_C2RustUnnamed_10 = libc::c_uint; pub type ftpl_C2RustUnnamed_11 = libc::c_uint; pub type C2RustUnnamed_12 = libc::c_uint; pub type pl_winNT_mainstate = libc::c_uint; // http_aws_sigv4.rs -pub type HMAC_hfinal_func = Option::< - unsafe extern "C" fn(*mut libc::c_uchar, *mut libc::c_void) -> (), ->; -pub type HMAC_hupdate_func = Option::< - unsafe extern "C" fn(*mut libc::c_void, *const libc::c_uchar, libc::c_uint) -> (), ->; -pub type HMAC_hinit_func = Option:: ()>; +pub type HMAC_hfinal_func = + Option ()>; +pub type HMAC_hupdate_func = + Option ()>; +pub type HMAC_hinit_func = Option ()>; // http.rs -pub type curl_unlock_function = Option::< - unsafe extern "C" fn(*mut CURL, curl_lock_data, *mut libc::c_void) -> (), ->; +pub type curl_unlock_function = + Option ()>; -pub type curl_lock_function = Option::< - unsafe extern "C" fn( - *mut CURL, - curl_lock_data, - curl_lock_access, - *mut libc::c_void, - ) -> (), +pub type curl_lock_function = Option< + unsafe extern "C" fn(*mut CURL, curl_lock_data, curl_lock_access, *mut libc::c_void) -> (), >; // http_digest.rs //http2.rs -pub type nghttp2_data_source_read_callback = Option::< +pub type nghttp2_data_source_read_callback = Option< unsafe extern "C" fn( *mut nghttp2_session, int32_t, @@ -499,7 +453,7 @@ pub type nghttp2_data_source_read_callback = Option::< *mut libc::c_void, ) -> ssize_t, >; -pub type nghttp2_send_callback = Option::< +pub type nghttp2_send_callback = Option< unsafe extern "C" fn( *mut nghttp2_session, *const uint8_t, @@ -508,14 +462,14 @@ pub type nghttp2_send_callback = Option::< *mut libc::c_void, ) -> ssize_t, >; -pub type nghttp2_on_frame_recv_callback = Option::< +pub type nghttp2_on_frame_recv_callback = Option< unsafe extern "C" fn( *mut nghttp2_session, *const nghttp2_frame, *mut libc::c_void, ) -> libc::c_int, >; -pub type nghttp2_on_data_chunk_recv_callback = Option::< +pub type nghttp2_on_data_chunk_recv_callback = Option< unsafe extern "C" fn( *mut nghttp2_session, uint8_t, @@ -525,22 +479,17 @@ pub type nghttp2_on_data_chunk_recv_callback = Option::< *mut libc::c_void, ) -> libc::c_int, >; -pub type nghttp2_on_stream_close_callback = Option::< - unsafe extern "C" fn( - *mut nghttp2_session, - int32_t, - uint32_t, - *mut libc::c_void, - ) -> libc::c_int, +pub type nghttp2_on_stream_close_callback = Option< + unsafe extern "C" fn(*mut nghttp2_session, int32_t, uint32_t, *mut libc::c_void) -> libc::c_int, >; -pub type nghttp2_on_begin_headers_callback = Option::< +pub type nghttp2_on_begin_headers_callback = Option< unsafe extern "C" fn( *mut nghttp2_session, *const nghttp2_frame, *mut libc::c_void, ) -> libc::c_int, >; -pub type nghttp2_on_header_callback = Option::< +pub type nghttp2_on_header_callback = Option< unsafe extern "C" fn( *mut nghttp2_session, *const nghttp2_frame, @@ -552,7 +501,7 @@ pub type nghttp2_on_header_callback = Option::< *mut libc::c_void, ) -> libc::c_int, >; -pub type nghttp2_error_callback = Option::< +pub type nghttp2_error_callback = Option< unsafe extern "C" fn( *mut nghttp2_session, *const libc::c_char, @@ -1614,11 +1563,11 @@ pub const HEADERINST_IGNORE: header_instruction = 1; pub type header_instruction = libc::c_uint; pub const HEADERINST_FORWARD: header_instruction = 0; -// mbedtls ftp +// mbedtls ftp pub type __pid_t = libc::c_int; pub type pid_t = __pid_t; -pub type curl_hstswrite_callback = Option::< +pub type curl_hstswrite_callback = Option< unsafe extern "C" fn( *mut CURL, *mut curl_hstsentry, @@ -1630,14 +1579,8 @@ pub type CURLSTScode = libc::c_uint; pub const CURLSTS_FAIL: CURLSTScode = 2; pub const CURLSTS_DONE: CURLSTScode = 1; pub const CURLSTS_OK: CURLSTScode = 0; -pub type curl_hstsread_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - *mut curl_hstsentry, - *mut libc::c_void, - ) -> CURLSTScode, ->; - +pub type curl_hstsread_callback = + Option CURLSTScode>; pub type curlntlm = libc::c_uint; pub const NTLMSTATE_LAST: curlntlm = 4; @@ -1784,40 +1727,19 @@ pub type mbedtls_x509_buf = mbedtls_asn1_buf; pub type mbedtls_x509_name = mbedtls_asn1_named_data; pub type mbedtls_x509_sequence = mbedtls_asn1_sequence; pub type mbedtls_time_t = time_t; -pub type mbedtls_ssl_get_timer_t = unsafe extern "C" fn( - *mut libc::c_void, -) -> libc::c_int; -pub type mbedtls_ssl_set_timer_t = unsafe extern "C" fn( - *mut libc::c_void, - uint32_t, - uint32_t, -) -> (); -pub type mbedtls_ssl_recv_timeout_t = unsafe extern "C" fn( - *mut libc::c_void, - *mut libc::c_uchar, - size_t, - uint32_t, -) -> libc::c_int; -pub type mbedtls_ssl_recv_t = unsafe extern "C" fn( - *mut libc::c_void, - *mut libc::c_uchar, - size_t, -) -> libc::c_int; -pub type mbedtls_ssl_send_t = unsafe extern "C" fn( - *mut libc::c_void, - *const libc::c_uchar, - size_t, -) -> libc::c_int; -pub type mbedtls_entropy_f_source_ptr = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut libc::c_uchar, - size_t, - *mut size_t, - ) -> libc::c_int, +pub type mbedtls_ssl_get_timer_t = unsafe extern "C" fn(*mut libc::c_void) -> libc::c_int; +pub type mbedtls_ssl_set_timer_t = + unsafe extern "C" fn(*mut libc::c_void, uint32_t, uint32_t) -> (); +pub type mbedtls_ssl_recv_timeout_t = + unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_uchar, size_t, uint32_t) -> libc::c_int; +pub type mbedtls_ssl_recv_t = + unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_uchar, size_t) -> libc::c_int; +pub type mbedtls_ssl_send_t = + unsafe extern "C" fn(*mut libc::c_void, *const libc::c_uchar, size_t) -> libc::c_int; +pub type mbedtls_entropy_f_source_ptr = Option< + unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_uchar, size_t, *mut size_t) -> libc::c_int, >; - // gnutls gtls.rs pub type gtls_C2RustUnnamed = libc::c_uint; pub const MSG_CMSG_CLOEXEC: gtls_C2RustUnnamed = 1073741824; @@ -2069,13 +1991,11 @@ pub type gnutls_server_name_type_t = libc::c_uint; pub const GNUTLS_NAME_DNS: gnutls_server_name_type_t = 1; pub type gnutls_pubkey_t = *mut gnutls_pubkey_st; pub type gnutls_x509_crt_t = *mut gnutls_x509_crt_int; -pub type gnutls_free_function = Option:: ()>; -pub type gnutls_pull_func = Option::< - unsafe extern "C" fn(gnutls_transport_ptr_t, *mut libc::c_void, size_t) -> ssize_t, ->; -pub type gnutls_push_func = Option::< - unsafe extern "C" fn(gnutls_transport_ptr_t, *const libc::c_void, size_t) -> ssize_t, ->; +pub type gnutls_free_function = Option ()>; +pub type gnutls_pull_func = + Option ssize_t>; +pub type gnutls_push_func = + Option ssize_t>; pub type gnutls_pkcs_encrypt_flags_t = libc::c_uint; pub const GNUTLS_PKCS_PBES2_GOST_CPD: gnutls_pkcs_encrypt_flags_t = 32768; pub const GNUTLS_PKCS_PBES2_GOST_CPC: gnutls_pkcs_encrypt_flags_t = 16384; @@ -2135,9 +2055,8 @@ pub const WOLFSSL_TLSV1_1: wolf_C2RustUnnamed_9 = 2; pub const WOLFSSL_TLSV1: wolf_C2RustUnnamed_9 = 1; pub const WOLFSSL_SSLV3: wolf_C2RustUnnamed_9 = 0; pub const WOLFSSL_FAILURE: wolf_C2RustUnnamed_8 = 0; -pub type VerifyCallback = Option::< - unsafe extern "C" fn(libc::c_int, *mut WOLFSSL_X509_STORE_CTX) -> libc::c_int, ->; +pub type VerifyCallback = + Option libc::c_int>; pub const WOLFSSL_VERIFY_NONE: wolf_C2RustUnnamed_8 = 0; pub const WOLFSSL_VERIFY_PEER: wolf_C2RustUnnamed_8 = 1; pub const WOLFSSL_FILETYPE_ASN1: wolf_C2RustUnnamed_8 = 2; @@ -2464,15 +2383,13 @@ pub type __syscall_slong_t = libc::c_long; pub type PK11GenericObject = PK11GenericObjectStr; pub type PRDescIdentity = PRIntn; pub type PRIntn = libc::c_int; -pub type PRReservedFN = Option:: PRIntn>; -pub type PRConnectcontinueFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, PRInt16) -> PRStatus, ->; +pub type PRReservedFN = Option PRIntn>; +pub type PRConnectcontinueFN = Option PRStatus>; pub type PRInt16 = libc::c_short; pub type PRStatus = libc::c_int; pub const PR_SUCCESS: PRStatus = 0; pub const PR_FAILURE: PRStatus = -1; -pub type PRSendfileFN = Option::< +pub type PRSendfileFN = Option< unsafe extern "C" fn( *mut PRFileDesc, *mut PRSendFileData, @@ -2487,9 +2404,8 @@ pub const PR_TRANSMITFILE_CLOSE_SOCKET: PRTransmitFileFlags = 1; pub const PR_TRANSMITFILE_KEEP_OPEN: PRTransmitFileFlags = 0; pub type PRInt32 = libc::c_int; pub type PRSize = size_t; -pub type PRSetsocketoptionFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *const PRSocketOptionData) -> PRStatus, ->; +pub type PRSetsocketoptionFN = + Option PRStatus>; pub type PRUint16 = libc::c_ushort; pub type PRUint64 = libc::c_ulong; pub type PRUint8 = libc::c_uchar; @@ -2514,16 +2430,13 @@ pub const PR_SockOpt_Keepalive: PRSockOption = 3; pub const PR_SockOpt_Reuseaddr: PRSockOption = 2; pub const PR_SockOpt_Linger: PRSockOption = 1; pub const PR_SockOpt_Nonblocking: PRSockOption = 0; -pub type PRGetsocketoptionFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *mut PRSocketOptionData) -> PRStatus, ->; -pub type PRGetpeernameFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *mut PRNetAddr) -> PRStatus, ->; -pub type PRGetsocknameFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *mut PRNetAddr) -> PRStatus, ->; -pub type PRTransmitfileFN = Option::< +pub type PRGetsocketoptionFN = + Option PRStatus>; +pub type PRGetpeernameFN = + Option PRStatus>; +pub type PRGetsocknameFN = + Option PRStatus>; +pub type PRTransmitfileFN = Option< unsafe extern "C" fn( *mut PRFileDesc, *mut PRFileDesc, @@ -2533,7 +2446,7 @@ pub type PRTransmitfileFN = Option::< PRIntervalTime, ) -> PRInt32, >; -pub type PRAcceptreadFN = Option::< +pub type PRAcceptreadFN = Option< unsafe extern "C" fn( *mut PRFileDesc, *mut *mut PRFileDesc, @@ -2543,10 +2456,8 @@ pub type PRAcceptreadFN = Option::< PRIntervalTime, ) -> PRInt32, >; -pub type PRPollFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, PRInt16, *mut PRInt16) -> PRInt16, ->; -pub type PRSendtoFN = Option::< +pub type PRPollFN = Option PRInt16>; +pub type PRSendtoFN = Option< unsafe extern "C" fn( *mut PRFileDesc, *const libc::c_void, @@ -2556,7 +2467,7 @@ pub type PRSendtoFN = Option::< PRIntervalTime, ) -> PRInt32, >; -pub type PRRecvfromFN = Option::< +pub type PRRecvfromFN = Option< unsafe extern "C" fn( *mut PRFileDesc, *mut libc::c_void, @@ -2566,7 +2477,7 @@ pub type PRRecvfromFN = Option::< PRIntervalTime, ) -> PRInt32, >; -pub type PRSendFN = Option::< +pub type PRSendFN = Option< unsafe extern "C" fn( *mut PRFileDesc, *const libc::c_void, @@ -2575,7 +2486,7 @@ pub type PRSendFN = Option::< PRIntervalTime, ) -> PRInt32, >; -pub type PRRecvFN = Option::< +pub type PRRecvFN = Option< unsafe extern "C" fn( *mut PRFileDesc, *mut libc::c_void, @@ -2584,36 +2495,19 @@ pub type PRRecvFN = Option::< PRIntervalTime, ) -> PRInt32, >; -pub type PRShutdownFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, PRIntn) -> PRStatus, ->; -pub type PRListenFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, PRIntn) -> PRStatus, +pub type PRShutdownFN = Option PRStatus>; +pub type PRListenFN = Option PRStatus>; +pub type PRBindFN = Option PRStatus>; +pub type PRAcceptFN = Option< + unsafe extern "C" fn(*mut PRFileDesc, *mut PRNetAddr, PRIntervalTime) -> *mut PRFileDesc, >; -pub type PRBindFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *const PRNetAddr) -> PRStatus, ->; -pub type PRAcceptFN = Option::< - unsafe extern "C" fn( - *mut PRFileDesc, - *mut PRNetAddr, - PRIntervalTime, - ) -> *mut PRFileDesc, ->; -pub type PRConnectFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *const PRNetAddr, PRIntervalTime) -> PRStatus, ->; -pub type PRWritevFN = Option::< - unsafe extern "C" fn( - *mut PRFileDesc, - *const PRIOVec, - PRInt32, - PRIntervalTime, - ) -> PRInt32, ->; -pub type PRFileInfo64FN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *mut PRFileInfo64) -> PRStatus, +pub type PRConnectFN = + Option PRStatus>; +pub type PRWritevFN = Option< + unsafe extern "C" fn(*mut PRFileDesc, *const PRIOVec, PRInt32, PRIntervalTime) -> PRInt32, >; +pub type PRFileInfo64FN = + Option PRStatus>; pub type PRTime = PRInt64; pub type PRInt64 = libc::c_long; pub type PROffset64 = PRInt64; @@ -2621,30 +2515,24 @@ pub type PRFileType = libc::c_uint; pub const PR_FILE_OTHER: PRFileType = 3; pub const PR_FILE_DIRECTORY: PRFileType = 2; pub const PR_FILE_FILE: PRFileType = 1; -pub type PRFileInfoFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *mut PRFileInfo) -> PRStatus, ->; +pub type PRFileInfoFN = Option PRStatus>; pub type PROffset32 = PRInt32; -pub type PRSeek64FN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, PROffset64, PRSeekWhence) -> PROffset64, ->; +pub type PRSeek64FN = + Option PROffset64>; pub type PRSeekWhence = libc::c_uint; pub const PR_SEEK_END: PRSeekWhence = 2; pub const PR_SEEK_CUR: PRSeekWhence = 1; pub const PR_SEEK_SET: PRSeekWhence = 0; -pub type PRSeekFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, PROffset32, PRSeekWhence) -> PROffset32, ->; -pub type PRFsyncFN = Option:: PRStatus>; -pub type PRAvailable64FN = Option:: PRInt64>; -pub type PRAvailableFN = Option:: PRInt32>; -pub type PRWriteFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *const libc::c_void, PRInt32) -> PRInt32, ->; -pub type PRReadFN = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *mut libc::c_void, PRInt32) -> PRInt32, ->; -pub type PRCloseFN = Option:: PRStatus>; +pub type PRSeekFN = + Option PROffset32>; +pub type PRFsyncFN = Option PRStatus>; +pub type PRAvailable64FN = Option PRInt64>; +pub type PRAvailableFN = Option PRInt32>; +pub type PRWriteFN = + Option PRInt32>; +pub type PRReadFN = + Option PRInt32>; +pub type PRCloseFN = Option PRStatus>; pub type PRDescType = libc::c_uint; pub const PR_DESC_PIPE: PRDescType = 5; pub const PR_DESC_LAYERED: PRDescType = 4; @@ -3127,9 +3015,7 @@ pub const certUsageSSLServerWithStepUp: SECCertUsageEnum = 2; pub const certUsageSSLServer: SECCertUsageEnum = 1; pub const certUsageSSLClient: SECCertUsageEnum = 0; pub type PRInt8 = libc::c_schar; -pub type PRTimeParamFn = Option::< - unsafe extern "C" fn(*const PRExplodedTime) -> PRTimeParameters, ->; +pub type PRTimeParamFn = Option PRTimeParameters>; pub type SSLCipherSuiteInfo = SSLCipherSuiteInfoStr; pub type SSLHashType = libc::c_uint; pub const ssl_hash_sha512: SSLHashType = 6; @@ -3274,9 +3160,8 @@ pub const ssl_ec_point_formats_xtn: SSLExtensionType = 11; pub const ssl_supported_groups_xtn: SSLExtensionType = 10; pub const ssl_cert_status_xtn: SSLExtensionType = 5; pub const ssl_server_name_xtn: SSLExtensionType = 0; -pub type SSLCanFalseStartCallback = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *mut libc::c_void, *mut PRBool) -> SECStatus, ->; +pub type SSLCanFalseStartCallback = + Option SECStatus>; pub type PROsfd = PRInt32; pub type SECKEYPrivateKey = SECKEYPrivateKeyStr; pub type CK_ATTRIBUTE_TYPE = CK_ULONG; @@ -3286,7 +3171,7 @@ pub const PK11_TypeCert: PK11ObjectType = 3; pub const PK11_TypePubKey: PK11ObjectType = 2; pub const PK11_TypePrivKey: PK11ObjectType = 1; pub const PK11_TypeGeneric: PK11ObjectType = 0; -pub type SSLGetClientAuthData = Option::< +pub type SSLGetClientAuthData = Option< unsafe extern "C" fn( *mut libc::c_void, *mut PRFileDesc, @@ -3321,27 +3206,19 @@ pub const SSL_NEXT_PROTO_NO_OVERLAP: SSLNextProtoState = 2; pub const SSL_NEXT_PROTO_NO_SUPPORT: SSLNextProtoState = 0; pub const SSL_NEXT_PROTO_EARLY_VALUE: SSLNextProtoState = 4; pub type SSLNextProtoState = libc::c_uint; -pub type SSLHandshakeCallback = Option::< - unsafe extern "C" fn(*mut PRFileDesc, *mut libc::c_void) -> (), ->; -pub type SSLBadCertHandler = Option::< - unsafe extern "C" fn(*mut libc::c_void, *mut PRFileDesc) -> SECStatus, ->; +pub type SSLHandshakeCallback = + Option ()>; +pub type SSLBadCertHandler = + Option SECStatus>; pub type SECItemArray = SECItemArrayStr; -pub type SSLAuthCertificate = Option::< - unsafe extern "C" fn(*mut libc::c_void, *mut PRFileDesc, PRBool, PRBool) -> SECStatus, ->; +pub type SSLAuthCertificate = + Option SECStatus>; pub type SSLVersionRange = SSLVersionRangeStr; pub type SSLProtocolVariant = libc::c_uint; pub const ssl_variant_datagram: SSLProtocolVariant = 1; pub const ssl_variant_stream: SSLProtocolVariant = 0; -pub type PK11PasswordFunc = Option::< - unsafe extern "C" fn( - *mut PK11SlotInfo, - PRBool, - *mut libc::c_void, - ) -> *mut libc::c_char, ->; +pub type PK11PasswordFunc = + Option *mut libc::c_char>; pub type PRThreadPriority = libc::c_uint; pub const PR_PRIORITY_LAST: PRThreadPriority = 3; pub const PR_PRIORITY_URGENT: PRThreadPriority = 3; @@ -3801,22 +3678,17 @@ pub const RUSTLS_RESULT_NULL_PARAMETER: rustls_result = 7002; pub const RUSTLS_RESULT_IO: rustls_result = 7001; pub const RUSTLS_RESULT_OK: rustls_result = 7000; pub type rustls_verify_server_cert_user_data = *mut libc::c_void; -pub type rustls_verify_server_cert_callback = Option::< +pub type rustls_verify_server_cert_callback = Option< unsafe extern "C" fn( rustls_verify_server_cert_user_data, *const rustls_verify_server_cert_params, ) -> rustls_result, >; pub type rustls_io_result = libc::c_int; -pub type rustls_read_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut uint8_t, - size_t, - *mut size_t, - ) -> rustls_io_result, +pub type rustls_read_callback = Option< + unsafe extern "C" fn(*mut libc::c_void, *mut uint8_t, size_t, *mut size_t) -> rustls_io_result, >; -pub type rustls_write_callback = Option::< +pub type rustls_write_callback = Option< unsafe extern "C" fn( *mut libc::c_void, *const uint8_t, @@ -3905,12 +3777,10 @@ pub type X509_EXTENSION = X509_extension_st; pub type X509_ALGOR = X509_algor_st; pub type numcert_t = libc::c_int; pub type SSL_CIPHER = ssl_cipher_st; -pub type SSL_CTX_keylog_cb_func = Option::< - unsafe extern "C" fn(*const SSL, *const libc::c_char) -> (), ->; -pub type SSL_verify_cb = Option::< - unsafe extern "C" fn(libc::c_int, *mut X509_STORE_CTX) -> libc::c_int, ->; +pub type SSL_CTX_keylog_cb_func = + Option ()>; +pub type SSL_verify_cb = + Option libc::c_int>; pub type X509_STORE_CTX = x509_store_ctx_st; pub type X509_LOOKUP = x509_lookup_st; pub type X509_LOOKUP_METHOD = x509_lookup_method_st; @@ -3919,8 +3789,8 @@ pub type EVP_CIPHER_INFO = evp_cipher_info_st; pub type EVP_CIPHER = evp_cipher_st; pub type X509_PKEY = private_key_st; pub type X509_CRL = X509_crl_st; -pub type sk_X509_INFO_freefunc = Option:: ()>; -pub type OPENSSL_sk_freefunc = Option:: ()>; +pub type sk_X509_INFO_freefunc = Option ()>; +pub type OPENSSL_sk_freefunc = Option ()>; pub type UI_METHOD = ui_method_st; pub type UI_STRING = ui_string_st; pub type UI = ui_st; @@ -3931,9 +3801,9 @@ pub const UIT_ERROR: UI_string_types = 5; pub const UIT_INFO: UI_string_types = 4; pub const UIT_BOOLEAN: UI_string_types = 3; pub const UIT_NONE: UI_string_types = 0; -pub type sk_X509_freefunc = Option:: ()>; +pub type sk_X509_freefunc = Option ()>; pub type PKCS12 = PKCS12_st; -pub type SSL_CTX_npn_select_cb_func = Option::< +pub type SSL_CTX_npn_select_cb_func = Option< unsafe extern "C" fn( *mut SSL, *mut *mut libc::c_uchar, @@ -3946,8 +3816,6 @@ pub type SSL_CTX_npn_select_cb_func = Option::< pub type ctx_option_t = libc::c_long; pub type OPENSSL_INIT_SETTINGS = ossl_init_settings_st; - - // mesalink.rs pub const MESALINK_SUCCESS: mesalink_constant_t = 1; pub const MESALINK_FILETYPE_ASN1: mesalink_constant_t = 2; @@ -3984,7 +3852,8 @@ pub const TLS_ERROR_FAILED_TO_GET_CURRENT_TIME: mesa_C2RustUnnamed_9 = 50334976; pub const TLS_ERROR_GENERAL: mesa_C2RustUnnamed_9 = 50334720; pub const TLS_ERROR_INVALID_SCT: mesa_C2RustUnnamed_9 = 50334464; pub const TLS_ERROR_WEBPKI_UNSUPPORTED_SIGNATURE_ALGORITHM: mesa_C2RustUnnamed_9 = 50334227; -pub const TLS_ERROR_WEBPKI_UNSUPPORTED_SIGNATURE_ALGORITHM_FOR_PUBLIC_KEY: mesa_C2RustUnnamed_9 = 50334226; +pub const TLS_ERROR_WEBPKI_UNSUPPORTED_SIGNATURE_ALGORITHM_FOR_PUBLIC_KEY: mesa_C2RustUnnamed_9 = + 50334226; pub const TLS_ERROR_WEBPKI_UNSUPPORTED_CRITICAL_EXTENSION: mesa_C2RustUnnamed_9 = 50334225; pub const TLS_ERROR_WEBPKI_UNSUPPORTED_CERT_VERSION: mesa_C2RustUnnamed_9 = 50334224; pub const TLS_ERROR_WEBPKI_UNKNOWN_ISSUER: mesa_C2RustUnnamed_9 = 50334223; @@ -4099,7 +3968,7 @@ pub const PROT_NONE: protection_level = 0; // bearssl.rs pub type int16_t = __int16_t; pub type __int16_t = libc::c_short; -pub type br_ecdsa_vrfy = Option::< +pub type br_ecdsa_vrfy = Option< unsafe extern "C" fn( *const br_ec_impl, *const libc::c_void, @@ -4109,7 +3978,7 @@ pub type br_ecdsa_vrfy = Option::< size_t, ) -> uint32_t, >; -pub type br_rsa_pkcs1_vrfy = Option::< +pub type br_rsa_pkcs1_vrfy = Option< unsafe extern "C" fn( *const libc::c_uchar, size_t, @@ -4119,28 +3988,17 @@ pub type br_rsa_pkcs1_vrfy = Option::< *mut libc::c_uchar, ) -> uint32_t, >; -pub type br_x509_time_check = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - uint32_t, - uint32_t, - uint32_t, - uint32_t, - ) -> libc::c_int, +pub type br_x509_time_check = Option< + unsafe extern "C" fn(*mut libc::c_void, uint32_t, uint32_t, uint32_t, uint32_t) -> libc::c_int, >; pub type br_hash_class = br_hash_class_; pub type br_sha384_context = br_sha512_context; pub type br_sha224_context = br_sha256_context; pub type br_x509_class = br_x509_class_; pub type br_ssl_client_context = br_ssl_client_context_; -pub type br_rsa_public = Option::< - unsafe extern "C" fn( - *mut libc::c_uchar, - size_t, - *const br_rsa_public_key, - ) -> uint32_t, ->; -pub type br_ecdsa_sign = Option::< +pub type br_rsa_public = + Option uint32_t>; +pub type br_ecdsa_sign = Option< unsafe extern "C" fn( *const br_ec_impl, *const br_hash_class, @@ -4150,7 +4008,7 @@ pub type br_ecdsa_sign = Option::< ) -> size_t, >; pub type br_ssl_client_certificate_class = br_ssl_client_certificate_class_; -pub type br_rsa_pkcs1_sign = Option::< +pub type br_rsa_pkcs1_sign = Option< unsafe extern "C" fn( *const libc::c_uchar, *const libc::c_uchar, @@ -4165,7 +4023,7 @@ pub type br_sslrec_out_class = br_sslrec_out_class_; pub type br_sslrec_in_ccm_class = br_sslrec_in_ccm_class_; pub type br_sslrec_in_class = br_sslrec_in_class_; pub type br_sslrec_out_chapol_class = br_sslrec_out_chapol_class_; -pub type br_poly1305_run = Option::< +pub type br_poly1305_run = Option< unsafe extern "C" fn( *const libc::c_void, *const libc::c_void, @@ -4178,7 +4036,7 @@ pub type br_poly1305_run = Option::< libc::c_int, ) -> (), >; -pub type br_chacha20_run = Option::< +pub type br_chacha20_run = Option< unsafe extern "C" fn( *const libc::c_void, *const libc::c_void, @@ -4189,13 +4047,8 @@ pub type br_chacha20_run = Option::< >; pub type br_sslrec_in_chapol_class = br_sslrec_in_chapol_class_; pub type br_sslrec_out_gcm_class = br_sslrec_out_gcm_class_; -pub type br_ghash = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *const libc::c_void, - *const libc::c_void, - size_t, - ) -> (), +pub type br_ghash = Option< + unsafe extern "C" fn(*mut libc::c_void, *const libc::c_void, *const libc::c_void, size_t) -> (), >; pub type br_block_ctr_class = br_block_ctr_class_; pub type br_sslrec_in_gcm_class = br_sslrec_in_gcm_class_; @@ -4203,7 +4056,7 @@ pub type br_sslrec_out_cbc_class = br_sslrec_out_cbc_class_; pub type br_block_cbcenc_class = br_block_cbcenc_class_; pub type br_sslrec_in_cbc_class = br_sslrec_in_cbc_class_; pub type br_block_cbcdec_class = br_block_cbcdec_class_; -pub type br_tls_prf_impl = Option::< +pub type br_tls_prf_impl = Option< unsafe extern "C" fn( *mut libc::c_void, size_t, @@ -4215,12 +4068,10 @@ pub type br_tls_prf_impl = Option::< ) -> (), >; pub type br_prng_class = br_prng_class_; -pub type br_prng_seeder = Option::< - unsafe extern "C" fn(*mut *const br_prng_class) -> libc::c_int, ->; +pub type br_prng_seeder = Option libc::c_int>; // option hyper -pub type Curl_datastream = Option::< +pub type Curl_datastream = Option< unsafe extern "C" fn( *mut Curl_easy, *mut connectdata, @@ -4243,21 +4094,11 @@ pub const HYPER_TASK_RESPONSE: hyper_task_return_type = 3; pub const HYPER_TASK_CLIENTCONN: hyper_task_return_type = 2; pub const HYPER_TASK_ERROR: hyper_task_return_type = 1; pub const HYPER_TASK_EMPTY: hyper_task_return_type = 0; -pub type hyper_io_read_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut hyper_context, - *mut uint8_t, - size_t, - ) -> size_t, +pub type hyper_io_read_callback = Option< + unsafe extern "C" fn(*mut libc::c_void, *mut hyper_context, *mut uint8_t, size_t) -> size_t, >; -pub type hyper_io_write_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut hyper_context, - *const uint8_t, - size_t, - ) -> size_t, +pub type hyper_io_write_callback = Option< + unsafe extern "C" fn(*mut libc::c_void, *mut hyper_context, *const uint8_t, size_t) -> size_t, >; // option libssh2 diff --git a/rust/rust_ffi/src/ffi_fun/fun_call.rs b/rust/rust_ffi/src/ffi_fun/fun_call.rs index 6376bd70b740d1a3a80117fd681a0a1ecd787f49..0e56e868125e229e133bc1ab46fc19afe61a3b69 100644 --- a/rust/rust_ffi/src/ffi_fun/fun_call.rs +++ b/rust/rust_ffi/src/ffi_fun/fun_call.rs @@ -8,7 +8,7 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: pnext, + * Author: pnext, * Create: 2022-10-31 * Description: extern C function declarations that ffi needed ******************************************************************************/ @@ -35,11 +35,7 @@ extern "C" { pub fn strlen(_: *const libc::c_char) -> libc::c_ulong; // vtls.rs - pub fn memcmp( - _: *const libc::c_void, - _: *const libc::c_void, - _: libc::c_ulong, - ) -> libc::c_int; + pub fn memcmp(_: *const libc::c_void, _: *const libc::c_void, _: libc::c_ulong) -> libc::c_int; pub fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int; pub fn Curl_safe_strcasecompare( first: *const libc::c_char, @@ -55,18 +51,16 @@ extern "C" { ) -> libc::c_int; pub fn Curl_sec_end(_: *mut connectdata); pub fn Curl_sec_login(_: *mut Curl_easy, _: *mut connectdata) -> CURLcode; - pub fn Curl_sec_request_prot(conn: *mut connectdata, level: *const libc::c_char) -> libc::c_int; + pub fn Curl_sec_request_prot(conn: *mut connectdata, level: *const libc::c_char) + -> libc::c_int; pub fn strcpy(_: *mut libc::c_char, _: *const libc::c_char) -> *mut libc::c_char; pub fn strncpy( _: *mut libc::c_char, _: *const libc::c_char, _: libc::c_ulong, ) -> *mut libc::c_char; - pub fn strncmp( - _: *const libc::c_char, - _: *const libc::c_char, - _: libc::c_ulong, - ) -> libc::c_int; + pub fn strncmp(_: *const libc::c_char, _: *const libc::c_char, _: libc::c_ulong) + -> libc::c_int; pub fn bind(__fd: libc::c_int, __addr: *const sockaddr, __len: socklen_t) -> libc::c_int; pub fn getsockname( __fd: libc::c_int, @@ -109,11 +103,7 @@ extern "C" { ) -> *const libc::c_char; pub fn Curl_now() -> curltime; pub fn Curl_timediff(t1: curltime, t2: curltime) -> timediff_t; - pub fn Curl_llist_remove( - _: *mut Curl_llist, - _: *mut Curl_llist_element, - _: *mut libc::c_void, - ); + pub fn Curl_llist_remove(_: *mut Curl_llist, _: *mut Curl_llist_element, _: *mut libc::c_void); pub fn Curl_resolver_wait_resolv( data: *mut Curl_easy, dnsentry: *mut *mut Curl_dns_entry, @@ -336,11 +326,7 @@ extern "C" { pub fn Curl_strntoupper(dest: *mut libc::c_char, src: *const libc::c_char, n: size_t); pub fn Curl_strntolower(dest: *mut libc::c_char, src: *const libc::c_char, n: size_t); pub fn Curl_memdup(src: *const libc::c_void, buffer_length: size_t) -> *mut libc::c_void; - pub fn Curl_sha256it( - outbuffer: *mut libc::c_uchar, - input: *const libc::c_uchar, - len: size_t, - ); + pub fn Curl_sha256it(outbuffer: *mut libc::c_uchar, input: *const libc::c_uchar, len: size_t); pub fn Curl_hmacit( hashparams: *const HMAC_params, key: *const libc::c_uchar, @@ -461,11 +447,7 @@ extern "C" { _: *const libc::c_void, _: libc::c_ulong, ) -> *mut libc::c_void; - pub fn memchr( - _: *const libc::c_void, - _: libc::c_int, - _: libc::c_ulong, - ) -> *mut libc::c_void; + pub fn memchr(_: *const libc::c_void, _: libc::c_int, _: libc::c_ulong) -> *mut libc::c_void; pub fn curl_mime_headers( part: *mut curl_mimepart, headers: *mut curl_slist, @@ -510,10 +492,7 @@ extern "C" { post: *mut curl_httppost, fread_func: curl_read_callback, ) -> CURLcode; - pub fn Curl_rtsp_parseheader( - data: *mut Curl_easy, - header: *mut libc::c_char, - ) -> CURLcode; + pub fn Curl_rtsp_parseheader(data: *mut Curl_easy, header: *mut libc::c_char) -> CURLcode; pub fn Curl_readrewind(data: *mut Curl_easy) -> CURLcode; pub fn Curl_meets_timecondition(data: *mut Curl_easy, timeofdoc: time_t) -> bool; pub fn Curl_done_sending(data: *mut Curl_easy, k: *mut SingleRequest) -> CURLcode; @@ -537,11 +516,8 @@ extern "C" { uripath: *const libc::c_uchar, ) -> CURLcode; pub fn Curl_output_aws_sigv4(data: *mut Curl_easy, proxy: bool) -> CURLcode; - pub fn Curl_share_lock( - _: *mut Curl_easy, - _: curl_lock_data, - _: curl_lock_access, - ) -> CURLSHcode; + pub fn Curl_share_lock(_: *mut Curl_easy, _: curl_lock_data, _: curl_lock_access) + -> CURLSHcode; pub fn Curl_share_unlock(_: *mut Curl_easy, _: curl_lock_data) -> CURLSHcode; pub fn Curl_expire_done(data: *mut Curl_easy, id: expire_id); pub fn Curl_strncasecompare( @@ -590,7 +566,7 @@ extern "C" { outlen: *mut size_t, ) -> CURLcode; pub fn Curl_auth_digest_cleanup(digest: *mut digestdata); - + // http2.rs pub fn curl_easy_duphandle(curl: *mut CURL) -> *mut CURL; pub fn curl_url() -> *mut CURLU; @@ -709,9 +685,7 @@ extern "C" { flags: uint8_t, opaque_data: *const uint8_t, ) -> libc::c_int; - pub fn nghttp2_session_check_request_allowed( - session: *mut nghttp2_session, - ) -> libc::c_int; + pub fn nghttp2_session_check_request_allowed(session: *mut nghttp2_session) -> libc::c_int; pub fn nghttp2_session_set_local_window_size( session: *mut nghttp2_session, flags: uint8_t, @@ -739,18 +713,14 @@ extern "C" { pub fn Curl_connalive(conn: *mut connectdata) -> bool; pub fn Curl_saferealloc(ptr: *mut libc::c_void, size: size_t) -> *mut libc::c_void; - // mbedtls ftp - + // mbedtls ftp + pub fn Curl_ssl_connect( data: *mut Curl_easy, conn: *mut connectdata, sockindex: libc::c_int, ) -> CURLcode; - pub fn Curl_ssl_close( - data: *mut Curl_easy, - conn: *mut connectdata, - sockindex: libc::c_int, - ); + pub fn Curl_ssl_close(data: *mut Curl_easy, conn: *mut connectdata, sockindex: libc::c_int); pub fn Curl_ssl_shutdown( data: *mut Curl_easy, conn: *mut connectdata, @@ -770,7 +740,7 @@ extern "C" { br: *mut bufref, ptr: *const libc::c_void, len: size_t, - dtor: Option:: ()>, + dtor: Option ()>, ); pub fn Curl_bufref_ptr(br: *const bufref) -> *const libc::c_uchar; pub fn Curl_bufref_len(br: *const bufref) -> size_t; @@ -800,7 +770,7 @@ extern "C" { out: *mut bufref, ) -> CURLcode; #[cfg(USE_NTLM)] - pub fn Curl_auth_cleanup_ntlm(ntlm: *mut ntlmdata); + pub fn Curl_auth_cleanup_ntlm(ntlm: *mut ntlmdata); // new http_proxy.rs pub fn Curl_ssl_connect_nonblocking( @@ -842,8 +812,11 @@ extern "C" { proxy: bool, header: *const libc::c_char, ) -> CURLcode; - pub fn Curl_output_negotiate(data: *mut Curl_easy, conn: *mut connectdata, proxy: bool) - -> CURLcode; + pub fn Curl_output_negotiate( + data: *mut Curl_easy, + conn: *mut connectdata, + proxy: bool, + ) -> CURLcode; // mbedtls vtls.rs pub fn fread( @@ -852,20 +825,11 @@ extern "C" { _: libc::c_ulong, _: *mut FILE, ) -> libc::c_ulong; - pub fn fseek( - __stream: *mut FILE, - __off: libc::c_long, - __whence: libc::c_int, - ) -> libc::c_int; + pub fn fseek(__stream: *mut FILE, __off: libc::c_long, __whence: libc::c_int) -> libc::c_int; pub fn ftell(__stream: *mut FILE) -> libc::c_long; - - pub fn curl_slist_free_all(_: *mut curl_slist); - pub fn memset( - _: *mut libc::c_void, - _: libc::c_int, - _: libc::c_ulong, - ) -> *mut libc::c_void; + pub fn curl_slist_free_all(_: *mut curl_slist); + pub fn memset(_: *mut libc::c_void, _: libc::c_int, _: libc::c_ulong) -> *mut libc::c_void; pub fn Curl_slist_append_nodup( list: *mut curl_slist, @@ -885,8 +849,7 @@ extern "C" { len: size_t, code: *mut CURLcode, ) -> ssize_t; - - + // mbedtls_threadlock.rs pub fn pthread_mutex_init( __mutex: *mut pthread_mutex_t, @@ -934,12 +897,8 @@ extern "C" { ssl: *const mbedtls_ssl_context, session: *mut mbedtls_ssl_session, ) -> libc::c_int; - pub fn mbedtls_ssl_get_peer_cert( - ssl: *const mbedtls_ssl_context, - ) -> *const mbedtls_x509_crt; - pub fn mbedtls_ssl_get_ciphersuite( - ssl: *const mbedtls_ssl_context, - ) -> *const libc::c_char; + pub fn mbedtls_ssl_get_peer_cert(ssl: *const mbedtls_ssl_context) -> *const mbedtls_x509_crt; + pub fn mbedtls_ssl_get_ciphersuite(ssl: *const mbedtls_ssl_context) -> *const libc::c_char; pub fn mbedtls_ssl_get_verify_result(ssl: *const mbedtls_ssl_context) -> uint32_t; pub fn mbedtls_ssl_get_bytes_avail(ssl: *const mbedtls_ssl_context) -> size_t; pub fn mbedtls_ssl_conf_renegotiation( @@ -960,9 +919,7 @@ extern "C" { major: libc::c_int, minor: libc::c_int, ); - pub fn mbedtls_ssl_get_alpn_protocol( - ssl: *const mbedtls_ssl_context, - ) -> *const libc::c_char; + pub fn mbedtls_ssl_get_alpn_protocol(ssl: *const mbedtls_ssl_context) -> *const libc::c_char; pub fn mbedtls_ssl_conf_alpn_protocols( conf: *mut mbedtls_ssl_config, protos: *mut *const libc::c_char, @@ -996,18 +953,14 @@ extern "C" { pub fn mbedtls_ssl_set_bio( ssl: *mut mbedtls_ssl_context, p_bio: *mut libc::c_void, - f_send: Option::, - f_recv: Option::, - f_recv_timeout: Option::, + f_send: Option, + f_recv: Option, + f_recv_timeout: Option, ); pub fn mbedtls_ssl_conf_rng( conf: *mut mbedtls_ssl_config, - f_rng: Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut libc::c_uchar, - size_t, - ) -> libc::c_int, + f_rng: Option< + unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_uchar, size_t) -> libc::c_int, >, p_rng: *mut libc::c_void, ); @@ -1084,12 +1037,8 @@ extern "C" { pub fn mbedtls_ctr_drbg_init(ctx: *mut mbedtls_ctr_drbg_context); pub fn mbedtls_ctr_drbg_seed( ctx: *mut mbedtls_ctr_drbg_context, - f_entropy: Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut libc::c_uchar, - size_t, - ) -> libc::c_int, + f_entropy: Option< + unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_uchar, size_t) -> libc::c_int, >, p_entropy: *mut libc::c_void, custom: *const libc::c_uchar, @@ -1113,7 +1062,6 @@ extern "C" { pub fn Curl_mbedtlsthreadlock_lock_function(n: libc::c_int) -> libc::c_int; pub fn Curl_mbedtlsthreadlock_unlock_function(n: libc::c_int) -> libc::c_int; - // gnutls gnutls.rs pub fn send( __fd: libc::c_int, @@ -1127,9 +1075,7 @@ extern "C" { __n: size_t, __flags: libc::c_int, ) -> ssize_t; - pub fn gnutls_pk_algorithm_get_name( - algorithm: gnutls_pk_algorithm_t, - ) -> *const libc::c_char; + pub fn gnutls_pk_algorithm_get_name(algorithm: gnutls_pk_algorithm_t) -> *const libc::c_char; pub fn gnutls_init(session: *mut gnutls_session_t, flags: libc::c_uint) -> libc::c_int; pub fn gnutls_deinit(session: gnutls_session_t); pub fn gnutls_bye(session: gnutls_session_t, how: gnutls_close_request_t) -> libc::c_int; @@ -1295,10 +1241,8 @@ extern "C" { cert: gnutls_x509_crt_t, dn: *mut gnutls_datum_t, ) -> libc::c_int; - pub fn gnutls_x509_crt_get_dn2( - cert: gnutls_x509_crt_t, - dn: *mut gnutls_datum_t, - ) -> libc::c_int; + pub fn gnutls_x509_crt_get_dn2(cert: gnutls_x509_crt_t, dn: *mut gnutls_datum_t) + -> libc::c_int; pub fn gnutls_x509_crt_get_dn_by_oid( cert: gnutls_x509_crt_t, oid: *const libc::c_char, @@ -1343,7 +1287,7 @@ extern "C" { beg: *const libc::c_char, end: *const libc::c_char, ) -> CURLcode; - + pub fn gnutls_ocsp_resp_init(resp: *mut gnutls_ocsp_resp_t) -> libc::c_int; pub fn gnutls_ocsp_resp_deinit(resp: gnutls_ocsp_resp_t); pub fn gnutls_ocsp_resp_import( @@ -1363,7 +1307,7 @@ extern "C" { revocation_time: *mut time_t, revocation_reason: *mut libc::c_uint, ) -> libc::c_int; - + // wolfssl.rs // pub fn Curl_none_check_cxn(conn: *mut connectdata) -> libc::c_int; @@ -1438,14 +1382,8 @@ extern "C" { _: *const libc::c_char, _: *const libc::c_char, ) -> libc::c_int; - pub fn wolfSSL_CTX_set_cipher_list( - _: *mut WOLFSSL_CTX, - _: *const libc::c_char, - ) -> libc::c_int; - pub fn wolfSSL_CTX_SetMinVersion( - ctx: *mut WOLFSSL_CTX, - version: libc::c_int, - ) -> libc::c_int; + pub fn wolfSSL_CTX_set_cipher_list(_: *mut WOLFSSL_CTX, _: *const libc::c_char) -> libc::c_int; + pub fn wolfSSL_CTX_SetMinVersion(ctx: *mut WOLFSSL_CTX, version: libc::c_int) -> libc::c_int; pub fn wolfSSL_CTX_new(_: *mut WOLFSSL_METHOD) -> *mut WOLFSSL_CTX; pub fn wolfTLSv1_2_client_method() -> *mut WOLFSSL_METHOD; pub fn wolfTLSv1_1_client_method() -> *mut WOLFSSL_METHOD; @@ -1457,16 +1395,10 @@ extern "C" { pub fn wolfSSL_lib_version() -> *const libc::c_char; pub fn wolfSSL_Cleanup() -> libc::c_int; pub fn wolfSSL_Init() -> libc::c_int; - pub fn wolfSSL_check_domain_name( - ssl: *mut WOLFSSL, - dn: *const libc::c_char, - ) -> libc::c_int; + pub fn wolfSSL_check_domain_name(ssl: *mut WOLFSSL, dn: *const libc::c_char) -> libc::c_int; pub fn wolfSSL_new(_: *mut WOLFSSL_CTX) -> *mut WOLFSSL; pub fn wolfSSL_KeepArrays(_: *mut WOLFSSL); - pub fn wolfSSL_set_session( - ssl: *mut WOLFSSL, - session: *mut WOLFSSL_SESSION, - ) -> libc::c_int; + pub fn wolfSSL_set_session(ssl: *mut WOLFSSL, session: *mut WOLFSSL_SESSION) -> libc::c_int; pub fn wolfSSL_set_fd(_: *mut WOLFSSL, _: libc::c_int) -> libc::c_int; pub fn wolfSSL_connect(_: *mut WOLFSSL) -> libc::c_int; pub fn wolfSSL_want_read(_: *mut WOLFSSL) -> libc::c_int; @@ -1483,29 +1415,15 @@ extern "C" { ) -> libc::c_int; pub fn wolfSSL_FreeArrays(_: *mut WOLFSSL); pub fn wolfSSL_get_peer_certificate(ssl: *mut WOLFSSL) -> *mut WOLFSSL_X509; - pub fn wolfSSL_X509_get_der( - _: *mut WOLFSSL_X509, - _: *mut libc::c_int, - ) -> *const libc::c_uchar; + pub fn wolfSSL_X509_get_der(_: *mut WOLFSSL_X509, _: *mut libc::c_int) -> *const libc::c_uchar; pub fn wolfSSL_get_version(_: *mut WOLFSSL) -> *const libc::c_char; pub fn wolfSSL_get_cipher_name(ssl: *mut WOLFSSL) -> *const libc::c_char; pub fn wolfSSL_get_session(ssl: *mut WOLFSSL) -> *mut WOLFSSL_SESSION; pub fn wolfSSL_ERR_clear_error(); - pub fn wolfSSL_write( - _: *mut WOLFSSL, - _: *const libc::c_void, - _: libc::c_int, - ) -> libc::c_int; - pub fn wolfSSL_ERR_error_string( - _: libc::c_ulong, - _: *mut libc::c_char, - ) -> *mut libc::c_char; + pub fn wolfSSL_write(_: *mut WOLFSSL, _: *const libc::c_void, _: libc::c_int) -> libc::c_int; + pub fn wolfSSL_ERR_error_string(_: libc::c_ulong, _: *mut libc::c_char) -> *mut libc::c_char; pub fn wolfSSL_get_error(_: *mut WOLFSSL, _: libc::c_int) -> libc::c_int; - pub fn wolfSSL_read( - _: *mut WOLFSSL, - _: *mut libc::c_void, - _: libc::c_int, - ) -> libc::c_int; + pub fn wolfSSL_read(_: *mut WOLFSSL, _: *mut libc::c_void, _: libc::c_int) -> libc::c_int; pub fn wolfSSL_shutdown(_: *mut WOLFSSL) -> libc::c_int; pub fn wolfSSL_free(_: *mut WOLFSSL); pub fn wolfSSL_CTX_free(_: *mut WOLFSSL_CTX); @@ -1531,10 +1449,7 @@ extern "C" { pub fn PR_ErrorToName(code: PRErrorCode) -> *const libc::c_char; pub fn PR_GetError() -> PRErrorCode; pub fn PR_Lock(lock: *mut PRLock); - pub fn PR_ErrorToString( - code: PRErrorCode, - language: PRLanguageCode, - ) -> *const libc::c_char; + pub fn PR_ErrorToString(code: PRErrorCode, language: PRLanguageCode) -> *const libc::c_char; pub fn PR_Now() -> PRTime; pub fn PR_Free(ptr: *mut libc::c_void); pub fn PR_FormatTime( @@ -1544,11 +1459,7 @@ extern "C" { time: *const PRExplodedTime, ) -> PRUint32; pub fn PR_GMTParameters(gmt: *const PRExplodedTime) -> PRTimeParameters; - pub fn PR_ExplodeTime( - usecs: PRTime, - params: PRTimeParamFn, - exploded: *mut PRExplodedTime, - ); + pub fn PR_ExplodeTime(usecs: PRTime, params: PRTimeParamFn, exploded: *mut PRExplodedTime); pub fn PR_Unlock(lock: *mut PRLock) -> PRStatus; pub fn PR_MillisecondsToInterval(milli: PRUint32) -> PRIntervalTime; pub fn PR_Init(type_0: PRThreadType, priority: PRThreadPriority, maxPTDs: PRUintn); @@ -1573,11 +1484,7 @@ extern "C" { methods: *const PRIOMethods, ) -> *mut PRFileDesc; pub fn PR_GetUniqueIdentity(layer_name: *const libc::c_char) -> PRDescIdentity; - pub fn PR_Open( - name: *const libc::c_char, - flags: PRIntn, - mode: PRIntn, - ) -> *mut PRFileDesc; + pub fn PR_Open(name: *const libc::c_char, flags: PRIntn, mode: PRIntn) -> *mut PRFileDesc; pub fn PR_NewTCPSocket() -> *mut PRFileDesc; pub fn PR_Recv( fd: *mut PRFileDesc, @@ -1593,10 +1500,7 @@ extern "C" { flags: PRIntn, timeout: PRIntervalTime, ) -> PRInt32; - pub fn PR_SetSocketOption( - fd: *mut PRFileDesc, - data: *const PRSocketOptionData, - ) -> PRStatus; + pub fn PR_SetSocketOption(fd: *mut PRFileDesc, data: *const PRSocketOptionData) -> PRStatus; pub fn NSS_ShutdownContext(_: *mut NSSInitContext) -> SECStatus; pub fn NSS_GetVersion() -> *const libc::c_char; pub fn PORT_Strdup(s: *const libc::c_char) -> *mut libc::c_char; @@ -1616,17 +1520,10 @@ extern "C" { protocolVariant: SSLProtocolVariant, vrange: *mut SSLVersionRange, ) -> SECStatus; - pub fn SSL_VersionRangeSet( - fd: *mut PRFileDesc, - vrange: *const SSLVersionRange, - ) -> SECStatus; + pub fn SSL_VersionRangeSet(fd: *mut PRFileDesc, vrange: *const SSLVersionRange) -> SECStatus; pub fn SSL_GetNumImplementedCiphers() -> PRUint16; pub fn SSL_GetImplementedCiphers() -> *const PRUint16; - pub fn SSL_CipherPrefSet( - fd: *mut PRFileDesc, - cipher: PRInt32, - enabled: PRBool, - ) -> SECStatus; + pub fn SSL_CipherPrefSet(fd: *mut PRFileDesc, cipher: PRInt32, enabled: PRBool) -> SECStatus; pub fn SSL_AuthCertificateHook( fd: *mut PRFileDesc, f: SSLAuthCertificate, @@ -1657,10 +1554,7 @@ extern "C" { len: libc::c_uint, ) -> *mut SECItem; pub fn CERT_CacheCRL(dbhandle: *mut CERTCertDBHandle, newcrl: *mut SECItem) -> SECStatus; - pub fn CERT_UncacheCRL( - dbhandle: *mut CERTCertDBHandle, - oldcrl: *mut SECItem, - ) -> SECStatus; + pub fn CERT_UncacheCRL(dbhandle: *mut CERTCertDBHandle, oldcrl: *mut SECItem) -> SECStatus; pub fn CERT_GetDefaultCertDB() -> *mut CERTCertDBHandle; pub fn SSL_ClearSessionCache(); pub fn SSL_GetClientAuthDataHook( @@ -1696,10 +1590,8 @@ extern "C" { ) -> SECStatus; pub fn SSL_ResetHandshake(fd: *mut PRFileDesc, asServer: PRBool) -> SECStatus; pub fn SSL_SetURL(fd: *mut PRFileDesc, url: *const libc::c_char) -> SECStatus; - pub fn SSL_ForceHandshakeWithTimeout( - fd: *mut PRFileDesc, - timeout: PRIntervalTime, - ) -> SECStatus; + pub fn SSL_ForceHandshakeWithTimeout(fd: *mut PRFileDesc, timeout: PRIntervalTime) + -> SECStatus; pub fn SSL_GetChannelInfo( fd: *mut PRFileDesc, info: *mut SSLChannelInfo, @@ -1862,9 +1754,7 @@ extern "C" { userdata: *mut libc::c_void, out_n: *mut size_t, ) -> rustls_io_result; - pub fn rustls_connection_process_new_packets( - conn: *mut rustls_connection, - ) -> rustls_result; + pub fn rustls_connection_process_new_packets(conn: *mut rustls_connection) -> rustls_result; pub fn rustls_connection_wants_read(conn: *const rustls_connection) -> bool; pub fn rustls_connection_wants_write(conn: *const rustls_connection) -> bool; pub fn rustls_connection_is_handshaking(conn: *const rustls_connection) -> bool; @@ -1941,7 +1831,7 @@ extern "C" { pub fn mesalink_SSL_CTX_set_verify( _: *mut MESALINK_CTX, _: libc::c_int, - cb: Option:: libc::c_int>, + cb: Option libc::c_int>, ) -> libc::c_int; pub fn mesalink_SSL_new(_: *mut MESALINK_CTX) -> *mut MESALINK_SSL; pub fn mesalink_SSL_set_tlsext_host_name( @@ -1972,7 +1862,7 @@ extern "C" { len: size_t, ) -> *const libc::c_char; pub fn mesalink_ERR_print_errors_fp(_: *const FILE); - // openssl.rs + // openssl.rs pub fn Curl_wait_ms(timeout_ms: timediff_t) -> libc::c_int; // pub fn Curl_none_false_start() -> bool; pub fn curl_slist_append(_: *mut curl_slist, _: *const libc::c_char) -> *mut curl_slist; @@ -2028,17 +1918,14 @@ extern "C" { pub fn EVP_PKEY_get0_DH(pkey: *mut EVP_PKEY) -> *mut dh_st; pub fn EVP_PKEY_free(pkey: *mut EVP_PKEY); pub fn EVP_PKEY_copy_parameters(to: *mut EVP_PKEY, from: *const EVP_PKEY) -> libc::c_int; - pub fn OPENSSL_init_ssl( - opts: uint64_t, - settings: *const OPENSSL_INIT_SETTINGS, - ) -> libc::c_int; + pub fn OPENSSL_init_ssl(opts: uint64_t, settings: *const OPENSSL_INIT_SETTINGS) -> libc::c_int; pub fn SSL_get_shutdown(ssl: *const SSL) -> libc::c_int; pub fn SSL_pending(s: *const SSL) -> libc::c_int; pub fn TLS_client_method() -> *const SSL_METHOD; pub fn SSL_CTX_new(meth: *const SSL_METHOD) -> *mut SSL_CTX; pub fn SSL_CTX_set_msg_callback( ctx: *mut SSL_CTX, - cb: Option::< + cb: Option< unsafe extern "C" fn( libc::c_int, libc::c_int, @@ -2063,11 +1950,11 @@ extern "C" { protos_len: libc::c_uint, ) -> libc::c_int; pub fn SSL_CTX_set_default_passwd_cb_userdata(ctx: *mut SSL_CTX, u: *mut libc::c_void); - pub fn SSL_CTX_set_default_passwd_cb(ctx: *mut SSL_CTX, cb: Option::); + pub fn SSL_CTX_set_default_passwd_cb(ctx: *mut SSL_CTX, cb: Option); pub fn PEM_read_bio_X509_AUX( bp: *mut BIO, x: *mut *mut X509, - cb: Option::, + cb: Option, u: *mut libc::c_void, ) -> *mut X509; pub fn SSL_CTX_use_certificate_chain_file( @@ -2086,7 +1973,7 @@ extern "C" { pub fn PEM_read_bio_PrivateKey( bp: *mut BIO, x: *mut *mut EVP_PKEY, - cb: Option::, + cb: Option, u: *mut libc::c_void, ) -> *mut EVP_PKEY; pub fn d2i_PrivateKey_bio(bp: *mut BIO, a: *mut *mut EVP_PKEY) -> *mut EVP_PKEY; @@ -2101,31 +1988,22 @@ extern "C" { pub fn RSA_free(r: *mut RSA); pub fn SSL_get_privatekey(ssl: *const SSL) -> *mut evp_pkey_st; pub fn SSL_CTX_check_private_key(ctx: *const SSL_CTX) -> libc::c_int; - pub fn SSL_CTX_set_ciphersuites( - ctx: *mut SSL_CTX, - str: *const libc::c_char, - ) -> libc::c_int; + pub fn SSL_CTX_set_ciphersuites(ctx: *mut SSL_CTX, str: *const libc::c_char) -> libc::c_int; pub fn SSL_CTX_set_post_handshake_auth(ctx: *mut SSL_CTX, val: libc::c_int); - pub fn SSL_CTX_set_srp_username( - ctx: *mut SSL_CTX, - name: *mut libc::c_char, - ) -> libc::c_int; - pub fn SSL_CTX_set_srp_password( - ctx: *mut SSL_CTX, - password: *mut libc::c_char, - ) -> libc::c_int; + pub fn SSL_CTX_set_srp_username(ctx: *mut SSL_CTX, name: *mut libc::c_char) -> libc::c_int; + pub fn SSL_CTX_set_srp_password(ctx: *mut SSL_CTX, password: *mut libc::c_char) -> libc::c_int; pub fn SSL_CTX_set_cipher_list(_: *mut SSL_CTX, str: *const libc::c_char) -> libc::c_int; pub fn PEM_X509_INFO_read_bio( bp: *mut BIO, sk: *mut stack_st_X509_INFO, - cb: Option::, + cb: Option, u: *mut libc::c_void, ) -> *mut stack_st_X509_INFO; pub fn X509_STORE_add_cert(ctx: *mut X509_STORE, x: *mut X509) -> libc::c_int; pub fn X509_STORE_add_crl(ctx: *mut X509_STORE, x: *mut X509_CRL) -> libc::c_int; pub fn OPENSSL_sk_pop_free( st: *mut OPENSSL_STACK, - func: Option:: ()>, + func: Option ()>, ); pub fn X509_INFO_free(a: *mut X509_INFO); pub fn SSL_CTX_load_verify_locations( @@ -2154,9 +2032,7 @@ extern "C" { ) -> libc::c_long; pub fn SSL_CTX_sess_set_new_cb( ctx: *mut SSL_CTX, - new_session_cb: Option::< - unsafe extern "C" fn(*mut ssl_st, *mut SSL_SESSION) -> libc::c_int, - >, + new_session_cb: Option libc::c_int>, ); pub fn SSL_get_ex_data(ssl: *const SSL, idx: libc::c_int) -> *mut libc::c_void; pub fn SSL_new(ctx: *mut SSL_CTX) -> *mut SSL; @@ -2212,22 +2088,14 @@ extern "C" { q: *mut *const BIGNUM, g: *mut *const BIGNUM, ); - pub fn DSA_get0_key( - d: *const DSA, - pub_key: *mut *const BIGNUM, - priv_key: *mut *const BIGNUM, - ); + pub fn DSA_get0_key(d: *const DSA, pub_key: *mut *const BIGNUM, priv_key: *mut *const BIGNUM); pub fn DH_get0_pqg( dh: *const DH, p: *mut *const BIGNUM, q: *mut *const BIGNUM, g: *mut *const BIGNUM, ); - pub fn DH_get0_key( - dh: *const DH, - pub_key: *mut *const BIGNUM, - priv_key: *mut *const BIGNUM, - ); + pub fn DH_get0_key(dh: *const DH, pub_key: *mut *const BIGNUM, priv_key: *mut *const BIGNUM); pub fn BN_print(bio: *mut BIO, a: *const BIGNUM) -> libc::c_int; pub fn BIO_printf(bio: *mut BIO, format: *const libc::c_char, _: ...) -> libc::c_int; pub fn PEM_write_bio_X509(bp: *mut BIO, x: *mut X509) -> libc::c_int; @@ -2258,10 +2126,7 @@ extern "C" { in_0: *const ASN1_STRING, ) -> libc::c_int; pub fn X509_NAME_ENTRY_get_data(ne: *const X509_NAME_ENTRY) -> *mut ASN1_STRING; - pub fn X509_NAME_get_entry( - name: *const X509_NAME, - loc: libc::c_int, - ) -> *mut X509_NAME_ENTRY; + pub fn X509_NAME_get_entry(name: *const X509_NAME, loc: libc::c_int) -> *mut X509_NAME_ENTRY; pub fn X509_get_subject_name(a: *const X509) -> *mut X509_NAME; pub fn CRYPTO_free(ptr: *mut libc::c_void, file: *const libc::c_char, line: libc::c_int); pub fn X509_NAME_print_ex( @@ -2284,7 +2149,7 @@ extern "C" { pub fn PEM_read_bio_X509( bp: *mut BIO, x: *mut *mut X509, - cb: Option::, + cb: Option, u: *mut libc::c_void, ) -> *mut X509; pub fn BIO_free(a: *mut BIO) -> libc::c_int; @@ -2304,11 +2169,7 @@ extern "C" { pub fn i2d_X509_PUBKEY(a: *mut X509_PUBKEY, out: *mut *mut libc::c_uchar) -> libc::c_int; pub fn X509_get_X509_PUBKEY(x: *const X509) -> *mut X509_PUBKEY; pub fn X509_free(a: *mut X509); - pub fn SSL_write( - ssl: *mut SSL, - buf: *const libc::c_void, - num: libc::c_int, - ) -> libc::c_int; + pub fn SSL_write(ssl: *mut SSL, buf: *const libc::c_void, num: libc::c_int) -> libc::c_int; pub fn SSL_get_error(s: *const SSL, ret_code: libc::c_int) -> libc::c_int; pub fn OpenSSL_version_num() -> libc::c_ulong; pub fn SSL_read(ssl: *mut SSL, buf: *mut libc::c_void, num: libc::c_int) -> libc::c_int; @@ -2317,18 +2178,15 @@ extern "C" { pub fn SSL_free(ssl: *mut SSL); pub fn SSL_CTX_free(_: *mut SSL_CTX); pub fn SSL_SESSION_free(ses: *mut SSL_SESSION); - pub fn SSL_set_ex_data( - ssl: *mut SSL, - idx: libc::c_int, - data: *mut libc::c_void, - ) -> libc::c_int; + pub fn SSL_set_ex_data(ssl: *mut SSL, idx: libc::c_int, data: *mut libc::c_void) + -> libc::c_int; pub fn CRYPTO_get_ex_new_index( class_index: libc::c_int, argl: libc::c_long, argp: *mut libc::c_void, - new_func: Option::, - dup_func: Option::, - free_func: Option::, + new_func: Option, + dup_func: Option, + free_func: Option, ) -> libc::c_int; pub fn RAND_bytes(buf: *mut libc::c_uchar, num: libc::c_int) -> libc::c_int; pub fn RAND_add(buf: *const libc::c_void, num: libc::c_int, randomness: libc::c_double); @@ -2405,14 +2263,14 @@ extern "C" { cmd: libc::c_int, i: libc::c_long, p: *mut libc::c_void, - f: Option:: ()>, + f: Option ()>, ) -> libc::c_int; pub fn ENGINE_ctrl_cmd( e: *mut ENGINE, cmd_name: *const libc::c_char, i: libc::c_long, p: *mut libc::c_void, - f: Option:: ()>, + f: Option ()>, cmd_optional: libc::c_int, ) -> libc::c_int; pub fn ENGINE_free(e: *mut ENGINE) -> libc::c_int; @@ -2430,33 +2288,33 @@ extern "C" { pub fn UI_get0_user_data(ui: *mut UI) -> *mut libc::c_void; pub fn UI_method_set_opener( method: *mut UI_METHOD, - opener: Option:: libc::c_int>, + opener: Option libc::c_int>, ) -> libc::c_int; pub fn UI_method_get_opener( method: *const UI_METHOD, - ) -> Option:: libc::c_int>; + ) -> Option libc::c_int>; pub fn UI_method_set_closer( method: *mut UI_METHOD, - closer: Option:: libc::c_int>, + closer: Option libc::c_int>, ) -> libc::c_int; pub fn UI_method_get_closer( method: *const UI_METHOD, - ) -> Option:: libc::c_int>; + ) -> Option libc::c_int>; pub fn UI_create_method(name: *const libc::c_char) -> *mut UI_METHOD; pub fn UI_destroy_method(ui_method: *mut UI_METHOD); pub fn UI_method_get_writer( method: *const UI_METHOD, - ) -> Option:: libc::c_int>; + ) -> Option libc::c_int>; pub fn UI_method_set_writer( method: *mut UI_METHOD, - writer: Option:: libc::c_int>, + writer: Option libc::c_int>, ) -> libc::c_int; pub fn UI_method_get_reader( method: *const UI_METHOD, - ) -> Option:: libc::c_int>; + ) -> Option libc::c_int>; pub fn UI_method_set_reader( method: *mut UI_METHOD, - reader: Option:: libc::c_int>, + reader: Option libc::c_int>, ) -> libc::c_int; pub fn UI_set_result( ui: *mut UI, @@ -2527,11 +2385,7 @@ extern "C" { len: *mut size_t, ) -> *mut libc::c_uchar; pub fn br_ssl_engine_recvapp_ack(cc: *mut br_ssl_engine_context, len: size_t); - pub fn br_sha224_update( - ctx: *mut br_sha224_context, - data: *const libc::c_void, - len: size_t, - ); + pub fn br_sha224_update(ctx: *mut br_sha224_context, data: *const libc::c_void, len: size_t); pub fn br_sha256_init(ctx: *mut br_sha256_context); pub fn br_sha256_out(ctx: *const br_sha256_context, out: *mut libc::c_void); pub fn br_ssl_engine_recvapp_buf( @@ -2545,7 +2399,7 @@ extern "C" { ); pub fn br_x509_decoder_init( ctx: *mut br_x509_decoder_context, - append_dn_0: Option::< + append_dn_0: Option< unsafe extern "C" fn(*mut libc::c_void, *const libc::c_void, size_t) -> (), >, append_dn_ctx: *mut libc::c_void, @@ -2581,11 +2435,8 @@ extern "C" { exec: *const hyper_executor, ); pub fn hyper_error_free(err: *mut hyper_error); - pub fn hyper_error_print( - err: *const hyper_error, - dst: *mut uint8_t, - dst_len: size_t, - ) -> size_t; + pub fn hyper_error_print(err: *const hyper_error, dst: *mut uint8_t, dst_len: size_t) + -> size_t; pub fn hyper_request_new() -> *mut hyper_request; pub fn hyper_request_set_method( req: *mut hyper_request, @@ -2597,10 +2448,7 @@ extern "C" { uri: *const uint8_t, uri_len: size_t, ) -> hyper_code; - pub fn hyper_request_set_version( - req: *mut hyper_request, - version: libc::c_int, - ) -> hyper_code; + pub fn hyper_request_set_version(req: *mut hyper_request, version: libc::c_int) -> hyper_code; pub fn hyper_request_headers(req: *mut hyper_request) -> *mut hyper_headers; pub fn hyper_io_new() -> *mut hyper_io; pub fn hyper_io_free(io: *mut hyper_io); @@ -2609,10 +2457,7 @@ extern "C" { pub fn hyper_io_set_write(io: *mut hyper_io, func: hyper_io_write_callback); pub fn hyper_executor_new() -> *const hyper_executor; pub fn hyper_executor_free(exec: *const hyper_executor); - pub fn hyper_executor_push( - exec: *const hyper_executor, - task: *mut hyper_task, - ) -> hyper_code; + pub fn hyper_executor_push(exec: *const hyper_executor, task: *mut hyper_task) -> hyper_code; pub fn hyper_executor_poll(exec: *const hyper_executor) -> *mut hyper_task; pub fn hyper_task_free(task: *mut hyper_task); pub fn hyper_task_value(task: *mut hyper_task) -> *mut libc::c_void; @@ -2661,10 +2506,7 @@ extern "C" { // libssh2 pub fn Curl_none_false_start() -> bool; - pub fn Curl_ssl_getsock( - conn: *mut connectdata, - socks: *mut curl_socket_t, - ) -> libc::c_int; + pub fn Curl_ssl_getsock(conn: *mut connectdata, socks: *mut curl_socket_t) -> libc::c_int; pub fn Curl_ssl_init_certinfo(data: *mut Curl_easy, num: libc::c_int) -> CURLcode; pub fn Curl_ssl_push_certinfo_len( data: *mut Curl_easy, @@ -2698,7 +2540,7 @@ extern "C" { pubkey: *const libc::c_uchar, pubkeylen: size_t, ) -> CURLcode; - + //debug pub fn __assert_fail( __assertion: *const libc::c_char, @@ -2706,11 +2548,7 @@ extern "C" { __line: libc::c_uint, __function: *const libc::c_char, ) -> !; - pub fn curl_dbg_free( - ptr: *mut libc::c_void, - line: libc::c_int, - source: *const libc::c_char, - ); + pub fn curl_dbg_free(ptr: *mut libc::c_void, line: libc::c_int, source: *const libc::c_char); pub fn curl_dbg_strdup( str: *const libc::c_char, line: libc::c_int, @@ -2722,4 +2560,4 @@ extern "C" { line: libc::c_int, source: *const libc::c_char, ) -> *mut libc::c_void; -} \ No newline at end of file +} diff --git a/rust/rust_ffi/src/ffi_fun/mod.rs b/rust/rust_ffi/src/ffi_fun/mod.rs index 1ef1654dc289ec34bf05709439661ee1d67b9ae8..90888ed466db3b0e2f0ce73b88a0f849ca79f768 100644 --- a/rust/rust_ffi/src/ffi_fun/mod.rs +++ b/rust/rust_ffi/src/ffi_fun/mod.rs @@ -8,7 +8,7 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: pnext, + * Author: pnext, * Create: 2022-10-31 * Description: Rust module declaration ******************************************************************************/ diff --git a/rust/rust_ffi/src/ffi_struct/mod.rs b/rust/rust_ffi/src/ffi_struct/mod.rs index 5cb64315feb2b059290ec491fbfb20f365669d54..a4264e32048bd33546a9ad7ec0cf4c99e0496d5b 100644 --- a/rust/rust_ffi/src/ffi_struct/mod.rs +++ b/rust/rust_ffi/src/ffi_struct/mod.rs @@ -8,7 +8,7 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: wyf, + * Author: wyf, * Create: 2022-10-31 * Description: Rust module declaration ******************************************************************************/ diff --git a/rust/rust_ffi/src/ffi_struct/struct_define.rs b/rust/rust_ffi/src/ffi_struct/struct_define.rs index dd1595b126322bd1b1f1659725ff285cb9e0687d..045f272d5e9e04298ec17ac685af7e3c54ea1989 100644 --- a/rust/rust_ffi/src/ffi_struct/struct_define.rs +++ b/rust/rust_ffi/src/ffi_struct/struct_define.rs @@ -8,12 +8,12 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: wyf, + * Author: wyf, * Create: 2022-10-31 * Description: extern C struct definitions that ffi needed ******************************************************************************/ -use c2rust_bitfields::BitfieldStruct; use crate::src::ffi_alias::type_alias::*; +use c2rust_bitfields::BitfieldStruct; // extern "C" { // pub type ssl_backend_data; @@ -152,7 +152,7 @@ pub struct sockaddr_storage { pub __ss_align: libc::c_ulong, } #[derive(Copy, Clone)] -#[repr(C)] +#[repr(C)] // cfg __USE_MISC pub struct tm { pub tm_sec: libc::c_int, @@ -192,7 +192,7 @@ pub struct Curl_easy { pub set: UserDefined, pub cookies: *mut CookieInfo, #[cfg(not(CURL_DISABLE_HSTS))] - pub hsts: *mut hsts, + pub hsts: *mut hsts, #[cfg(not(CURL_DISABLE_ALTSVC))] pub asi: *mut altsvcinfo, pub progress: Progress, @@ -201,7 +201,7 @@ pub struct Curl_easy { pub wildcard: WildcardData, pub info: PureInfo, pub tsi: curl_tlssessioninfo, - #[cfg(USE_HYPER)] + #[cfg(USE_HYPER)] pub hyp: hyptransfer, } #[cfg(USE_HYPER)] @@ -307,7 +307,7 @@ pub struct UrlState { pub scratch: *mut libc::c_char, pub followlocation: libc::c_long, #[cfg(HAVE_SIGNAL)] - pub prev_signal: Option:: ()>, + pub prev_signal: Option ()>, pub digest: digestdata, pub proxydigest: digestdata, pub authhost: auth, @@ -901,7 +901,7 @@ pub struct UserDefined { #[bitfield(name = "http09_allowed", ty = "bit", bits = "55..=55")] #[bitfield(name = "mail_rcpt_allowfails", ty = "bit", bits = "56..=56")] // pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: - // [u8; 8], + // [u8; 8], pub c2rust_abbr: [u8; 8], #[cfg(all(not(CURL_DISABLE_FTP), HAVE_GSSAPI))] #[bitfield(name = "is_fread_set", ty = "bit", bits = "0..=0")] @@ -1029,7 +1029,7 @@ pub struct UserDefined { #[bitfield(name = "http09_allowed", ty = "bit", bits = "56..=56")] #[bitfield(name = "mail_rcpt_allowfails", ty = "bit", bits = "57..=57")] // pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_socks5_gssapi_nec_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: - // [u8; 8], + // [u8; 8], pub c2rust_abbr: [u8; 8], } #[derive(Copy, Clone)] @@ -1122,15 +1122,9 @@ pub struct mime_encoder_state { #[repr(C)] pub struct mime_encoder { pub name: *const libc::c_char, - pub encodefunc: Option::< - unsafe extern "C" fn( - *mut libc::c_char, - size_t, - bool, - *mut curl_mimepart, - ) -> size_t, - >, - pub sizefunc: Option:: curl_off_t>, + pub encodefunc: + Option size_t>, + pub sizefunc: Option curl_off_t>, } #[derive(Copy, Clone)] #[repr(C)] @@ -1548,8 +1542,8 @@ pub struct connectdata { pub sock: [curl_socket_t; 2], pub tempsock: [curl_socket_t; 2], pub tempfamily: [libc::c_int; 2], - pub recv: [Option::; 2], - pub send: [Option::; 2], + pub recv: [Option; 2], + pub send: [Option; 2], pub ssl: [ssl_connect_data; 2], #[cfg(not(CURL_DISABLE_PROXY))] pub proxy_ssl: [ssl_connect_data; 2], @@ -1568,7 +1562,7 @@ pub struct connectdata { pub sockfd: curl_socket_t, pub writesockfd: curl_socket_t, #[cfg(HAVE_GSSAPI)] - #[bitfield(name = "sec_complete", ty = "bit", bits = "0..=0")] + #[bitfield(name = "sec_complete", ty = "bit", bits = "0..=0")] pub sec_complete: [u8; 1], #[cfg(HAVE_GSSAPI)] #[bitfield(padding)] @@ -1731,7 +1725,7 @@ pub struct SASLproto { pub contcode: libc::c_int, pub finalcode: libc::c_int, pub maxirlen: size_t, - pub sendauth: Option::< + pub sendauth: Option< unsafe extern "C" fn( *mut Curl_easy, *mut connectdata, @@ -1739,16 +1733,10 @@ pub struct SASLproto { *const libc::c_char, ) -> CURLcode, >, - pub sendcont: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *const libc::c_char, - ) -> CURLcode, - >, - pub getmessage: Option::< - unsafe extern "C" fn(*mut libc::c_char, *mut *mut libc::c_char) -> (), + pub sendcont: Option< + unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *const libc::c_char) -> CURLcode, >, + pub getmessage: Option ()>, } #[derive(Copy, Clone)] #[repr(C)] @@ -1764,10 +1752,8 @@ pub struct pingpong { pub response: curltime, pub response_time: timediff_t, pub sendbuf: dynbuf, - pub statemachine: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - >, - pub endofresp: Option::< + pub statemachine: Option CURLcode>, + pub endofresp: Option< unsafe extern "C" fn( *mut Curl_easy, *mut connectdata, @@ -1963,9 +1949,9 @@ pub struct ssh_conn { #[cfg(all(not(USE_LIBSSH), USE_LIBSSH2))] pub sftp_handle: *mut LIBSSH2_SFTP_HANDLE, #[cfg(all(not(USE_LIBSSH), USE_LIBSSH2, not(CURL_DISABLE_PROXY)))] - pub tls_recv: Option::, + pub tls_recv: Option, #[cfg(all(not(USE_LIBSSH), USE_LIBSSH2, not(CURL_DISABLE_PROXY)))] - pub tls_send: Option::, + pub tls_send: Option, #[cfg(all(not(USE_LIBSSH), USE_LIBSSH2))] pub ssh_agent: *mut LIBSSH2_AGENT, #[cfg(all(not(USE_LIBSSH), USE_LIBSSH2))] @@ -1987,9 +1973,9 @@ pub struct http_conn { #[cfg(USE_NGHTTP2)] pub h2: *mut nghttp2_session, #[cfg(USE_NGHTTP2)] - pub send_underlying: Option::, + pub send_underlying: Option, #[cfg(USE_NGHTTP2)] - pub recv_underlying: Option::, + pub recv_underlying: Option, #[cfg(USE_NGHTTP2)] pub inbuf: *mut libc::c_char, #[cfg(USE_NGHTTP2)] @@ -2054,68 +2040,35 @@ pub struct ftp_conn { #[repr(C)] pub struct Curl_handler { pub scheme: *const libc::c_char, - pub setup_connection: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - >, - pub do_it: Option:: CURLcode>, - pub done: Option:: CURLcode>, - pub do_more: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut libc::c_int) -> CURLcode, - >, - pub connect_it: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - >, - pub connecting: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, + pub setup_connection: + Option CURLcode>, + pub do_it: Option CURLcode>, + pub done: Option CURLcode>, + pub do_more: Option CURLcode>, + pub connect_it: Option CURLcode>, + pub connecting: Option CURLcode>, + pub doing: Option CURLcode>, + pub proto_getsock: Option< + unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, >, - pub doing: Option:: CURLcode>, - pub proto_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, + pub doing_getsock: Option< + unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, >, - pub doing_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, + pub domore_getsock: Option< + unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, >, - pub domore_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, + pub perform_getsock: Option< + unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, >, - pub perform_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, + pub disconnect: + Option CURLcode>, + pub readwrite: Option< + unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut ssize_t, *mut bool) -> CURLcode, >, - pub disconnect: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, bool) -> CURLcode, + pub connection_check: Option< + unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_uint) -> libc::c_uint, >, - pub readwrite: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut ssize_t, - *mut bool, - ) -> CURLcode, - >, - pub connection_check: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - libc::c_uint, - ) -> libc::c_uint, - >, - pub attach: Option:: ()>, + pub attach: Option ()>, pub defport: libc::c_int, pub protocol: libc::c_uint, pub family: libc::c_uint, @@ -2127,7 +2080,11 @@ pub struct ConnectBits { pub tcpconnect: [bool; 2], #[cfg(not(CURL_DISABLE_PROXY))] pub proxy_ssl_connected: [bool; 2], - #[cfg(all(not(CURL_DISABLE_PROXY), not(CURL_DISABLE_FTP), not(CURL_DISABLE_NETRC)))] + #[cfg(all( + not(CURL_DISABLE_PROXY), + not(CURL_DISABLE_FTP), + not(CURL_DISABLE_NETRC) + ))] #[bitfield(name = "httpproxy", ty = "bit", bits = "0..=0")] #[bitfield(name = "socksproxy", ty = "bit", bits = "1..=1")] #[bitfield(name = "proxy_user_passwd", ty = "bit", bits = "2..=2")] @@ -2165,9 +2122,13 @@ pub struct ConnectBits { #[bitfield(name = "parallel_connect", ty = "bit", bits = "34..=34")] // pub httpproxy_socksproxy_proxy_user_passwd_tunnel_proxy_proxy_connect_closed_close_reuse_altused_conn_to_host_conn_to_port_proxy_user_passwd_ipv6_ip_ipv6_do_more_protoconnstart_retry_authneg_rewindaftersend_ftp_use_epsv_ftp_use_eprt_ftp_use_data_ssl_ftp_use_control_ssl_netrc_bound_multiplex_tcp_fastopen_tls_enable_npn_tls_enable_alpn_connect_only_doh_abstract_unix_socket_tls_upgraded_sock_accepted_parallel_connect: [u8; 5], pub c2rust_abbr: [u8; 5], - #[cfg(all(not(CURL_DISABLE_PROXY), not(CURL_DISABLE_FTP), not(CURL_DISABLE_NETRC)))] + #[cfg(all( + not(CURL_DISABLE_PROXY), + not(CURL_DISABLE_FTP), + not(CURL_DISABLE_NETRC) + ))] #[bitfield(padding)] - pub c2rust_padding: [u8; 3], + pub c2rust_padding: [u8; 3], #[cfg(all(not(CURL_DISABLE_PROXY), not(CURL_DISABLE_FTP), CURL_DISABLE_NETRC))] #[bitfield(name = "httpproxy", ty = "bit", bits = "0..=0")] #[bitfield(name = "socksproxy", ty = "bit", bits = "1..=1")] @@ -2643,10 +2604,8 @@ pub struct contenc_writer { pub struct content_encoding { pub name: *const libc::c_char, pub alias: *const libc::c_char, - pub init_writer: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut contenc_writer) -> CURLcode, - >, - pub unencode_write: Option::< + pub init_writer: Option CURLcode>, + pub unencode_write: Option< unsafe extern "C" fn( *mut Curl_easy, *mut contenc_writer, @@ -2654,9 +2613,7 @@ pub struct content_encoding { size_t, ) -> CURLcode, >, - pub close_writer: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut contenc_writer) -> (), - >, + pub close_writer: Option ()>, pub paramsize: size_t, } @@ -2854,7 +2811,7 @@ pub union nghttp2_frame { pub ext: nghttp2_extension, } -// mbedtls ftp +// mbedtls ftp #[derive(Copy, Clone)] #[repr(C)] pub struct curl_index { @@ -2892,7 +2849,7 @@ pub struct ntlmdata { #[derive(Copy, Clone)] #[repr(C)] pub struct bufref { - pub dtor: Option:: ()>, + pub dtor: Option ()>, pub ptr: *const libc::c_uchar, pub len: size_t, #[cfg(CURLDEBUG)] @@ -2906,66 +2863,38 @@ pub struct Curl_ssl { pub info: curl_ssl_backend, pub supports: libc::c_uint, pub sizeof_ssl_backend_data: size_t, - pub init: Option:: libc::c_int>, - pub cleanup: Option:: ()>, - pub version: Option:: size_t>, - pub check_cxn: Option:: libc::c_int>, - pub shut_down: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - libc::c_int, - ) -> libc::c_int, + pub init: Option libc::c_int>, + pub cleanup: Option ()>, + pub version: Option size_t>, + pub check_cxn: Option libc::c_int>, + pub shut_down: + Option libc::c_int>, + pub data_pending: Option bool>, + pub random: + Option CURLcode>, + pub cert_status_request: Option bool>, + pub connect_blocking: + Option CURLcode>, + pub connect_nonblocking: Option< + unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_int, *mut bool) -> CURLcode, >, - pub data_pending: Option::< - unsafe extern "C" fn(*const connectdata, libc::c_int) -> bool, - >, - pub random: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut libc::c_uchar, size_t) -> CURLcode, - >, - pub cert_status_request: Option:: bool>, - pub connect_blocking: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_int) -> CURLcode, - >, - pub connect_nonblocking: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - libc::c_int, - *mut bool, - ) -> CURLcode, - >, - pub getsock: Option::< - unsafe extern "C" fn(*mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub get_internals: Option::< - unsafe extern "C" fn(*mut ssl_connect_data, CURLINFO) -> *mut libc::c_void, - >, - pub close_one: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_int) -> (), - >, - pub close_all: Option:: ()>, - pub session_free: Option:: ()>, - pub set_engine: Option::< - unsafe extern "C" fn(*mut Curl_easy, *const libc::c_char) -> CURLcode, - >, - pub set_engine_default: Option:: CURLcode>, - pub engines_list: Option:: *mut curl_slist>, - pub false_start: Option:: bool>, - pub sha256sum: Option::< - unsafe extern "C" fn( - *const libc::c_uchar, - size_t, - *mut libc::c_uchar, - size_t, - ) -> CURLcode, - >, - pub associate_connection: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_int) -> (), - >, - pub disassociate_connection: Option::< - unsafe extern "C" fn(*mut Curl_easy, libc::c_int) -> (), + pub getsock: Option libc::c_int>, + pub get_internals: + Option *mut libc::c_void>, + pub close_one: + Option ()>, + pub close_all: Option ()>, + pub session_free: Option ()>, + pub set_engine: Option CURLcode>, + pub set_engine_default: Option CURLcode>, + pub engines_list: Option *mut curl_slist>, + pub false_start: Option bool>, + pub sha256sum: Option< + unsafe extern "C" fn(*const libc::c_uchar, size_t, *mut libc::c_uchar, size_t) -> CURLcode, >, + pub associate_connection: + Option ()>, + pub disassociate_connection: Option ()>, } // mbedtls_threadlock.rs #[derive(Copy, Clone)] @@ -3073,7 +3002,7 @@ pub union pthread_mutex_t { #[repr(C)] pub struct mbedtls_ssl_config { pub ciphersuite_list: [*const libc::c_int; 4], - pub f_dbg: Option::< + pub f_dbg: Option< unsafe extern "C" fn( *mut libc::c_void, libc::c_int, @@ -3083,25 +3012,15 @@ pub struct mbedtls_ssl_config { ) -> (), >, pub p_dbg: *mut libc::c_void, - pub f_rng: Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut libc::c_uchar, - size_t, - ) -> libc::c_int, - >, + pub f_rng: + Option libc::c_int>, pub p_rng: *mut libc::c_void, - pub f_get_cache: Option::< - unsafe extern "C" fn(*mut libc::c_void, *mut mbedtls_ssl_session) -> libc::c_int, - >, - pub f_set_cache: Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *const mbedtls_ssl_session, - ) -> libc::c_int, - >, + pub f_get_cache: + Option libc::c_int>, + pub f_set_cache: + Option libc::c_int>, pub p_cache: *mut libc::c_void, - pub f_sni: Option::< + pub f_sni: Option< unsafe extern "C" fn( *mut libc::c_void, *mut mbedtls_ssl_context, @@ -3110,7 +3029,7 @@ pub struct mbedtls_ssl_config { ) -> libc::c_int, >, pub p_sni: *mut libc::c_void, - pub f_vrfy: Option::< + pub f_vrfy: Option< unsafe extern "C" fn( *mut libc::c_void, *mut mbedtls_x509_crt, @@ -3119,7 +3038,7 @@ pub struct mbedtls_ssl_config { ) -> libc::c_int, >, pub p_vrfy: *mut libc::c_void, - pub f_psk: Option::< + pub f_psk: Option< unsafe extern "C" fn( *mut libc::c_void, *mut mbedtls_ssl_context, @@ -3128,7 +3047,7 @@ pub struct mbedtls_ssl_config { ) -> libc::c_int, >, pub p_psk: *mut libc::c_void, - pub f_cookie_write: Option::< + pub f_cookie_write: Option< unsafe extern "C" fn( *mut libc::c_void, *mut *mut libc::c_uchar, @@ -3137,7 +3056,7 @@ pub struct mbedtls_ssl_config { size_t, ) -> libc::c_int, >, - pub f_cookie_check: Option::< + pub f_cookie_check: Option< unsafe extern "C" fn( *mut libc::c_void, *const libc::c_uchar, @@ -3147,7 +3066,7 @@ pub struct mbedtls_ssl_config { ) -> libc::c_int, >, pub p_cookie: *mut libc::c_void, - pub f_ticket_write: Option::< + pub f_ticket_write: Option< unsafe extern "C" fn( *mut libc::c_void, *const mbedtls_ssl_session, @@ -3157,7 +3076,7 @@ pub struct mbedtls_ssl_config { *mut uint32_t, ) -> libc::c_int, >, - pub f_ticket_parse: Option::< + pub f_ticket_parse: Option< unsafe extern "C" fn( *mut libc::c_void, *mut mbedtls_ssl_session, @@ -3166,7 +3085,7 @@ pub struct mbedtls_ssl_config { ) -> libc::c_int, >, pub p_ticket: *mut libc::c_void, - pub f_export_keys: Option::< + pub f_export_keys: Option< unsafe extern "C" fn( *mut libc::c_void, *const libc::c_uchar, @@ -3204,7 +3123,11 @@ pub struct mbedtls_ssl_config { #[bitfield(name = "endpoint", ty = "libc::c_uint", bits = "0..=0")] #[bitfield(name = "transport", ty = "libc::c_uint", bits = "1..=1")] #[bitfield(name = "authmode", ty = "libc::c_uint", bits = "2..=3")] - #[bitfield(name = "allow_legacy_renegotiation", ty = "libc::c_uint", bits = "4..=5")] + #[bitfield( + name = "allow_legacy_renegotiation", + ty = "libc::c_uint", + bits = "4..=5" + )] #[bitfield(name = "arc4_disabled", ty = "libc::c_uint", bits = "6..=6")] #[bitfield(name = "mfl_code", ty = "libc::c_uint", bits = "7..=9")] #[bitfield(name = "encrypt_then_mac", ty = "libc::c_uint", bits = "10..=10")] @@ -3361,9 +3284,9 @@ pub struct mbedtls_ssl_context { pub major_ver: libc::c_int, pub minor_ver: libc::c_int, pub badmac_seen: libc::c_uint, - pub f_send: Option::, - pub f_recv: Option::, - pub f_recv_timeout: Option::, + pub f_send: Option, + pub f_recv: Option, + pub f_recv_timeout: Option, pub p_bio: *mut libc::c_void, pub session_in: *mut mbedtls_ssl_session, pub session_out: *mut mbedtls_ssl_session, @@ -3375,8 +3298,8 @@ pub struct mbedtls_ssl_context { pub transform: *mut mbedtls_ssl_transform, pub transform_negotiate: *mut mbedtls_ssl_transform, pub p_timer: *mut libc::c_void, - pub f_set_timer: Option::, - pub f_get_timer: Option::, + pub f_set_timer: Option, + pub f_get_timer: Option, pub in_buf: *mut libc::c_uchar, pub in_ctr: *mut libc::c_uchar, pub in_hdr: *mut libc::c_uchar, @@ -3468,13 +3391,8 @@ pub struct mbedtls_ctr_drbg_context { pub entropy_len: size_t, pub reseed_interval: libc::c_int, pub aes_ctx: mbedtls_aes_context, - pub f_entropy: Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut libc::c_uchar, - size_t, - ) -> libc::c_int, - >, + pub f_entropy: + Option libc::c_int>, pub p_entropy: *mut libc::c_void, pub mutex: mbedtls_threading_mutex_t, } @@ -3486,7 +3404,6 @@ pub struct mbedtls_aes_context { pub buf: [uint32_t; 68], } - // gnutls http2.rs // gnutls gtls.rs #[derive(Copy, Clone)] @@ -3504,7 +3421,6 @@ pub struct sha256_ctx { pub index: libc::c_uint, } - // gnutls vtls.rs // gnutls ftp.rs // gnutls ftplistparser.rs @@ -3626,7 +3542,7 @@ pub struct PRFileDesc { pub secret: *mut PRFilePrivate, pub lower: *mut PRFileDesc, pub higher: *mut PRFileDesc, - pub dtor: Option:: ()>, + pub dtor: Option ()>, pub identity: PRDescIdentity, } #[derive(Copy, Clone)] @@ -3909,7 +3825,11 @@ pub union nss_C2RustUnnamed_15 { #[derive(Copy, Clone, BitfieldStruct)] #[repr(C)] pub struct nss_C2RustUnnamed_16 { - #[bitfield(name = "hasUnsupportedCriticalExt", ty = "libc::c_uint", bits = "0..=0")] + #[bitfield( + name = "hasUnsupportedCriticalExt", + ty = "libc::c_uint", + bits = "0..=0" + )] pub hasUnsupportedCriticalExt: [u8; 1], #[bitfield(padding)] pub c2rust_padding: [u8; 3], @@ -4639,14 +4559,10 @@ pub struct br_x509_minimal_context { #[repr(C)] pub struct br_ec_impl { pub supported_curves: uint32_t, - pub generator: Option::< - unsafe extern "C" fn(libc::c_int, *mut size_t) -> *const libc::c_uchar, - >, - pub order: Option::< - unsafe extern "C" fn(libc::c_int, *mut size_t) -> *const libc::c_uchar, - >, - pub xoff: Option:: size_t>, - pub mul: Option::< + pub generator: Option *const libc::c_uchar>, + pub order: Option *const libc::c_uchar>, + pub xoff: Option size_t>, + pub mul: Option< unsafe extern "C" fn( *mut libc::c_uchar, size_t, @@ -4655,7 +4571,7 @@ pub struct br_ec_impl { libc::c_int, ) -> uint32_t, >, - pub mulgen: Option::< + pub mulgen: Option< unsafe extern "C" fn( *mut libc::c_uchar, *const libc::c_uchar, @@ -4663,7 +4579,7 @@ pub struct br_ec_impl { libc::c_int, ) -> size_t, >, - pub muladd: Option::< + pub muladd: Option< unsafe extern "C" fn( *mut libc::c_uchar, *const libc::c_uchar, @@ -4710,26 +4626,14 @@ pub struct br_md5sha1_context { pub struct br_hash_class_ { pub context_size: size_t, pub desc: uint32_t, - pub init: Option:: ()>, - pub update: Option::< - unsafe extern "C" fn( - *mut *const br_hash_class, - *const libc::c_void, - size_t, - ) -> (), - >, - pub out: Option::< - unsafe extern "C" fn(*const *const br_hash_class, *mut libc::c_void) -> (), - >, - pub state: Option::< - unsafe extern "C" fn(*const *const br_hash_class, *mut libc::c_void) -> uint64_t, - >, - pub set_state: Option::< - unsafe extern "C" fn( - *mut *const br_hash_class, - *const libc::c_void, - uint64_t, - ) -> (), + pub init: Option ()>, + pub update: + Option ()>, + pub out: Option ()>, + pub state: + Option uint64_t>, + pub set_state: Option< + unsafe extern "C" fn(*mut *const br_hash_class, *const libc::c_void, uint64_t) -> (), >, } #[derive(Copy, Clone)] @@ -4784,28 +4688,15 @@ pub struct bear_C2RustUnnamed_7 { #[repr(C)] pub struct br_x509_class_ { pub context_size: size_t, - pub start_chain: Option::< - unsafe extern "C" fn(*mut *const br_x509_class, *const libc::c_char) -> (), - >, - pub start_cert: Option::< - unsafe extern "C" fn(*mut *const br_x509_class, uint32_t) -> (), - >, - pub append: Option::< - unsafe extern "C" fn( - *mut *const br_x509_class, - *const libc::c_uchar, - size_t, - ) -> (), - >, - pub end_cert: Option:: ()>, - pub end_chain: Option::< - unsafe extern "C" fn(*mut *const br_x509_class) -> libc::c_uint, - >, - pub get_pkey: Option::< - unsafe extern "C" fn( - *const *const br_x509_class, - *mut libc::c_uint, - ) -> *const br_x509_pkey, + pub start_chain: + Option ()>, + pub start_cert: Option ()>, + pub append: + Option ()>, + pub end_cert: Option ()>, + pub end_chain: Option libc::c_uint>, + pub get_pkey: Option< + unsafe extern "C" fn(*const *const br_x509_class, *mut libc::c_uint) -> *const br_x509_pkey, >, } #[derive(Copy, Clone)] @@ -4858,26 +4749,21 @@ pub struct br_x509_certificate { #[repr(C)] pub struct br_ssl_client_certificate_class_ { pub context_size: size_t, - pub start_name_list: Option::< - unsafe extern "C" fn(*mut *const br_ssl_client_certificate_class) -> (), - >, - pub start_name: Option::< - unsafe extern "C" fn(*mut *const br_ssl_client_certificate_class, size_t) -> (), - >, - pub append_name: Option::< + pub start_name_list: + Option ()>, + pub start_name: + Option ()>, + pub append_name: Option< unsafe extern "C" fn( *mut *const br_ssl_client_certificate_class, *const libc::c_uchar, size_t, ) -> (), >, - pub end_name: Option::< - unsafe extern "C" fn(*mut *const br_ssl_client_certificate_class) -> (), - >, - pub end_name_list: Option::< - unsafe extern "C" fn(*mut *const br_ssl_client_certificate_class) -> (), - >, - pub choose: Option::< + pub end_name: Option ()>, + pub end_name_list: + Option ()>, + pub choose: Option< unsafe extern "C" fn( *mut *const br_ssl_client_certificate_class, *const br_ssl_client_context, @@ -4885,14 +4771,14 @@ pub struct br_ssl_client_certificate_class_ { *mut br_ssl_client_certificate, ) -> (), >, - pub do_keyx: Option::< + pub do_keyx: Option< unsafe extern "C" fn( *mut *const br_ssl_client_certificate_class, *mut libc::c_uchar, *mut size_t, ) -> uint32_t, >, - pub do_sign: Option::< + pub do_sign: Option< unsafe extern "C" fn( *mut *const br_ssl_client_certificate_class, libc::c_int, @@ -4987,7 +4873,7 @@ pub struct br_ssl_engine_context { pub saved_hbuf_out: *mut libc::c_uchar, pub hlen_in: size_t, pub hlen_out: size_t, - pub hsrun: Option:: ()>, + pub hsrun: Option ()>, pub action: libc::c_uchar, pub alert: libc::c_uchar, pub close_received: libc::c_uchar, @@ -5028,7 +4914,7 @@ pub struct br_ssl_engine_context { #[repr(C)] pub struct br_sslrec_out_ccm_class_ { pub inner: br_sslrec_out_class, - pub init: Option::< + pub init: Option< unsafe extern "C" fn( *mut *const br_sslrec_out_ccm_class, *const br_block_ctrcbc_class, @@ -5045,14 +4931,10 @@ pub struct br_block_ctrcbc_class_ { pub context_size: size_t, pub block_size: libc::c_uint, pub log_block_size: libc::c_uint, - pub init: Option::< - unsafe extern "C" fn( - *mut *const br_block_ctrcbc_class, - *const libc::c_void, - size_t, - ) -> (), + pub init: Option< + unsafe extern "C" fn(*mut *const br_block_ctrcbc_class, *const libc::c_void, size_t) -> (), >, - pub encrypt: Option::< + pub encrypt: Option< unsafe extern "C" fn( *const *const br_block_ctrcbc_class, *mut libc::c_void, @@ -5061,7 +4943,7 @@ pub struct br_block_ctrcbc_class_ { size_t, ) -> (), >, - pub decrypt: Option::< + pub decrypt: Option< unsafe extern "C" fn( *const *const br_block_ctrcbc_class, *mut libc::c_void, @@ -5070,7 +4952,7 @@ pub struct br_block_ctrcbc_class_ { size_t, ) -> (), >, - pub ctr: Option::< + pub ctr: Option< unsafe extern "C" fn( *const *const br_block_ctrcbc_class, *mut libc::c_void, @@ -5078,7 +4960,7 @@ pub struct br_block_ctrcbc_class_ { size_t, ) -> (), >, - pub mac: Option::< + pub mac: Option< unsafe extern "C" fn( *const *const br_block_ctrcbc_class, *mut libc::c_void, @@ -5091,14 +4973,10 @@ pub struct br_block_ctrcbc_class_ { #[repr(C)] pub struct br_sslrec_out_class_ { pub context_size: size_t, - pub max_plaintext: Option::< - unsafe extern "C" fn( - *const *const br_sslrec_out_class, - *mut size_t, - *mut size_t, - ) -> (), + pub max_plaintext: Option< + unsafe extern "C" fn(*const *const br_sslrec_out_class, *mut size_t, *mut size_t) -> (), >, - pub encrypt: Option::< + pub encrypt: Option< unsafe extern "C" fn( *mut *const br_sslrec_out_class, libc::c_int, @@ -5112,7 +4990,7 @@ pub struct br_sslrec_out_class_ { #[repr(C)] pub struct br_sslrec_in_ccm_class_ { pub inner: br_sslrec_in_class, - pub init: Option::< + pub init: Option< unsafe extern "C" fn( *mut *const br_sslrec_in_ccm_class, *const br_block_ctrcbc_class, @@ -5127,10 +5005,9 @@ pub struct br_sslrec_in_ccm_class_ { #[repr(C)] pub struct br_sslrec_in_class_ { pub context_size: size_t, - pub check_length: Option::< - unsafe extern "C" fn(*const *const br_sslrec_in_class, size_t) -> libc::c_int, - >, - pub decrypt: Option::< + pub check_length: + Option libc::c_int>, + pub decrypt: Option< unsafe extern "C" fn( *mut *const br_sslrec_in_class, libc::c_int, @@ -5144,7 +5021,7 @@ pub struct br_sslrec_in_class_ { #[repr(C)] pub struct br_sslrec_out_chapol_class_ { pub inner: br_sslrec_out_class, - pub init: Option::< + pub init: Option< unsafe extern "C" fn( *mut *const br_sslrec_out_chapol_class, br_chacha20_run, @@ -5158,7 +5035,7 @@ pub struct br_sslrec_out_chapol_class_ { #[repr(C)] pub struct br_sslrec_in_chapol_class_ { pub inner: br_sslrec_in_class, - pub init: Option::< + pub init: Option< unsafe extern "C" fn( *mut *const br_sslrec_in_chapol_class, br_chacha20_run, @@ -5172,7 +5049,7 @@ pub struct br_sslrec_in_chapol_class_ { #[repr(C)] pub struct br_sslrec_out_gcm_class_ { pub inner: br_sslrec_out_class, - pub init: Option::< + pub init: Option< unsafe extern "C" fn( *mut *const br_sslrec_out_gcm_class, *const br_block_ctr_class, @@ -5189,14 +5066,10 @@ pub struct br_block_ctr_class_ { pub context_size: size_t, pub block_size: libc::c_uint, pub log_block_size: libc::c_uint, - pub init: Option::< - unsafe extern "C" fn( - *mut *const br_block_ctr_class, - *const libc::c_void, - size_t, - ) -> (), + pub init: Option< + unsafe extern "C" fn(*mut *const br_block_ctr_class, *const libc::c_void, size_t) -> (), >, - pub run: Option::< + pub run: Option< unsafe extern "C" fn( *const *const br_block_ctr_class, *const libc::c_void, @@ -5210,7 +5083,7 @@ pub struct br_block_ctr_class_ { #[repr(C)] pub struct br_sslrec_in_gcm_class_ { pub inner: br_sslrec_in_class, - pub init: Option::< + pub init: Option< unsafe extern "C" fn( *mut *const br_sslrec_in_gcm_class, *const br_block_ctr_class, @@ -5225,7 +5098,7 @@ pub struct br_sslrec_in_gcm_class_ { #[repr(C)] pub struct br_sslrec_out_cbc_class_ { pub inner: br_sslrec_out_class, - pub init: Option::< + pub init: Option< unsafe extern "C" fn( *mut *const br_sslrec_out_cbc_class, *const br_block_cbcenc_class, @@ -5245,14 +5118,10 @@ pub struct br_block_cbcenc_class_ { pub context_size: size_t, pub block_size: libc::c_uint, pub log_block_size: libc::c_uint, - pub init: Option::< - unsafe extern "C" fn( - *mut *const br_block_cbcenc_class, - *const libc::c_void, - size_t, - ) -> (), + pub init: Option< + unsafe extern "C" fn(*mut *const br_block_cbcenc_class, *const libc::c_void, size_t) -> (), >, - pub run: Option::< + pub run: Option< unsafe extern "C" fn( *const *const br_block_cbcenc_class, *mut libc::c_void, @@ -5265,7 +5134,7 @@ pub struct br_block_cbcenc_class_ { #[repr(C)] pub struct br_sslrec_in_cbc_class_ { pub inner: br_sslrec_in_class, - pub init: Option::< + pub init: Option< unsafe extern "C" fn( *mut *const br_sslrec_in_cbc_class, *const br_block_cbcdec_class, @@ -5285,14 +5154,10 @@ pub struct br_block_cbcdec_class_ { pub context_size: size_t, pub block_size: libc::c_uint, pub log_block_size: libc::c_uint, - pub init: Option::< - unsafe extern "C" fn( - *mut *const br_block_cbcdec_class, - *const libc::c_void, - size_t, - ) -> (), + pub init: Option< + unsafe extern "C" fn(*mut *const br_block_cbcdec_class, *const libc::c_void, size_t) -> (), >, - pub run: Option::< + pub run: Option< unsafe extern "C" fn( *const *const br_block_cbcdec_class, *mut libc::c_void, @@ -5335,7 +5200,7 @@ pub struct br_hmac_drbg_context { #[repr(C)] pub struct br_prng_class_ { pub context_size: size_t, - pub init: Option::< + pub init: Option< unsafe extern "C" fn( *mut *const br_prng_class, *const libc::c_void, @@ -5343,16 +5208,10 @@ pub struct br_prng_class_ { size_t, ) -> (), >, - pub generate: Option::< - unsafe extern "C" fn(*mut *const br_prng_class, *mut libc::c_void, size_t) -> (), - >, - pub update: Option::< - unsafe extern "C" fn( - *mut *const br_prng_class, - *const libc::c_void, - size_t, - ) -> (), - >, + pub generate: + Option ()>, + pub update: + Option ()>, } #[derive(Copy, Clone)] #[repr(C)] @@ -5794,9 +5653,8 @@ pub struct br_x509_decoder_context { pub isCA: libc::c_uchar, pub copy_dn: libc::c_uchar, pub append_dn_ctx: *mut libc::c_void, - pub append_dn: Option::< - unsafe extern "C" fn(*mut libc::c_void, *const libc::c_void, size_t) -> (), - >, + pub append_dn: + Option ()>, pub hbuf: *const libc::c_uchar, pub hlen: size_t, pub pkey_data: [libc::c_uchar; 520], @@ -5819,9 +5677,7 @@ pub struct br_pem_decoder_context { pub err: libc::c_int, pub hbuf: *const libc::c_uchar, pub hlen: size_t, - pub dest: Option::< - unsafe extern "C" fn(*mut libc::c_void, *const libc::c_void, size_t) -> (), - >, + pub dest: Option ()>, pub dest_ctx: *mut libc::c_void, pub event: libc::c_uchar, pub name: [libc::c_char; 128], @@ -5863,4 +5719,3 @@ pub struct libssh2_agent_publickey { pub blob_len: size_t, pub comment: *mut libc::c_char, } - diff --git a/rust/rust_macro/build.rs b/rust/rust_macro/build.rs index 99407fe20484976c4c664302ba9c5cf74b90aa4b..bfcf484f96c40522fbae3ab50cf060fa608b34b0 100644 --- a/rust/rust_macro/build.rs +++ b/rust/rust_macro/build.rs @@ -8,7 +8,7 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: wyf, + * Author: wyf, * Create: 2022-10-31 * Description: build script for Rust project, get macros from C side for conditional compilation ******************************************************************************/ diff --git a/rust/rust_macro/lib.rs b/rust/rust_macro/lib.rs index 589086fe42ff3b06581597e2f008ddfe27278171..f50b818e595cf31955993953623f021339b2d847 100644 --- a/rust/rust_macro/lib.rs +++ b/rust/rust_macro/lib.rs @@ -10,7 +10,6 @@ #![feature(c_variadic, extern_types, label_break_value, register_tool)] #![register_tool(c2rust)] - pub mod src { pub mod get_macros; } diff --git a/rust/rust_macro/src/get_macros.rs b/rust/rust_macro/src/get_macros.rs index 12426c974444d8c9dd6c235c0a4eb9916ab223ba..2033395f9922464ecbded659709ae1ee44ae1846 100644 --- a/rust/rust_macro/src/get_macros.rs +++ b/rust/rust_macro/src/get_macros.rs @@ -8,7 +8,7 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: wyf, + * Author: wyf, * Create: 2022-10-31 * Description: get values of macro that the build of Rust code relies on from C side ******************************************************************************/ @@ -19,7 +19,7 @@ extern "C" { fn get_DEBUG_HTTP2() -> i32; fn get_NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE() -> i32; fn get_DEBUGBUILD() -> i32; - + fn get_USE_RECV_BEFORE_SEND_WORKAROUND() -> i32; fn get_USE_KERBEROS5() -> i32; // http_proxy @@ -337,7 +337,6 @@ pub fn get_all_cfg() { //debug get_HAVE_ASSERT_H_add_cfg(); - } // http2 @@ -1023,4 +1022,4 @@ fn get_HAVE_ASSERT_H_add_cfg() { if unsafe { get_HAVE_ASSERT_H() } == 1 { println!("cargo:rustc-cfg=HAVE_ASSERT_H"); } -} \ No newline at end of file +} diff --git a/rust/rust_project/lib.rs b/rust/rust_project/lib.rs index 030c6c4a2fe5733f34ec2225dce58e23139552e6..2f06bfe7af19448072ce428439cf7c7929e34dc1 100644 --- a/rust/rust_project/lib.rs +++ b/rust/rust_project/lib.rs @@ -7,7 +7,13 @@ unused_assignments, unused_mut )] -#![feature(c_variadic, extern_types, label_break_value, register_tool, stmt_expr_attributes)] +#![feature( + c_variadic, + extern_types, + label_break_value, + register_tool, + stmt_expr_attributes +)] #![register_tool(c2rust)] #[macro_use] @@ -20,6 +26,9 @@ pub mod src { pub mod ftp; #[cfg(not(CURL_DISABLE_FTP))] pub mod ftplistparser; + #[cfg(not(CURL_DISABLE_HTTP))] + pub mod http; + pub mod http2; #[cfg(all(not(CURL_DISABLE_HTTP), not(CURL_DISABLE_CRYPTO_AUTH)))] pub mod http_aws_sigv4; #[cfg(not(CURL_DISABLE_HTTP))] @@ -28,9 +37,6 @@ pub mod src { pub mod http_digest; #[cfg(all(not(CURL_DISABLE_HTTP), USE_SPNEGO))] pub mod http_negotiate; - #[cfg(not(CURL_DISABLE_HTTP))] - pub mod http; - pub mod http2; #[cfg(all(not(CURL_DISABLE_HTTP), USE_NTLM))] pub mod http_ntlm; pub mod http_proxy; @@ -42,9 +48,9 @@ pub mod src { pub mod gtls; pub mod keylog; #[cfg(USE_MBEDTLS)] - pub mod mbedtls_threadlock; - #[cfg(USE_MBEDTLS)] pub mod mbedtls; + #[cfg(USE_MBEDTLS)] + pub mod mbedtls_threadlock; #[cfg(USE_MESALINK)] pub mod mesalink; #[cfg(USE_NSS)] diff --git a/rust/rust_project/src/http_chunks.rs b/rust/rust_project/src/http_chunks.rs index 5e7d98103a1dc155de204a424ceefbacbd204fc6..f287003d10cf543de608cdc4ea94685a52bfaf74 100644 --- a/rust/rust_project/src/http_chunks.rs +++ b/rust/rust_project/src/http_chunks.rs @@ -8,7 +8,7 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: wyf, + * Author: wyf, * Create: 2022-10-31 * Description: http chunks ******************************************************************************/ @@ -249,7 +249,19 @@ pub unsafe extern "C" fn Curl_chunked_strerror(mut code: CHUNKcode) -> *const li as *const libc::c_char; } 3 => return b"Malformed encoding found\0" as *const u8 as *const libc::c_char, - 6 => return b"\0" as *const u8 as *const libc::c_char, + 6 => { + #[cfg(all(DEBUGBUILD, HAVE_ASSERT_H))] + __assert_fail( + b"0\0" as *const u8 as *const libc::c_char, + b"http_chunks.c\0" as *const u8 as *const libc::c_char, + 334 as libc::c_int as libc::c_uint, + (*::std::mem::transmute::<&[u8; 45], &[libc::c_char; 45]>( + b"const char *Curl_chunked_strerror(CHUNKcode)\0", + )) + .as_ptr(), + ); + return b"\0" as *const u8 as *const libc::c_char; + } 4 => return b"Bad content-encoding found\0" as *const u8 as *const libc::c_char, 5 => return b"Out of memory\0" as *const u8 as *const libc::c_char, _ => return b"OK\0" as *const u8 as *const libc::c_char, diff --git a/rust/rust_project/src/http_digest.rs b/rust/rust_project/src/http_digest.rs index 066646f415f7826b6f88dab57cc16951cb0b78ed..200e63ca08cef0fefa5d5a94ea145aee61ea0798 100644 --- a/rust/rust_project/src/http_digest.rs +++ b/rust/rust_project/src/http_digest.rs @@ -8,7 +8,7 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: Drug, + * Author: Drug, * Create: 2022-10-31 * Description: http digest ******************************************************************************/ @@ -66,12 +66,12 @@ pub unsafe extern "C" fn Curl_output_digest( let mut authp: *mut auth = 0 as *mut auth; if proxy { if cfg!(not(CURL_DISABLE_PROXY)) { - digest = &mut (*data).state.proxydigest; - allocuserpwd = &mut (*data).state.aptr.proxyuserpwd; - userp = (*data).state.aptr.proxyuser; - passwdp = (*data).state.aptr.proxypasswd; - authp = &mut (*data).state.authproxy; - } else { + digest = &mut (*data).state.proxydigest; + allocuserpwd = &mut (*data).state.aptr.proxyuserpwd; + userp = (*data).state.aptr.proxyuser; + passwdp = (*data).state.aptr.proxypasswd; + authp = &mut (*data).state.authproxy; + } else { return CURLE_NOT_BUILT_IN; } } else { @@ -119,8 +119,9 @@ pub unsafe extern "C" fn Curl_output_digest( } if tmp.is_null() { #[cfg(not(CURLDEBUG))] - let mut newpath: *mut libc::c_uchar = Curl_cstrdup.expect("non-null function pointer")(uripath as *mut libc::c_char) - as *mut libc::c_uchar; + let mut newpath: *mut libc::c_uchar = + Curl_cstrdup.expect("non-null function pointer")(uripath as *mut libc::c_char) + as *mut libc::c_uchar; #[cfg(CURLDEBUG)] let mut newpath: *mut libc::c_uchar = curl_dbg_strdup( uripath as *mut libc::c_char, @@ -128,7 +129,7 @@ pub unsafe extern "C" fn Curl_output_digest( b"http_digest.c\0" as *const u8 as *const libc::c_char, ) as *mut libc::c_uchar; path = newpath; - } + } if path.is_null() { return CURLE_OUT_OF_MEMORY; } diff --git a/rust/rust_project/src/http_ntlm.rs b/rust/rust_project/src/http_ntlm.rs index a52018ee7444be821f50e141d089f7deb367d71d..1e01d2174fefc24c24e7d82ff2f875b42a807629 100644 --- a/rust/rust_project/src/http_ntlm.rs +++ b/rust/rust_project/src/http_ntlm.rs @@ -8,7 +8,7 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: wyf, + * Author: wyf, * Create: 2022-10-31 * Description: http ntlm ******************************************************************************/ @@ -98,12 +98,12 @@ pub unsafe extern "C" fn Curl_input_ntlm( return CURLE_REMOTE_ACCESS_DENIED; } else if *state as libc::c_uint >= NTLMSTATE_TYPE1 as libc::c_int as libc::c_uint { // if *state as libc::c_uint >= NTLMSTATE_TYPE1 as libc::c_int as libc::c_uint { - Curl_infof( - data, - b"NTLM handshake failure (internal error)\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_REMOTE_ACCESS_DENIED; + Curl_infof( + data, + b"NTLM handshake failure (internal error)\0" as *const u8 + as *const libc::c_char, + ); + return CURLE_REMOTE_ACCESS_DENIED; // } } *state = NTLMSTATE_TYPE1; @@ -139,50 +139,50 @@ pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: b let mut authp: *mut auth = 0 as *mut auth; let mut conn: *mut connectdata = (*data).conn; #[cfg(all(DEBUGBUILD, HAVE_ASSERT_H))] - if !conn.is_null() {} else { + if !conn.is_null() { + } else { __assert_fail( b"conn\0" as *const u8 as *const libc::c_char, b"http_ntlm.c\0" as *const u8 as *const libc::c_char, 150 as libc::c_int as libc::c_uint, - (*::std::mem::transmute::< - &[u8; 53], - &[libc::c_char; 53], - >(b"CURLcode Curl_output_ntlm(struct Curl_easy *, _Bool)\0")) - .as_ptr(), + (*::std::mem::transmute::<&[u8; 53], &[libc::c_char; 53]>( + b"CURLcode Curl_output_ntlm(struct Curl_easy *, _Bool)\0", + )) + .as_ptr(), ); } #[cfg(all(DEBUGBUILD, HAVE_ASSERT_H))] - if !data.is_null() {} else { + if !data.is_null() { + } else { __assert_fail( b"data\0" as *const u8 as *const libc::c_char, b"http_ntlm.c\0" as *const u8 as *const libc::c_char, 151 as libc::c_int as libc::c_uint, - (*::std::mem::transmute::< - &[u8; 53], - &[libc::c_char; 53], - >(b"CURLcode Curl_output_ntlm(struct Curl_easy *, _Bool)\0")) - .as_ptr(), + (*::std::mem::transmute::<&[u8; 53], &[libc::c_char; 53]>( + b"CURLcode Curl_output_ntlm(struct Curl_easy *, _Bool)\0", + )) + .as_ptr(), ); } if proxy { match () { #[cfg(not(CURL_DISABLE_PROXY))] _ => { - allocuserpwd = &mut (*data).state.aptr.proxyuserpwd; - userp = (*data).state.aptr.proxyuser; - passwdp = (*data).state.aptr.proxypasswd; + allocuserpwd = &mut (*data).state.aptr.proxyuserpwd; + userp = (*data).state.aptr.proxyuser; + passwdp = (*data).state.aptr.proxypasswd; service = if !((*data).set.str_0[STRING_PROXY_SERVICE_NAME as libc::c_int as usize]) - .is_null() - { - (*data).set.str_0[STRING_PROXY_SERVICE_NAME as libc::c_int as usize] - as *const libc::c_char - } else { - b"HTTP\0" as *const u8 as *const libc::c_char - }; - hostname = (*conn).http_proxy.host.name; - ntlm = &mut (*conn).proxyntlm; - state = &mut (*conn).proxy_ntlm_state; - authp = &mut (*data).state.authproxy; + .is_null() + { + (*data).set.str_0[STRING_PROXY_SERVICE_NAME as libc::c_int as usize] + as *const libc::c_char + } else { + b"HTTP\0" as *const u8 as *const libc::c_char + }; + hostname = (*conn).http_proxy.host.name; + ntlm = &mut (*conn).proxyntlm; + state = &mut (*conn).proxy_ntlm_state; + authp = &mut (*data).state.authproxy; } #[cfg(CURL_DISABLE_PROXY)] _ => { @@ -280,18 +280,16 @@ pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: b ); if result as u64 == 0 { #[cfg(all(DEBUGBUILD, HAVE_ASSERT_H))] - if Curl_bufref_len(&mut ntlmmsg) != 0 as libc::c_int as libc::c_ulong - {} else { + if Curl_bufref_len(&mut ntlmmsg) != 0 as libc::c_int as libc::c_ulong { + } else { __assert_fail( - b"Curl_bufref_len(&ntlmmsg) != 0\0" as *const u8 - as *const libc::c_char, + b"Curl_bufref_len(&ntlmmsg) != 0\0" as *const u8 as *const libc::c_char, b"http_ntlm.c\0" as *const u8 as *const libc::c_char, 209 as libc::c_int as libc::c_uint, - (*::std::mem::transmute::< - &[u8; 53], - &[libc::c_char; 53], - >(b"CURLcode Curl_output_ntlm(struct Curl_easy *, _Bool)\0")) - .as_ptr(), + (*::std::mem::transmute::<&[u8; 53], &[libc::c_char; 53]>( + b"CURLcode Curl_output_ntlm(struct Curl_easy *, _Bool)\0", + )) + .as_ptr(), ); } result = Curl_base64_encode( diff --git a/rust/rust_project/src/http_proxy.rs b/rust/rust_project/src/http_proxy.rs index 326c607fbcdcc0256b432a8e3a7dc13ad69d1ff8..53d2a87acbe2b8d8cb0ddd5b5dd34f059f719bfe 100644 --- a/rust/rust_project/src/http_proxy.rs +++ b/rust/rust_project/src/http_proxy.rs @@ -8,7 +8,7 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR * PURPOSE. * See the Mulan PSL v2 for more details. - * Author: Drug, + * Author: Drug, * Create: 2022-10-31 * Description: http proxy ******************************************************************************/ @@ -28,49 +28,49 @@ unsafe extern "C" fn https_proxy_connect( mut sockindex: libc::c_int, ) -> CURLcode { if cfg!(USE_SSL) { - let mut conn: *mut connectdata = (*data).conn; - let mut result: CURLcode = CURLE_OK; - #[cfg(all(DEBUGBUILD, HAVE_ASSERT_H))] - if (*conn).http_proxy.proxytype as libc::c_uint - == CURLPROXY_HTTPS as libc::c_int as libc::c_uint - {} else { - __assert_fail( - b"conn->http_proxy.proxytype == CURLPROXY_HTTPS\0" as *const u8 - as *const libc::c_char, - b"http_proxy.c\0" as *const u8 as *const libc::c_char, - 60 as libc::c_int as libc::c_uint, - (*::std::mem::transmute::< - &[u8; 54], - &[libc::c_char; 54], - >(b"CURLcode https_proxy_connect(struct Curl_easy *, int)\0")) + let mut conn: *mut connectdata = (*data).conn; + let mut result: CURLcode = CURLE_OK; + #[cfg(all(DEBUGBUILD, HAVE_ASSERT_H))] + if (*conn).http_proxy.proxytype as libc::c_uint + == CURLPROXY_HTTPS as libc::c_int as libc::c_uint + { + } else { + __assert_fail( + b"conn->http_proxy.proxytype == CURLPROXY_HTTPS\0" as *const u8 + as *const libc::c_char, + b"http_proxy.c\0" as *const u8 as *const libc::c_char, + 60 as libc::c_int as libc::c_uint, + (*::std::mem::transmute::<&[u8; 54], &[libc::c_char; 54]>( + b"CURLcode https_proxy_connect(struct Curl_easy *, int)\0", + )) .as_ptr(), - ); - } - if !(*conn).bits.proxy_ssl_connected[sockindex as usize] { - result = Curl_ssl_connect_nonblocking( - data, - conn, - 1 as libc::c_int != 0, - sockindex, - &mut *((*conn).bits.proxy_ssl_connected) - .as_mut_ptr() - .offset(sockindex as isize), - ); - if result as u64 != 0 { - #[cfg(all(DEBUGBUILD, not(CURL_DISABLE_VERBOSE_STRINGS)))] - Curl_conncontrol( + ); + } + if !(*conn).bits.proxy_ssl_connected[sockindex as usize] { + result = Curl_ssl_connect_nonblocking( + data, conn, - 1 as libc::c_int, - b"TLS handshake failed\0" as *const u8 as *const libc::c_char, + 1 as libc::c_int != 0, + sockindex, + &mut *((*conn).bits.proxy_ssl_connected) + .as_mut_ptr() + .offset(sockindex as isize), ); - #[cfg(not(all(DEBUGBUILD, not(CURL_DISABLE_VERBOSE_STRINGS))))] - Curl_conncontrol(conn, 1 as libc::c_int); + if result as u64 != 0 { + #[cfg(all(DEBUGBUILD, not(CURL_DISABLE_VERBOSE_STRINGS)))] + Curl_conncontrol( + conn, + 1 as libc::c_int, + b"TLS handshake failed\0" as *const u8 as *const libc::c_char, + ); + #[cfg(not(all(DEBUGBUILD, not(CURL_DISABLE_VERBOSE_STRINGS))))] + Curl_conncontrol(conn, 1 as libc::c_int); + } } - } - return result; + return result; } else { return CURLE_NOT_BUILT_IN; -} + } } #[cfg(all(not(CURL_DISABLE_PROXY), not(CURL_DISABLE_HTTP)))] #[no_mangle] @@ -94,39 +94,39 @@ pub unsafe extern "C" fn Curl_proxy_connect( && ((*conn).bits).httpproxy() as libc::c_int != 0 { if cfg!(not(CURL_DISABLE_PROXY)) { - let mut hostname: *const libc::c_char = 0 as *const libc::c_char; - let mut remote_port: libc::c_int = 0; - let mut result_0: CURLcode = CURLE_OK; - if ((*conn).bits).conn_to_host() != 0 { - hostname = (*conn).conn_to_host.name; - } else if sockindex == 1 as libc::c_int { - hostname = (*conn).secondaryhostname; - } else { - hostname = (*conn).host.name; - } - if sockindex == 1 as libc::c_int { - remote_port = (*conn).secondary_port as libc::c_int; - } else if ((*conn).bits).conn_to_port() != 0 { - remote_port = (*conn).conn_to_port; - } else { - remote_port = (*conn).remote_port; - } - result_0 = Curl_proxyCONNECT(data, sockindex, hostname, remote_port); - if CURLE_OK as libc::c_int as libc::c_uint != result_0 as libc::c_uint { - return result_0; - } - #[cfg(not(CURLDEBUG))] - Curl_cfree.expect("non-null function pointer")( - (*data).state.aptr.proxyuserpwd as *mut libc::c_void, - ); - #[cfg(CURLDEBUG)] - curl_dbg_free( - (*data).state.aptr.proxyuserpwd as *mut libc::c_void, - 120 as libc::c_int, - b"http_proxy.c\0" as *const u8 as *const libc::c_char, - ); - let ref mut fresh0 = (*data).state.aptr.proxyuserpwd; - *fresh0 = 0 as *mut libc::c_char; + let mut hostname: *const libc::c_char = 0 as *const libc::c_char; + let mut remote_port: libc::c_int = 0; + let mut result_0: CURLcode = CURLE_OK; + if ((*conn).bits).conn_to_host() != 0 { + hostname = (*conn).conn_to_host.name; + } else if sockindex == 1 as libc::c_int { + hostname = (*conn).secondaryhostname; + } else { + hostname = (*conn).host.name; + } + if sockindex == 1 as libc::c_int { + remote_port = (*conn).secondary_port as libc::c_int; + } else if ((*conn).bits).conn_to_port() != 0 { + remote_port = (*conn).conn_to_port; + } else { + remote_port = (*conn).remote_port; + } + result_0 = Curl_proxyCONNECT(data, sockindex, hostname, remote_port); + if CURLE_OK as libc::c_int as libc::c_uint != result_0 as libc::c_uint { + return result_0; + } + #[cfg(not(CURLDEBUG))] + Curl_cfree.expect("non-null function pointer")( + (*data).state.aptr.proxyuserpwd as *mut libc::c_void, + ); + #[cfg(CURLDEBUG)] + curl_dbg_free( + (*data).state.aptr.proxyuserpwd as *mut libc::c_void, + 120 as libc::c_int, + b"http_proxy.c\0" as *const u8 as *const libc::c_char, + ); + let ref mut fresh0 = (*data).state.aptr.proxyuserpwd; + *fresh0 = 0 as *mut libc::c_char; } else { return CURLE_NOT_BUILT_IN; } @@ -152,29 +152,29 @@ pub unsafe extern "C" fn Curl_connect_ongoing(mut conn: *mut connectdata) -> boo pub unsafe extern "C" fn Curl_connect_getsock(mut conn: *mut connectdata) -> libc::c_int { let mut http: *mut HTTP = 0 as *mut HTTP; #[cfg(all(DEBUGBUILD, HAVE_ASSERT_H))] - if !conn.is_null() {} else { + if !conn.is_null() { + } else { __assert_fail( b"conn\0" as *const u8 as *const libc::c_char, b"http_proxy.c\0" as *const u8 as *const libc::c_char, 147 as libc::c_int as libc::c_uint, - (*::std::mem::transmute::< - &[u8; 47], - &[libc::c_char; 47], - >(b"int Curl_connect_getsock(struct connectdata *)\0")) - .as_ptr(), + (*::std::mem::transmute::<&[u8; 47], &[libc::c_char; 47]>( + b"int Curl_connect_getsock(struct connectdata *)\0", + )) + .as_ptr(), ); } #[cfg(all(DEBUGBUILD, HAVE_ASSERT_H))] - if !((*conn).connect_state).is_null() {} else { + if !((*conn).connect_state).is_null() { + } else { __assert_fail( b"conn->connect_state\0" as *const u8 as *const libc::c_char, b"http_proxy.c\0" as *const u8 as *const libc::c_char, 148 as libc::c_int as libc::c_uint, - (*::std::mem::transmute::< - &[u8; 47], - &[libc::c_char; 47], - >(b"int Curl_connect_getsock(struct connectdata *)\0")) - .as_ptr(), + (*::std::mem::transmute::<&[u8; 47], &[libc::c_char; 47]>( + b"int Curl_connect_getsock(struct connectdata *)\0", + )) + .as_ptr(), ); } http = &mut (*(*conn).connect_state).http_proxy; @@ -190,16 +190,16 @@ unsafe extern "C" fn connect_init(mut data: *mut Curl_easy, mut reinit: bool) -> if !reinit { let mut result: CURLcode = CURLE_OK; #[cfg(all(DEBUGBUILD, HAVE_ASSERT_H))] - if ((*conn).connect_state).is_null() {} else { + if ((*conn).connect_state).is_null() { + } else { __assert_fail( b"!conn->connect_state\0" as *const u8 as *const libc::c_char, b"http_proxy.c\0" as *const u8 as *const libc::c_char, 163 as libc::c_int as libc::c_uint, - (*::std::mem::transmute::< - &[u8; 49], - &[libc::c_char; 49], - >(b"CURLcode connect_init(struct Curl_easy *, _Bool)\0")) - .as_ptr(), + (*::std::mem::transmute::<&[u8; 49], &[libc::c_char; 49]>( + b"CURLcode connect_init(struct Curl_easy *, _Bool)\0", + )) + .as_ptr(), ); } result = Curl_get_upload_buffer(data); @@ -243,16 +243,16 @@ unsafe extern "C" fn connect_init(mut data: *mut Curl_easy, mut reinit: bool) -> ); } else { #[cfg(all(DEBUGBUILD, HAVE_ASSERT_H))] - if !((*conn).connect_state).is_null() {} else { + if !((*conn).connect_state).is_null() { + } else { __assert_fail( b"conn->connect_state\0" as *const u8 as *const libc::c_char, b"http_proxy.c\0" as *const u8 as *const libc::c_char, 190 as libc::c_int as libc::c_uint, - (*::std::mem::transmute::< - &[u8; 49], - &[libc::c_char; 49], - >(b"CURLcode connect_init(struct Curl_easy *, _Bool)\0")) - .as_ptr(), + (*::std::mem::transmute::<&[u8; 49], &[libc::c_char; 49]>( + b"CURLcode connect_init(struct Curl_easy *, _Bool)\0", + )) + .as_ptr(), ); } s = (*conn).connect_state; @@ -430,7 +430,7 @@ unsafe extern "C" fn CONNECT( conn, b"User-Agent\0" as *const u8 as *const libc::c_char, )) - .is_null() + .is_null() && !((*data).set.str_0[STRING_USERAGENT as libc::c_int as usize]).is_null() { result = Curl_dyn_addf( @@ -445,7 +445,7 @@ unsafe extern "C" fn CONNECT( conn, b"Proxy-Connection\0" as *const u8 as *const libc::c_char, )) - .is_null() + .is_null() { result = Curl_dyn_add( req, @@ -706,23 +706,19 @@ unsafe extern "C" fn CONNECT( (*s).tunnel_state = TUNNEL_COMPLETE; } #[cfg(all(DEBUGBUILD, HAVE_ASSERT_H))] - if (*s).keepon as libc::c_uint - == KEEPON_IGNORE as libc::c_int as libc::c_uint - || (*s).keepon as libc::c_uint - == KEEPON_DONE as libc::c_int as libc::c_uint - {} else { + if (*s).keepon as libc::c_uint == KEEPON_IGNORE as libc::c_int as libc::c_uint + || (*s).keepon as libc::c_uint == KEEPON_DONE as libc::c_int as libc::c_uint + { + } else { __assert_fail( - b"s->keepon == KEEPON_IGNORE || s->keepon == KEEPON_DONE\0" - as *const u8 as *const libc::c_char, + b"s->keepon == KEEPON_IGNORE || s->keepon == KEEPON_DONE\0" as *const u8 + as *const libc::c_char, b"http_proxy.c\0" as *const u8 as *const libc::c_char, 555 as libc::c_int as libc::c_uint, - (*::std::mem::transmute::< - &[u8; 61], - &[libc::c_char; 61], - >( + (*::std::mem::transmute::<&[u8; 61], &[libc::c_char; 61]>( b"CURLcode CONNECT(struct Curl_easy *, int, const char *, int)\0", )) - .as_ptr(), + .as_ptr(), ); } } else { @@ -761,11 +757,11 @@ unsafe extern "C" fn CONNECT( return result; } } else if curl_strnequal( - b"Content-Length:\0" as *const u8 as *const libc::c_char, - linep, + b"Content-Length:\0" as *const u8 as *const libc::c_char, + linep, strlen(b"Content-Length:\0" as *const u8 as *const libc::c_char), - ) != 0 - { + ) != 0 + { if (*k).httpcode / 100 as libc::c_int == 2 as libc::c_int { Curl_infof( data, @@ -776,7 +772,7 @@ unsafe extern "C" fn CONNECT( } else { curlx_strtoofft( linep.offset(strlen( - b"Content-Length:\0" as *const u8 as *const libc::c_char, + b"Content-Length:\0" as *const u8 as *const libc::c_char, ) as isize), 0 as *mut *mut libc::c_char, 10 as libc::c_int, @@ -784,17 +780,17 @@ unsafe extern "C" fn CONNECT( ); } } else if Curl_compareheader( - linep, - b"Connection:\0" as *const u8 as *const libc::c_char, - b"close\0" as *const u8 as *const libc::c_char, - ) { + linep, + b"Connection:\0" as *const u8 as *const libc::c_char, + b"close\0" as *const u8 as *const libc::c_char, + ) { (*s).set_close_connection(1 as libc::c_int as bit); } else if curl_strnequal( - b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char, - linep, + b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char, + linep, strlen(b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char), - ) != 0 - { + ) != 0 + { if (*k).httpcode / 100 as libc::c_int == 2 as libc::c_int { Curl_infof( data, @@ -804,10 +800,10 @@ unsafe extern "C" fn CONNECT( (*k).httpcode, ); } else if Curl_compareheader( - linep, - b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char, - b"chunked\0" as *const u8 as *const libc::c_char, - ) { + linep, + b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char, + b"chunked\0" as *const u8 as *const libc::c_char, + ) { Curl_infof( data, b"CONNECT responded chunked\0" as *const u8 as *const libc::c_char, @@ -816,19 +812,19 @@ unsafe extern "C" fn CONNECT( Curl_httpchunk_init(data); } } else if Curl_compareheader( - linep, - b"Proxy-Connection:\0" as *const u8 as *const libc::c_char, - b"close\0" as *const u8 as *const libc::c_char, - ) { + linep, + b"Proxy-Connection:\0" as *const u8 as *const libc::c_char, + b"close\0" as *const u8 as *const libc::c_char, + ) { (*s).set_close_connection(1 as libc::c_int as bit); } else if 2 as libc::c_int - == sscanf( - linep, - b"HTTP/1.%d %d\0" as *const u8 as *const libc::c_char, - &mut subversion as *mut libc::c_int, - &mut (*k).httpcode as *mut libc::c_int, - ) - { + == sscanf( + linep, + b"HTTP/1.%d %d\0" as *const u8 as *const libc::c_char, + &mut subversion as *mut libc::c_int, + &mut (*k).httpcode as *mut libc::c_int, + ) + { (*data).info.httpproxycode = (*k).httpcode; } Curl_dyn_reset(&mut (*s).rcvbuf); @@ -1078,12 +1074,13 @@ unsafe extern "C" fn CONNECT( current_block = 14523688961733284890; break; } else if hyper_request_set_method( - req, - b"CONNECT\0" as *const u8 as *const libc::c_char - as *mut uint8_t, - strlen(b"CONNECT\0" as *const u8 as *const libc::c_char), - ) as u64 != 0 - { + req, + b"CONNECT\0" as *const u8 as *const libc::c_char + as *mut uint8_t, + strlen(b"CONNECT\0" as *const u8 as *const libc::c_char), + ) as u64 + != 0 + { Curl_failf( data, b"error setting method\0" as *const u8 @@ -1108,11 +1105,13 @@ unsafe extern "C" fn CONNECT( req, hostheader as *mut uint8_t, strlen(hostheader), - ) as u64 != 0 + ) as u64 + != 0 { Curl_failf( data, - b"error setting path\0" as *const u8 as *const libc::c_char, + b"error setting path\0" as *const u8 + as *const libc::c_char, ); result = CURLE_OUT_OF_MEMORY; } @@ -1128,10 +1127,9 @@ unsafe extern "C" fn CONNECT( current_block = 14523688961733284890; break; } - Curl_cfree - .expect( - "non-null function pointer", - )(hostheader as *mut libc::c_void); + Curl_cfree.expect("non-null function pointer")( + hostheader as *mut libc::c_void, + ); hostheader = 0 as *mut libc::c_char; if (*conn).http_proxy.proxytype as libc::c_uint == CURLPROXY_HTTP_1_0 as libc::c_int as libc::c_uint @@ -1158,23 +1156,25 @@ unsafe extern "C" fn CONNECT( break; } else { if !host.is_null() - && Curl_hyper_header(data, headers, host) as libc::c_uint + && Curl_hyper_header(data, headers, host) + as libc::c_uint != 0 { current_block = 14523688961733284890; break; } - Curl_cfree - .expect( - "non-null function pointer", - )(host as *mut libc::c_void); + Curl_cfree.expect("non-null function pointer")( + host as *mut libc::c_void, + ); host = 0 as *mut libc::c_char; if !((*data).state.aptr.proxyuserpwd).is_null() && Curl_hyper_header( data, headers, (*data).state.aptr.proxyuserpwd, - ) as libc::c_uint != 0 + ) + as libc::c_uint + != 0 { current_block = 14523688961733284890; break; @@ -1182,12 +1182,12 @@ unsafe extern "C" fn CONNECT( if (Curl_checkProxyheaders( data, conn, - b"User-Agent\0" as *const u8 as *const libc::c_char, + b"User-Agent\0" as *const u8 + as *const libc::c_char, )) - .is_null() - && !((*data) - .set - .str_0[STRING_USERAGENT as libc::c_int as usize]) + .is_null() + && !((*data).set.str_0 + [STRING_USERAGENT as libc::c_int as usize]) .is_null() { let mut ua: dynbuf = dynbuf { @@ -1198,19 +1198,28 @@ unsafe extern "C" fn CONNECT( }; Curl_dyn_init( &mut ua, - (1024 as libc::c_int * 1024 as libc::c_int) as size_t, + (1024 as libc::c_int * 1024 as libc::c_int) + as size_t, ); result = Curl_dyn_addf( &mut ua as *mut dynbuf, - b"User-Agent: %s\r\n\0" as *const u8 as *const libc::c_char, - (*data).set.str_0[STRING_USERAGENT as libc::c_int as usize], + b"User-Agent: %s\r\n\0" as *const u8 + as *const libc::c_char, + (*data).set.str_0[STRING_USERAGENT + as libc::c_int + as usize], ); if result as u64 != 0 { current_block = 14523688961733284890; break; } - if Curl_hyper_header(data, headers, Curl_dyn_ptr(&mut ua)) - as u64 != 0 + if Curl_hyper_header( + data, + headers, + Curl_dyn_ptr(&mut ua), + ) + as u64 + != 0 { current_block = 14523688961733284890; break; @@ -1220,15 +1229,19 @@ unsafe extern "C" fn CONNECT( if (Curl_checkProxyheaders( data, conn, - b"Proxy-Connection\0" as *const u8 as *const libc::c_char, + b"Proxy-Connection\0" as *const u8 + as *const libc::c_char, )) - .is_null() + .is_null() && Curl_hyper_header( data, headers, - b"Proxy-Connection: Keep-Alive\0" as *const u8 + b"Proxy-Connection: Keep-Alive\0" + as *const u8 as *const libc::c_char, - ) as libc::c_uint != 0 + ) + as libc::c_uint + != 0 { current_block = 14523688961733284890; break; @@ -1237,7 +1250,9 @@ unsafe extern "C" fn CONNECT( data, 1 as libc::c_int != 0, headers as *mut libc::c_void, - ) as u64 != 0 + ) + as u64 + != 0 { current_block = 14523688961733284890; break; @@ -1252,11 +1267,13 @@ unsafe extern "C" fn CONNECT( current_block = 14523688961733284890; break; } else if HYPERE_OK as libc::c_int as libc::c_uint - != hyper_executor_push((*h).exec, sendtask) as libc::c_uint - { + != hyper_executor_push((*h).exec, sendtask) + as libc::c_uint + { Curl_failf( data, - b"Couldn't hyper_executor_push the send\0" as *const u8 + b"Couldn't hyper_executor_push the send\0" + as *const u8 as *const libc::c_char, ); current_block = 14523688961733284890; @@ -1266,14 +1283,20 @@ unsafe extern "C" fn CONNECT( loop { task = hyper_executor_poll((*h).exec); if !task.is_null() { - let mut error: bool = hyper_task_type(task) as libc::c_uint - == HYPER_TASK_ERROR as libc::c_int as libc::c_uint; + let mut error: bool = + hyper_task_type(task) + as libc::c_uint + == HYPER_TASK_ERROR + as libc::c_int + as libc::c_uint; if error { - hypererr = hyper_task_value(task) as *mut hyper_error; + hypererr = hyper_task_value(task) + as *mut hyper_error; } hyper_task_free(task); if error { - current_block = 14523688961733284890; + current_block = + 14523688961733284890; break 's_65; } } @@ -1344,27 +1367,22 @@ unsafe extern "C" fn CONNECT( match current_block { 14027225908442187354 => { result = CURLE_OK; - if (*s).tunnel_state as libc::c_uint - == TUNNEL_COMPLETE as libc::c_int as libc::c_uint - { + if (*s).tunnel_state as libc::c_uint == TUNNEL_COMPLETE as libc::c_int as libc::c_uint { (*data).info.httpproxycode = (*data).req.httpcode; if (*data).info.httpproxycode / 100 as libc::c_int != 2 as libc::c_int { - if ((*conn).bits).close() as libc::c_int != 0 - && !((*data).req.newurl).is_null() + if ((*conn).bits).close() as libc::c_int != 0 && !((*data).req.newurl).is_null() { let ref mut fresh11 = (*conn).bits; (*fresh11).set_proxy_connect_closed(1 as libc::c_int as bit); Curl_infof( data, - b"Connect me again please\0" as *const u8 - as *const libc::c_char, + b"Connect me again please\0" as *const u8 as *const libc::c_char, ); connect_done(data); } else { - Curl_cfree - .expect( - "non-null function pointer", - )((*data).req.newurl as *mut libc::c_void); + Curl_cfree.expect("non-null function pointer")( + (*data).req.newurl as *mut libc::c_void, + ); let ref mut fresh12 = (*data).req.newurl; *fresh12 = 0 as *mut libc::c_char; Curl_conncontrol(conn, 2 as libc::c_int); @@ -1375,8 +1393,8 @@ unsafe extern "C" fn CONNECT( if ((*conn).bits).proxy_connect_closed() == 0 { Curl_failf( data, - b"Received HTTP code %d from proxy after CONNECT\0" - as *const u8 as *const libc::c_char, + b"Received HTTP code %d from proxy after CONNECT\0" as *const u8 + as *const libc::c_char, (*data).req.httpcode, ); result = CURLE_RECV_ERROR;