diff --git a/lib/macros_to_rust.c b/lib/macros_to_rust.c index 29c968d4ecfe8d5315e870ca0077c2d6159e0882..24efc45a9106b2589c90e69d3b0e82c2d658eab4 100644 --- a/lib/macros_to_rust.c +++ b/lib/macros_to_rust.c @@ -1,12 +1,96 @@ // http2 +#include "curl_setup.h" + +#ifdef USE_NGHTTP2 +#include +#include "urldata.h" +#include "http2.h" +#include "http.h" +#include "sendf.h" +#include "select.h" +#include "curl_base64.h" +#include "strcase.h" +#include "multiif.h" +#include "url.h" +#include "connect.h" +#include "strtoofft.h" +#include "strdup.h" +#include "dynbuf.h" +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" +#include "curl_memory.h" +#include "memdebug.h" +#define H2_BUFSIZE 32768 + +#if (NGHTTP2_VERSION_NUM < 0x010c00) +#error too old nghttp2 version, upgrade! +#endif + +#ifdef CURL_DISABLE_VERBOSE_STRINGS +#define nghttp2_session_callbacks_set_error_callback(x,y) +#endif +#if (NGHTTP2_VERSION_NUM >= 0x010c00) +#define NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE 1 +#endif + +#define HTTP2_HUGE_WINDOW_SIZE (32 * 1024 * 1024) /* 32 MB */ + +#ifdef DEBUG_HTTP2 +#define H2BUGF(x) x +#else +#define H2BUGF(x) do { } while(0) +#endif + + + +#else /* !USE_NGHTTP2 */ +/* Satisfy external references even if http2 is not compiled in. */ +#include + +#endif /* USE_NGHTTP2 */ +int get_USE_NGHTTP2(){ +#ifdef USE_NGHTTP2 + return 1; +#else + return 0; +#endif +} +int get_CURL_DISABLE_VERBOSE_STRINGS(){ +#ifdef CURL_DISABLE_VERBOSE_STRINGS + return 1; +#else + return 0; +#endif +} +int get_DEBUG_HTTP2(){ +#ifdef DEBUG_HTTP2 + return 1; +#else + return 0; +#endif +} +int get_NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE(){ +#ifdef NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE + return 1; +#else + return 0; +#endif +} +int get_DEBUGBUILD(){ +#ifdef DEBUGBUILD + return 1; +#else + return 0; +#endif +} // http_proxy #include "curl_setup.h" #include "http_proxy.h" -// #if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP) +#if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP) #include #ifdef USE_HYPER @@ -29,6 +113,7 @@ #include "curl_memory.h" #include "memdebug.h" +#endif /* CURL_DISABLE_PROXY */ int get_CURL_DISABLE_PROXY(){ #ifdef CURL_DISABLE_PROXY @@ -37,19 +122,317 @@ int get_CURL_DISABLE_PROXY(){ return 0; #endif } - +int get_CURL_DISABLE_HTTP(){ +#ifdef CURL_DISABLE_HTTP + return 1; +#else + return 0; +#endif +} +int get_USE_HYPER(){ +#ifdef USE_HYPER + return 1; +#else + return 0; +#endif +} +int get_USE_SSL(){ +#ifdef USE_SSL + return 1; +#else + return 0; +#endif +} // http_ntlm +#include "curl_setup.h" +#if !defined(CURL_DISABLE_HTTP) && defined(USE_NTLM) + +#define DEBUG_ME 0 + +#include "urldata.h" +#include "sendf.h" +#include "strcase.h" +#include "http_ntlm.h" +#include "curl_ntlm_core.h" +#include "curl_ntlm_wb.h" +#include "curl_base64.h" +#include "vauth/vauth.h" +#include "url.h" + +/* SSL backend-specific #if branches in this file must be kept in the order + documented in curl_ntlm_core. */ +#if defined(USE_WINDOWS_SSPI) +#include "curl_sspi.h" +#endif + +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" +#include "curl_memory.h" +#include "memdebug.h" + +#if DEBUG_ME +# define DEBUG_OUT(x) x +#else +# define DEBUG_OUT(x) Curl_nop_stmt +#endif +#endif /* !CURL_DISABLE_HTTP && USE_NTLM */ +int get_USE_NTLM(){ +#ifdef USE_NTLM + return 1; +#else + return 0; +#endif +} +int get_USE_WINDOWS_SSPI(){ +#ifdef USE_WINDOWS_SSPI + return 1; +#else + return 0; +#endif +} +int get_NTLM_WB_ENABLED(){ +#ifdef NTLM_WB_ENABLED + return 1; +#else + return 0; +#endif +} +int get_SECPKG_ATTR_ENDPOINT_BINDINGS(){ +#ifdef SECPKG_ATTR_ENDPOINT_BINDINGS + return 1; +#else + return 0; +#endif +} // http_negotiate // http_digest +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) + +#include "urldata.h" +#include "strcase.h" +#include "vauth/vauth.h" +#include "http_digest.h" + +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" +#include "curl_memory.h" +#include "memdebug.h" +#endif + +int get_CURL_DISABLE_CRYPTO_AUTH(){ +#ifdef CURL_DISABLE_CRYPTO_AUTH + return 1; +#else + return 0; +#endif +} // http_chunks +#include "curl_setup.h" + +#ifndef CURL_DISABLE_HTTP + +#include "urldata.h" /* it includes http_chunks.h */ +#include "sendf.h" /* for the client write stuff */ +#include "dynbuf.h" +#include "content_encoding.h" +#include "http.h" +#include "non-ascii.h" /* for Curl_convert_to_network prototype */ +#include "strtoofft.h" +#include "warnless.h" + +/* The last #include files should be: */ +#include "curl_memory.h" +#include "memdebug.h" +#endif /* CURL_DISABLE_HTTP */ + +int get_CURL_DOES_CONVERSIONS(){ +#ifdef CURL_DOES_CONVERSIONS + return 1; +#else + return 0; +#endif +} // http_aws_sigv4 +// no macro // http +#include "curl_setup.h" + +#ifndef CURL_DISABLE_HTTP + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef USE_HYPER +#include +#endif + +#include "urldata.h" +#include +#include "transfer.h" +#include "sendf.h" +#include "formdata.h" +#include "mime.h" +#include "progress.h" +#include "curl_base64.h" +#include "cookie.h" +#include "vauth/vauth.h" +#include "vtls/vtls.h" +#include "http_digest.h" +#include "http_ntlm.h" +#include "curl_ntlm_wb.h" +#include "http_negotiate.h" +#include "http_aws_sigv4.h" +#include "url.h" +#include "share.h" +#include "hostip.h" +#include "http.h" +#include "select.h" +#include "parsedate.h" /* for the week day and month names */ +#include "strtoofft.h" +#include "multiif.h" +#include "strcase.h" +#include "content_encoding.h" +#include "http_proxy.h" +#include "warnless.h" +#include "non-ascii.h" +#include "http2.h" +#include "connect.h" +#include "strdup.h" +#include "altsvc.h" +#include "hsts.h" +#include "c-hyper.h" + +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" +#include "curl_memory.h" +#include "memdebug.h" +#endif /* CURL_DISABLE_HTTP */ + +int get_USE_SPNEGO(){ +#ifdef USE_SPNEGO + return 1; +#else + return 0; +#endif +} +int get_CURLDEBUG(){ +#ifdef CURLDEBUG + return 1; +#else + return 0; +#endif +} +int get_USE_UNIX_SOCKETS(){ +#ifdef USE_UNIX_SOCKETS + return 1; +#else + return 0; +#endif +} +int get_ENABLE_QUIC(){ +#ifdef ENABLE_QUIC + return 1; +#else + return 0; +#endif +} +int get_CURL_DO_LINEEND_CONV(){ +#ifdef CURL_DO_LINEEND_CONV + return 1; +#else + return 0; +#endif +} +int get_HAVE_LIBZ(){ +#ifdef HAVE_LIBZ + return 1; +#else + return 0; +#endif +} +int get_CURL_DISABLE_HTTP_AUTH(){ +#ifdef CURL_DISABLE_HTTP_AUTH + return 1; +#else + return 0; +#endif +} +int get_CURL_DISABLE_NETRC(){ +#ifdef CURL_DISABLE_NETRC + return 1; +#else + return 0; +#endif +} +int get_CURL_DISABLE_PARSEDATE(){ +#ifdef CURL_DISABLE_PARSEDATE + return 1; +#else + return 0; +#endif +} +int get_CURL_DISABLE_MIME(){ +#ifdef CURL_DISABLE_MIME + return 1; +#else + return 0; +#endif +} +int get_CURL_DISABLE_ALTSVC(){ +#ifdef CURL_DISABLE_ALTSVC + return 1; +#else + return 0; +#endif +} +int get_CURL_DISABLE_RTSP(){ +#ifdef CURL_DISABLE_RTSP + return 1; +#else + return 0; +#endif +} +int get_CURL_DISABLE_HSTS(){ +#ifdef CURL_DISABLE_HSTS + return 1; +#else + return 0; +#endif +} +int get_CURL_DISABLE_COOKIES(){ +#ifdef CURL_DISABLE_COOKIES + return 1; +#else + return 0; +#endif +} + // ftplistparser // ftp @@ -61,7 +444,20 @@ int get_CURL_DISABLE_PROXY(){ // gtls // keylog +#include "curl_setup.h" + +#include "vtls/keylog.h" +/* The last #include files should be: */ +#include "curl_memory.h" +#include "memdebug.h" +int get_WIN32(){ +#ifdef WIN32 + return 1; +#else + return 0; +#endif +} // mbedtls // mbedtls_threadlock diff --git a/rust/rust_ffi/src/ffi_macros/get_macros.rs b/rust/rust_ffi/src/ffi_macros/get_macros.rs index d7cdf2ed07b56719220538dd89720f630fb135e2..5551e65434813e09e0c4097520e496f7973f82a1 100644 --- a/rust/rust_ffi/src/ffi_macros/get_macros.rs +++ b/rust/rust_ffi/src/ffi_macros/get_macros.rs @@ -1,20 +1,43 @@ extern "C" { // http2 - - + fn get_USE_NGHTTP2() -> i32; + fn get_CURL_DISABLE_VERBOSE_STRINGS() -> i32; + fn get_DEBUG_HTTP2() -> i32; + fn get_NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE() -> i32; + fn get_DEBUGBUILD() -> i32; // http_proxy fn get_CURL_DISABLE_PROXY() -> i32; + fn get_CURL_DISABLE_HTTP() -> i32; + fn get_USE_HYPER() -> i32; + fn get_USE_SSL() -> i32; // http_ntlm - + fn get_USE_NTLM() -> i32; + fn get_USE_WINDOWS_SSPI() -> i32; + fn get_NTLM_WB_ENABLED() -> i32; + fn get_SECPKG_ATTR_ENDPOINT_BINDINGS() -> i32; // http_negotiate // http_digest - + fn get_CURL_DISABLE_CRYPTO_AUTH() -> i32; // http_chunks - + fn get_CURL_DOES_CONVERSIONS() -> i32; // http_aws_sigv4 - + // no macro // http + fn get_USE_SPNEGO() -> i32; + fn get_CURLDEBUG() -> i32; + fn get_USE_UNIX_SOCKETS() -> i32; + fn get_ENABLE_QUIC() -> i32; + fn get_CURL_DO_LINEEND_CONV() -> i32; + fn get_HAVE_LIBZ() -> i32; + fn get_CURL_DISABLE_HTTP_AUTH() -> i32; + fn get_CURL_DISABLE_NETRC() -> i32; + fn get_CURL_DISABLE_PARSEDATE() -> i32; + fn get_CURL_DISABLE_MIME() -> i32; + fn get_CURL_DISABLE_ALTSVC() -> i32; + fn get_CURL_DISABLE_RTSP() -> i32; + fn get_CURL_DISABLE_HSTS() -> i32; + fn get_CURL_DISABLE_COOKIES() -> i32; // ftplistparser @@ -27,6 +50,7 @@ extern "C" { // gtls // keylog + fn get_WIN32() -> i32; // mbedtls @@ -46,21 +70,44 @@ extern "C" { } pub fn get_all_cfg() { // http2 - - + get_USE_NGHTTP2_add_cfg(); + get_CURL_DISABLE_VERBOSE_STRINGS_add_cfg(); + get_DEBUG_HTTP2_add_cfg(); + get_NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE_add_cfg(); + get_DEBUGBUILD_add_cfg(); // http_proxy get_CURL_DISABLE_PROXY_add_cfg(); + get_CURL_DISABLE_HTTP_add_cfg(); + get_USE_HYPER_add_cfg(); + get_USE_SSL_add_cfg(); // http_ntlm - + get_USE_NTLM_add_cfg(); + get_USE_WINDOWS_SSPI_add_cfg(); + get_NTLM_WB_ENABLED_add_cfg(); + get_SECPKG_ATTR_ENDPOINT_BINDINGS_add_cfg(); // http_negotiate // http_digest - + get_CURL_DISABLE_CRYPTO_AUTH_add_cfg(); // http_chunks - + get_CURL_DOES_CONVERSIONS_add_cfg(); // http_aws_sigv4 // http + get_USE_SPNEGO_add_cfg(); + get_CURLDEBUG_add_cfg(); + get_USE_UNIX_SOCKETS_add_cfg(); + get_ENABLE_QUIC_add_cfg(); + get_CURL_DO_LINEEND_CONV_add_cfg(); + get_HAVE_LIBZ_add_cfg(); + get_CURL_DISABLE_HTTP_AUTH_add_cfg(); + get_CURL_DISABLE_NETRC_add_cfg(); + get_CURL_DISABLE_PARSEDATE_add_cfg(); + get_CURL_DISABLE_MIME_add_cfg(); + get_CURL_DISABLE_ALTSVC_add_cfg(); + get_CURL_DISABLE_RTSP_add_cfg(); + get_CURL_DISABLE_HSTS_add_cfg(); + get_CURL_DISABLE_COOKIES_add_cfg(); // ftplistparser @@ -73,6 +120,7 @@ pub fn get_all_cfg() { // gtls // keylog + get_WIN32_add_cfg(); // mbedtls @@ -92,25 +140,160 @@ pub fn get_all_cfg() { } // http2 - - +fn get_USE_NGHTTP2_add_cfg() { + if unsafe { get_USE_NGHTTP2() } == 1 { + println!("cargo:rustc-cfg=USE_NGHTTP2"); + } +} +fn get_CURL_DISABLE_VERBOSE_STRINGS_add_cfg() { + if unsafe { get_CURL_DISABLE_VERBOSE_STRINGS() } == 1 { + println!("cargo:rustc-cfg=CURL_DISABLE_VERBOSE_STRINGS"); + } +} +fn get_DEBUG_HTTP2_add_cfg() { + if unsafe { get_DEBUG_HTTP2() } == 1 { + println!("cargo:rustc-cfg=DEBUG_HTTP2"); + } +} +fn get_NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE_add_cfg() { + if unsafe { get_NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE() } == 1 { + println!("cargo:rustc-cfg=NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE"); + } +} +fn get_DEBUGBUILD_add_cfg() { + if unsafe { get_DEBUGBUILD() } == 1 { + println!("cargo:rustc-cfg=DEBUGBUILD"); + } +} // http_proxy fn get_CURL_DISABLE_PROXY_add_cfg() { if unsafe { get_CURL_DISABLE_PROXY() } == 1 { println!("cargo:rustc-cfg=CURL_DISABLE_PROXY"); } } +fn get_CURL_DISABLE_HTTP_add_cfg() { + if unsafe { get_CURL_DISABLE_HTTP() } == 1 { + println!("cargo:rustc-cfg=CURL_DISABLE_HTTP"); + } +} +fn get_USE_HYPER_add_cfg() { + if unsafe { get_USE_HYPER() } == 1 { + println!("cargo:rustc-cfg=USE_HYPER"); + } +} +fn get_USE_SSL_add_cfg() { + if unsafe { get_USE_SSL() } == 1 { + println!("cargo:rustc-cfg=USE_SSL"); + } +} // http_ntlm - +fn get_USE_NTLM_add_cfg() { + if unsafe { get_USE_NTLM() } == 1 { + println!("cargo:rustc-cfg=USE_NTLM"); + } +} +fn get_USE_WINDOWS_SSPI_add_cfg() { + if unsafe { get_USE_WINDOWS_SSPI() } == 1 { + println!("cargo:rustc-cfg=USE_WINDOWS_SSPI"); + } +} +fn get_NTLM_WB_ENABLED_add_cfg() { + if unsafe { get_NTLM_WB_ENABLED() } == 1 { + println!("cargo:rustc-cfg=NTLM_WB_ENABLED"); + } +} +fn get_SECPKG_ATTR_ENDPOINT_BINDINGS_add_cfg() { + if unsafe { get_SECPKG_ATTR_ENDPOINT_BINDINGS() } == 1 { + println!("cargo:rustc-cfg=SECPKG_ATTR_ENDPOINT_BINDINGS"); + } +} // http_negotiate // http_digest - +fn get_CURL_DISABLE_CRYPTO_AUTH_add_cfg() { + if unsafe { get_CURL_DISABLE_CRYPTO_AUTH() } == 1 { + println!("cargo:rustc-cfg=CURL_DISABLE_CRYPTO_AUTH"); + } +} // http_chunks - +fn get_CURL_DOES_CONVERSIONS_add_cfg() { + if unsafe { get_CURL_DOES_CONVERSIONS() } == 1 { + println!("cargo:rustc-cfg=CURL_DOES_CONVERSIONS"); + } +} // http_aws_sigv4 // http +fn get_USE_SPNEGO_add_cfg() { + if unsafe { get_USE_SPNEGO() } == 1 { + println!("cargo:rustc-cfg=USE_SPNEGO"); + } +} +fn get_CURLDEBUG_add_cfg() { + if unsafe { get_CURLDEBUG() } == 1 { + println!("cargo:rustc-cfg=CURLDEBUG"); + } +} +fn get_USE_UNIX_SOCKETS_add_cfg() { + if unsafe { get_USE_UNIX_SOCKETS() } == 1 { + println!("cargo:rustc-cfg=USE_UNIX_SOCKETS"); + } +} +fn get_ENABLE_QUIC_add_cfg() { + if unsafe { get_ENABLE_QUIC() } == 1 { + println!("cargo:rustc-cfg=ENABLE_QUIC"); + } +} +fn get_CURL_DO_LINEEND_CONV_add_cfg() { + if unsafe { get_CURL_DO_LINEEND_CONV() } == 1 { + println!("cargo:rustc-cfg=CURL_DO_LINEEND_CONV"); + } +} +fn get_HAVE_LIBZ_add_cfg() { + if unsafe { get_HAVE_LIBZ() } == 1 { + println!("cargo:rustc-cfg=HAVE_LIBZ"); + } +} +fn get_CURL_DISABLE_HTTP_AUTH_add_cfg() { + if unsafe { get_CURL_DISABLE_HTTP_AUTH() } == 1 { + println!("cargo:rustc-cfg=CURL_DISABLE_HTTP_AUTH"); + } +} +fn get_CURL_DISABLE_NETRC_add_cfg() { + if unsafe { get_CURL_DISABLE_NETRC() } == 1 { + println!("cargo:rustc-cfg=CURL_DISABLE_NETRC"); + } +} +fn get_CURL_DISABLE_PARSEDATE_add_cfg() { + if unsafe { get_CURL_DISABLE_PARSEDATE() } == 1 { + println!("cargo:rustc-cfg=CURL_DISABLE_PARSEDATE"); + } +} +fn get_CURL_DISABLE_MIME_add_cfg() { + if unsafe { get_CURL_DISABLE_MIME() } == 1 { + println!("cargo:rustc-cfg=CURL_DISABLE_MIME"); + } +} +fn get_CURL_DISABLE_ALTSVC_add_cfg() { + if unsafe { get_CURL_DISABLE_ALTSVC() } == 1 { + println!("cargo:rustc-cfg=CURL_DISABLE_ALTSVC"); + } +} +fn get_CURL_DISABLE_RTSP_add_cfg() { + if unsafe { get_CURL_DISABLE_RTSP() } == 1 { + println!("cargo:rustc-cfg=CURL_DISABLE_RTSP"); + } +} +fn get_CURL_DISABLE_HSTS_add_cfg() { + if unsafe { get_CURL_DISABLE_HSTS() } == 1 { + println!("cargo:rustc-cfg=CURL_DISABLE_HSTS"); + } +} +fn get_CURL_DISABLE_COOKIES_add_cfg() { + if unsafe { get_CURL_DISABLE_COOKIES() } == 1 { + println!("cargo:rustc-cfg=CURL_DISABLE_COOKIES"); + } +} // ftplistparser @@ -123,7 +306,11 @@ fn get_CURL_DISABLE_PROXY_add_cfg() { // gtls // keylog - +fn get_WIN32_add_cfg() { + if unsafe { get_WIN32() } == 1 { + println!("cargo:rustc-cfg=WIN32"); + } +} // mbedtls // mbedtls_threadlock