#ifndef HEADER_CURL_SETUP_H
#define HEADER_CURL_SETUP_H
#if defined(BUILDING_LIBCURL) && !defined(CURL_NO_OLDIES)
#define CURL_NO_OLDIES
#endif
#ifdef __MINGW32__
#include <_mingw.h>
#endif
#if defined(__APPLE__) && !defined(__clang__) && defined(__GNUC__) && \
defined(__has_attribute)
# if !defined(__has_feature)
# define availability curl_pp_attribute_disabled
# elif !__has_feature(attribute_availability)
# define availability curl_pp_attribute_disabled
# endif
#endif
#ifdef __APPLE__
#include <sys/types.h>
#include <TargetConditionals.h>
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC && \
defined(TARGET_OS_OSX) && !TARGET_OS_OSX && \
(!defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE) && \
(!defined(TARGET_OS_SIMULATOR) || !TARGET_OS_SIMULATOR)
#undef TARGET_OS_OSX
#define TARGET_OS_OSX TARGET_OS_MAC
#endif
#endif
#if defined(__MINGW32__) && !defined(__MINGW32CE__) && \
(!defined(__MINGW64_VERSION_MAJOR) || (__MINGW64_VERSION_MAJOR < 3))
#error "Building curl requires mingw-w64 3.0 or later"
#endif
#if defined(_MSC_VER) && (_MSC_VER < 1500)
#error "Ancient versions of Visual Studio are no longer supported due to bugs."
#endif
#ifdef _MSC_VER
#pragma warning(disable:4127)
#ifndef _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE
#endif
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#endif
#ifdef _WIN32
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# ifndef NOGDI
# define NOGDI
# endif
# if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
defined(WINAPI_FAMILY)
# include <winapifamily.h>
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
# define CURL_WINDOWS_UWP
# endif
# endif
#endif
#if defined(__MINGW32CE__) && !defined(CURL_NO_FMT_CHECKS) && \
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) && \
(defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 4))
#define CURL_NO_FMT_CHECKS
#endif
#ifdef ENABLE_IPV6
#define USE_IPV6 1
#endif
#ifdef HAVE_CONFIG_H
#include "curl_config.h"
#else
#ifdef _WIN32
# include "config-win32.h"
#endif
#ifdef macintosh
# include "config-mac.h"
#endif
#ifdef __riscos__
# include "config-riscos.h"
#endif
#ifdef __OS400__
# include "config-os400.h"
#endif
#ifdef __PLAN9__
# include "config-plan9.h"
#endif
#endif
#ifdef HAVE_LIBZ
# ifndef ZLIB_CONST
# define ZLIB_CONST
# endif
#endif
#ifdef NEED_THREAD_SAFE
# ifndef _THREAD_SAFE
# define _THREAD_SAFE
# endif
#endif
#ifdef NEED_REENTRANT
# ifndef _REENTRANT
# define _REENTRANT
# endif
#endif
#if defined(sun) || defined(__sun)
# ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
# endif
#endif
#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
# include <pthread.h>
#endif
#ifdef HTTP_ONLY
# ifndef CURL_DISABLE_DICT
# define CURL_DISABLE_DICT
# endif
# ifndef CURL_DISABLE_FILE
# define CURL_DISABLE_FILE
# endif
# ifndef CURL_DISABLE_FTP
# define CURL_DISABLE_FTP
# endif
# ifndef CURL_DISABLE_GOPHER
# define CURL_DISABLE_GOPHER
# endif
# ifndef CURL_DISABLE_IMAP
# define CURL_DISABLE_IMAP
# endif
# ifndef CURL_DISABLE_LDAP
# define CURL_DISABLE_LDAP
# endif
# ifndef CURL_DISABLE_LDAPS
# define CURL_DISABLE_LDAPS
# endif
# ifndef CURL_DISABLE_MQTT
# define CURL_DISABLE_MQTT
# endif
# ifndef CURL_DISABLE_POP3
# define CURL_DISABLE_POP3
# endif
# ifndef CURL_DISABLE_RTSP
# define CURL_DISABLE_RTSP
# endif
# ifndef CURL_DISABLE_SMB
# define CURL_DISABLE_SMB
# endif
# ifndef CURL_DISABLE_SMTP
# define CURL_DISABLE_SMTP
# endif
# ifndef CURL_DISABLE_TELNET
# define CURL_DISABLE_TELNET
# endif
# ifndef CURL_DISABLE_TFTP
# define CURL_DISABLE_TFTP
# endif
#endif
#if defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_RTSP)
# define CURL_DISABLE_RTSP
#endif
#ifdef CURL_DISABLE_HTTP
# define CURL_DISABLE_ALTSVC 1
# define CURL_DISABLE_COOKIES 1
# define CURL_DISABLE_BASIC_AUTH 1
# define CURL_DISABLE_BEARER_AUTH 1
# define CURL_DISABLE_AWS 1
# define CURL_DISABLE_DOH 1
# define CURL_DISABLE_FORM_API 1
# define CURL_DISABLE_HEADERS_API 1
# define CURL_DISABLE_HSTS 1
# define CURL_DISABLE_HTTP_AUTH 1
#endif
#ifdef __OS400__
# include "setup-os400.h"
#endif
#ifdef __VMS
# include "setup-vms.h"
#endif
#ifdef _WIN32
# include "setup-win32.h"
#endif
#include <curl/system.h>
#define CURL_CONC_MACROS_(A,B) A ## B
#define CURL_CONC_MACROS(A,B) CURL_CONC_MACROS_(A,B)
#ifdef __MINGW32__
# undef CURL_FORMAT_CURL_OFF_T
# undef CURL_FORMAT_CURL_OFF_TU
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
#endif
#if (defined(__GNUC__) || defined(__clang__) || \
defined(__IAR_SYSTEMS_ICC__)) && \
defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
!defined(CURL_NO_FMT_CHECKS)
#if defined(__MINGW32__) && !defined(__clang__)
#define CURL_PRINTF(fmt, arg) \
__attribute__((format(gnu_printf, fmt, arg)))
#else
#define CURL_PRINTF(fmt, arg) \
__attribute__((format(__printf__, fmt, arg)))
#endif
#else
#define CURL_PRINTF(fmt, arg)
#endif
#define CURL_TEMP_PRINTF CURL_PRINTF
#if defined(__APPLE__) && \
((!defined(__apple_build_version__) && \
defined(__clang__) && __clang_major__ < 17) || \
(defined(__GNUC__) && __GNUC__ <= 14)) && \
defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
!defined(__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__)
#define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ \
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
#endif
#if defined(__APPLE__) && !defined(USE_ARES)
# define USE_RESOLVE_ON_IPS 1
# if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && \
defined(USE_IPV6)
# define CURL_MACOS_CALL_COPYPROXIES 1
# endif
#endif
#ifdef USE_ARES
# ifndef CARES_NO_DEPRECATED
# define CARES_NO_DEPRECATED
# endif
# if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && defined(_WIN32)
# define CARES_STATICLIB
# endif
#endif
#ifdef USE_LWIPSOCK
# include <lwip/init.h>
# include <lwip/sockets.h>
# include <lwip/netdb.h>
#endif
#ifdef macintosh
# include <extra/stricmp.h>
# include <extra/strdup.h>
#endif
#ifdef __AMIGA__
# ifdef __amigaos4__
# define __USE_INLINE__
# define CURLRES_AMIGA
# undef HAVE_GETADDRINFO
# if !(defined(__NEWLIB__) || \
(defined(__CLIB2__) && defined(__THREAD_SAFE)))
# undef USE_THREADS_POSIX
# endif
# endif
# include <exec/types.h>
# include <exec/execbase.h>
# include <proto/exec.h>
# include <proto/dos.h>
# include <unistd.h>
# if defined(HAVE_PROTO_BSDSOCKET_H) && \
(!defined(__amigaos4__) || defined(USE_AMISSL))
# define _SYS_MBUF_H
# include <proto/bsdsocket.h>
# ifdef __amigaos4__
int Curl_amiga_select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *errorfds, struct timeval *timeout);
# define select(a,b,c,d,e) Curl_amiga_select(a,b,c,d,e)
# else
# define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
# endif
# undef HAVE_FCNTL
# undef HAVE_FCNTL_O_NONBLOCK
# else
# undef HAVE_CLOSESOCKET_CAMEL
# undef HAVE_IOCTLSOCKET_CAMEL
# endif
# define __NO_NET_API
#endif
#if defined(HAVE_EVENTFD) && defined(HAVE_SYS_EVENTFD_H)
#define USE_EVENTFD
#endif
#include <stdio.h>
#include <assert.h>
#ifdef __TANDEM
# if ! defined __LP64
# include <floss.h>
# endif
#endif
#ifndef STDC_HEADERS
#include <curl/stdcheaders.h>
#endif
#if defined(HAVE_STDINT_H) || defined(USE_WOLFSSL)
#include <stdint.h>
#endif
#include <limits.h>
#ifdef _WIN32
# ifdef HAVE_IO_H
# include <io.h>
# endif
# include <sys/types.h>
# include <sys/stat.h>
# ifdef USE_WIN32_LARGE_FILES
# undef lseek
# define lseek(fdes, offset, whence) _lseeki64(fdes, offset, whence)
# undef fstat
# define fstat(fdes,stp) _fstati64(fdes, stp)
# undef stat
# define struct_stat struct _stati64
# define LSEEK_ERROR (__int64)-1
# else
# ifndef UNDER_CE
# undef lseek
# define lseek(fdes, offset, whence) _lseek(fdes, (long)offset, whence)
# define fstat(fdes, stp) _fstat(fdes, stp)
# define struct_stat struct _stat
# endif
# define LSEEK_ERROR (long)-1
# endif
#elif defined(__DJGPP__)
# include <unistd.h>
# undef lseek
# define lseek(fdes,offset,whence) llseek(fdes, offset, whence)
# define LSEEK_ERROR (offset_t)-1
#endif
#ifndef struct_stat
#define struct_stat struct stat
#endif
#ifndef LSEEK_ERROR
#define LSEEK_ERROR (off_t)-1
#endif
#ifndef SIZEOF_TIME_T
#define SIZEOF_TIME_T 4
#endif
#ifndef SIZEOF_CURL_SOCKET_T
# ifdef _WIN64
# define SIZEOF_CURL_SOCKET_T 8
# else
# define SIZEOF_CURL_SOCKET_T 4
# endif
#endif
#if SIZEOF_CURL_SOCKET_T < 8
# define FMT_SOCKET_T "d"
#elif defined(__MINGW32__)
# define FMT_SOCKET_T "zd"
#else
# define FMT_SOCKET_T "qd"
#endif
#ifndef SIZEOF_OFF_T
# if defined(__VMS) && !defined(__VAX)
# ifdef _LARGEFILE
# define SIZEOF_OFF_T 8
# endif
# elif defined(__OS400__) && defined(__ILEC400__)
# ifdef _LARGE_FILES
# define SIZEOF_OFF_T 8
# endif
# elif defined(__MVS__) && defined(__IBMC__)
# if defined(_LP64) || defined(_LARGE_FILES)
# define SIZEOF_OFF_T 8
# endif
# elif defined(__370__) && defined(__IBMC__)
# if defined(_LP64) || defined(_LARGE_FILES)
# define SIZEOF_OFF_T 8
# endif
# endif
# ifndef SIZEOF_OFF_T
# define SIZEOF_OFF_T 4
# endif
#endif
#if (SIZEOF_CURL_OFF_T < 8)
#error "too small curl_off_t"
#else
# define CURL_OFF_T_MAX 0x7FFFFFFFFFFFFFFF
#endif
#define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - 1)
#if (SIZEOF_CURL_OFF_T != 8)
# error "curl_off_t must be exactly 64 bits"
#else
typedef unsigned CURL_TYPEOF_CURL_OFF_T curl_uint64_t;
typedef CURL_TYPEOF_CURL_OFF_T curl_int64_t;
# ifndef CURL_SUFFIX_CURL_OFF_TU
# error "CURL_SUFFIX_CURL_OFF_TU must be defined"
# endif
# define CURL_UINT64_SUFFIX CURL_SUFFIX_CURL_OFF_TU
# define CURL_UINT64_C(val) CURL_CONC_MACROS(val,CURL_UINT64_SUFFIX)
# define FMT_PRId64 CURL_FORMAT_CURL_OFF_T
# define FMT_PRIu64 CURL_FORMAT_CURL_OFF_TU
#endif
#define FMT_OFF_T CURL_FORMAT_CURL_OFF_T
#define FMT_OFF_TU CURL_FORMAT_CURL_OFF_TU
#if (SIZEOF_TIME_T == 4)
# ifdef HAVE_TIME_T_UNSIGNED
# define TIME_T_MAX UINT_MAX
# define TIME_T_MIN 0
# else
# define TIME_T_MAX INT_MAX
# define TIME_T_MIN INT_MIN
# endif
#else
# ifdef HAVE_TIME_T_UNSIGNED
# define TIME_T_MAX 0xFFFFFFFFFFFFFFFF
# define TIME_T_MIN 0
# else
# define TIME_T_MAX 0x7FFFFFFFFFFFFFFF
# define TIME_T_MIN (-TIME_T_MAX - 1)
# endif
#endif
#ifndef SIZE_MAX
#if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4)
#define SIZE_MAX 18446744073709551615U
#else
#define SIZE_MAX 4294967295U
#endif
#endif
#ifndef SSIZE_MAX
#if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4)
#define SSIZE_MAX 9223372036854775807
#else
#define SSIZE_MAX 2147483647
#endif
#endif
#ifndef GETHOSTNAME_TYPE_ARG2
# ifdef USE_WINSOCK
# define GETHOSTNAME_TYPE_ARG2 int
# else
# define GETHOSTNAME_TYPE_ARG2 size_t
# endif
#endif
#ifdef _WIN32
# define DIR_CHAR "\\"
#else
# ifdef MSDOS
# include <sys/ioctl.h>
# define select(n,r,w,x,t) select_s(n,r,w,x,t)
# define ioctl(x,y,z) ioctlsocket(x,y,(char *)(z))
# include <tcp.h>
# undef word
# undef byte
# endif
# ifdef __minix
extern struct tm *gmtime_r(const time_t * const timep, struct tm *tmp);
# endif
# define DIR_CHAR "/"
#endif
#if defined(USE_IPV6) && defined(HAVE_GETADDRINFO)
# define CURLRES_IPV6
#elif defined(USE_IPV6) && (defined(_WIN32) || defined(__CYGWIN__))
# error "Unexpected build: IPv6 is enabled but getaddrinfo was not found."
#else
# define CURLRES_IPV4
#endif
#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
# define CURLRES_ASYNCH
# define CURLRES_THREADED
#elif defined(USE_ARES)
# define CURLRES_ASYNCH
# define CURLRES_ARES
# undef HAVE_GETADDRINFO
# undef HAVE_FREEADDRINFO
#else
# define CURLRES_SYNCH
#endif
#if defined(HAVE_LIBIDN2) && defined(HAVE_IDN2_H) && \
!defined(USE_WIN32_IDN) && !defined(USE_APPLE_IDN)
#define USE_LIBIDN2
#endif
#if defined(USE_LIBIDN2) && (defined(USE_WIN32_IDN) || defined(USE_APPLE_IDN))
#error "libidn2 cannot be enabled with WinIDN or AppleIDN, choose one."
#endif
#if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || \
defined(USE_RUSTLS)
#define USE_SSL
#endif
#if defined(USE_OPENSSL) && defined(USE_WOLFSSL)
# include <wolfssl/version.h>
# if LIBWOLFSSL_VERSION_HEX >= 0x05007006
# ifndef OPENSSL_COEXIST
# define OPENSSL_COEXIST
# endif
# else
# error "OpenSSL can only coexist with wolfSSL v5.7.6 or upper"
# endif
#endif
#if defined(USE_WOLFSSL) && defined(USE_GNUTLS)
#define NO_OLD_WC_NAMES
#endif
#if !defined(CURL_DISABLE_NEGOTIATE_AUTH) && \
(defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
#define USE_SPNEGO
#endif
#if !defined(CURL_DISABLE_KERBEROS_AUTH) && \
(defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
#define USE_KERBEROS5
#endif
#ifndef CURL_DISABLE_NTLM
# if (defined(USE_OPENSSL) && defined(HAVE_DES_ECB_ENCRYPT)) || \
defined(USE_GNUTLS) || \
(defined(USE_MBEDTLS) && defined(HAVE_MBEDTLS_DES_CRYPT_ECB)) || \
defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
(defined(USE_WOLFSSL) && defined(HAVE_WOLFSSL_DES_ECB_ENCRYPT))
# define USE_CURL_NTLM_CORE
# endif
# if defined(USE_CURL_NTLM_CORE) || defined(USE_WINDOWS_SSPI)
# define USE_NTLM
# endif
#endif
#if defined(USE_LIBSSH2) || defined(USE_LIBSSH)
#define USE_SSH
#endif
#if defined(__GNUC__) && ((__GNUC__ >= 3) || \
((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
# define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#elif defined(__IAR_SYSTEMS_ICC__) && (__VER__ >= 9040001)
# define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
# define WARN_UNUSED_RESULT
#endif
#ifndef CURL_NORETURN
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__) || \
defined(__IAR_SYSTEMS_ICC__)
# define CURL_NORETURN __attribute__((__noreturn__))
#elif defined(_MSC_VER)
# define CURL_NORETURN __declspec(noreturn)
#else
# define CURL_NORETURN
#endif
#endif
#ifndef FALLTHROUGH
#if (defined(__GNUC__) && __GNUC__ >= 7) || \
(defined(__clang__) && __clang_major__ >= 10)
# define FALLTHROUGH() __attribute__((fallthrough))
#else
# define FALLTHROUGH() do {} while (0)
#endif
#endif
#ifndef HEADER_CURL_SETUP_ONCE_H
#include "curl_setup_once.h"
#endif
#ifdef UNDER_CE
#define getenv curl_getenv
#define raise(s) ((void)(s))
#define errno 0
#define CURL_SETERRNO(x) ((void)(x))
#define EINTR 4
#define EAGAIN 11
#define ENOMEM 12
#define EACCES 13
#define EEXIST 17
#define EISDIR 21
#define EINVAL 22
#define ENOSPC 28
#define strerror(x) "?"
#undef STDIN_FILENO
#define STDIN_FILENO 0
#else
#define CURL_SETERRNO(x) (errno = (x))
#endif
#ifndef Curl_nop_stmt
#define Curl_nop_stmt do { } while(0)
#endif
#if defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H)
# if defined(SOCKET) || defined(USE_WINSOCK)
# error "Winsock and lwIP TCP/IP stack definitions shall not coexist!"
# endif
#endif
#ifndef SHUT_RD
#define SHUT_RD 0x00
#endif
#ifndef SHUT_WR
#define SHUT_WR 0x01
#endif
#ifndef SHUT_RDWR
#define SHUT_RDWR 0x02
#endif
#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
#ifndef STDIN_FILENO
#define STDIN_FILENO fileno(stdin)
#endif
#ifndef STDOUT_FILENO
#define STDOUT_FILENO fileno(stdout)
#endif
#ifndef STDERR_FILENO
#define STDERR_FILENO fileno(stderr)
#endif
#ifdef O_BINARY
#define CURL_O_BINARY O_BINARY
#else
#define CURL_O_BINARY 0
#endif
#if defined(_WIN32) || defined(MSDOS)
#define FOPEN_READTEXT "rt"
#define FOPEN_WRITETEXT "wt"
#define FOPEN_APPENDTEXT "at"
#elif defined(__CYGWIN__)
#define FOPEN_READTEXT "rt"
#define FOPEN_WRITETEXT "w"
#define FOPEN_APPENDTEXT "a"
#else
#define FOPEN_READTEXT "r"
#define FOPEN_WRITETEXT "w"
#define FOPEN_APPENDTEXT "a"
#endif
#ifndef CURL_SA_FAMILY_T
# if defined(_WIN32) && !defined(UNDER_CE)
# define CURL_SA_FAMILY_T ADDRESS_FAMILY
# elif defined(HAVE_SA_FAMILY_T)
# define CURL_SA_FAMILY_T sa_family_t
# elif defined(__AMIGA__)
# define CURL_SA_FAMILY_T unsigned char
# else
# define CURL_SA_FAMILY_T unsigned short
# endif
#endif
#define CURLMAX(x,y) ((x)>(y)?(x):(y))
#define CURLMIN(x,y) ((x)<(y)?(x):(y))
#define STRCONST(x) x,sizeof(x)-1
#define CURL_ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
#define STRERROR_LEN 256
#ifndef CURL_DID_MEMORY_FUNC_TYPEDEFS
typedef void *(*curl_malloc_callback)(size_t size);
typedef void (*curl_free_callback)(void *ptr);
typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
typedef char *(*curl_strdup_callback)(const char *str);
typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
#define CURL_DID_MEMORY_FUNC_TYPEDEFS
#endif
extern curl_malloc_callback Curl_cmalloc;
extern curl_free_callback Curl_cfree;
extern curl_realloc_callback Curl_crealloc;
extern curl_strdup_callback Curl_cstrdup;
extern curl_calloc_callback Curl_ccalloc;
#define Curl_safefree(ptr) \
do { free((ptr)); (ptr) = NULL;} while(0)
#include <curl/curl.h>
#ifdef CURLDEBUG
#ifdef __clang__
# define ALLOC_FUNC __attribute__((__malloc__))
# if __clang_major__ >= 4
# define ALLOC_SIZE(s) __attribute__((__alloc_size__(s)))
# define ALLOC_SIZE2(n, s) __attribute__((__alloc_size__(n, s)))
# else
# define ALLOC_SIZE(s)
# define ALLOC_SIZE2(n, s)
# endif
#elif defined(__GNUC__) && __GNUC__ >= 3
# define ALLOC_FUNC __attribute__((__malloc__))
# define ALLOC_SIZE(s) __attribute__((__alloc_size__(s)))
# define ALLOC_SIZE2(n, s) __attribute__((__alloc_size__(n, s)))
#elif defined(_MSC_VER)
# define ALLOC_FUNC __declspec(restrict)
# define ALLOC_SIZE(s)
# define ALLOC_SIZE2(n, s)
#else
# define ALLOC_FUNC
# define ALLOC_SIZE(s)
# define ALLOC_SIZE2(n, s)
#endif
extern FILE *curl_dbg_logfile;
CURL_EXTERN void curl_dbg_free(void *ptr, int line, const char *source);
CURL_EXTERN ALLOC_FUNC ALLOC_SIZE(1)
void *curl_dbg_malloc(size_t size, int line, const char *source);
CURL_EXTERN ALLOC_FUNC ALLOC_SIZE2(1, 2)
void *curl_dbg_calloc(size_t n, size_t size, int line, const char *source);
CURL_EXTERN ALLOC_SIZE(2)
void *curl_dbg_realloc(void *ptr, size_t size, int line, const char *source);
CURL_EXTERN ALLOC_FUNC
char *curl_dbg_strdup(const char *str, int line, const char *src);
#if defined(_WIN32) && defined(UNICODE)
CURL_EXTERN ALLOC_FUNC
wchar_t *curl_dbg_wcsdup(const wchar_t *str, int line, const char *source);
#endif
CURL_EXTERN void curl_dbg_memdebug(const char *logname);
CURL_EXTERN void curl_dbg_memlimit(long limit);
CURL_EXTERN void curl_dbg_log(const char *format, ...) CURL_PRINTF(1, 2);
CURL_EXTERN curl_socket_t curl_dbg_socket(int domain, int type, int protocol,
int line, const char *source);
CURL_EXTERN void curl_dbg_mark_sclose(curl_socket_t sockfd,
int line, const char *source);
CURL_EXTERN int curl_dbg_sclose(curl_socket_t sockfd,
int line, const char *source);
CURL_EXTERN curl_socket_t curl_dbg_accept(curl_socket_t s, void *a, void *alen,
int line, const char *source);
#ifdef HAVE_ACCEPT4
CURL_EXTERN curl_socket_t curl_dbg_accept4(curl_socket_t s, void *saddr,
void *saddrlen, int flags,
int line, const char *source);
#endif
#ifdef HAVE_SOCKETPAIR
CURL_EXTERN int curl_dbg_socketpair(int domain, int type, int protocol,
curl_socket_t socket_vector[2],
int line, const char *source);
#endif
CURL_EXTERN SEND_TYPE_RETV curl_dbg_send(SEND_TYPE_ARG1 sockfd,
SEND_QUAL_ARG2 SEND_TYPE_ARG2 buf,
SEND_TYPE_ARG3 len,
SEND_TYPE_ARG4 flags, int line,
const char *source);
CURL_EXTERN RECV_TYPE_RETV curl_dbg_recv(RECV_TYPE_ARG1 sockfd,
RECV_TYPE_ARG2 buf,
RECV_TYPE_ARG3 len,
RECV_TYPE_ARG4 flags, int line,
const char *source);
CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source);
CURL_EXTERN ALLOC_FUNC
FILE *curl_dbg_fopen(const char *file, const char *mode,
int line, const char *source);
CURL_EXTERN ALLOC_FUNC
FILE *curl_dbg_fdopen(int filedes, const char *mode,
int line, const char *source);
#define sclose(sockfd) curl_dbg_sclose(sockfd,__LINE__,__FILE__)
#define fake_sclose(sockfd) curl_dbg_mark_sclose(sockfd,__LINE__,__FILE__)
#define CURL_GETADDRINFO(host,serv,hint,res) \
curl_dbg_getaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
#define CURL_FREEADDRINFO(data) \
curl_dbg_freeaddrinfo(data, __LINE__, __FILE__)
#define CURL_SOCKET(domain,type,protocol) \
curl_dbg_socket((int)domain, type, protocol, __LINE__, __FILE__)
#ifdef HAVE_SOCKETPAIR
#define CURL_SOCKETPAIR(domain,type,protocol,socket_vector) \
curl_dbg_socketpair((int)domain, type, protocol, socket_vector, \
__LINE__, __FILE__)
#endif
#define CURL_ACCEPT(sock,addr,len) \
curl_dbg_accept(sock, addr, len, __LINE__, __FILE__)
#ifdef HAVE_ACCEPT4
#define CURL_ACCEPT4(sock,addr,len,flags) \
curl_dbg_accept4(sock, addr, len, flags, __LINE__, __FILE__)
#endif
#define CURL_SEND(a,b,c,d) curl_dbg_send(a,b,c,d, __LINE__, __FILE__)
#define CURL_RECV(a,b,c,d) curl_dbg_recv(a,b,c,d, __LINE__, __FILE__)
#else
#define sclose(x) CURL_SCLOSE(x)
#define fake_sclose(x) Curl_nop_stmt
#define CURL_GETADDRINFO getaddrinfo
#define CURL_FREEADDRINFO freeaddrinfo
#define CURL_SOCKET socket
#ifdef HAVE_SOCKETPAIR
#define CURL_SOCKETPAIR socketpair
#endif
#define CURL_ACCEPT accept
#ifdef HAVE_ACCEPT4
#define CURL_ACCEPT4 accept4
#endif
#define CURL_SEND send
#define CURL_RECV recv
#endif
#if defined(HAVE_GETPWUID_R) && \
defined(__ANDROID_API__) && (__ANDROID_API__ < 21)
struct passwd;
int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
size_t buflen, struct passwd **result);
#endif
#ifdef UNITTESTS
#define UNITTEST
#else
#define UNITTEST static
#endif
#ifdef USE_NGHTTP2
#define USE_HTTP2
#endif
#if (defined(USE_NGTCP2) && defined(USE_NGHTTP3)) || \
(defined(USE_OPENSSL_QUIC) && defined(USE_NGHTTP3)) || \
defined(USE_QUICHE)
#ifdef CURL_WITH_MULTI_SSL
#error "MultiSSL combined with QUIC is not supported"
#endif
#define USE_HTTP3
#endif
#ifndef __EMSCRIPTEN__
#define CURL_TCP_NODELAY_SUPPORTED
#endif
#if defined(HAVE_BASENAME) && defined(_WIN32)
#undef HAVE_BASENAME
#endif
#if defined(USE_UNIX_SOCKETS) && defined(_WIN32)
# ifndef UNIX_PATH_MAX
# define UNIX_PATH_MAX 108
typedef struct sockaddr_un {
CURL_SA_FAMILY_T sun_family;
char sun_path[UNIX_PATH_MAX];
} SOCKADDR_UN, *PSOCKADDR_UN;
# define WIN32_SOCKADDR_UN
# endif
#endif
#ifdef USE_OPENSSL
# define OPENSSL_SUPPRESS_DEPRECATED
# ifdef _WIN32
# ifndef LIBRESSL_DISABLE_OVERRIDE_WINCRYPT_DEFINES_WARNING
# define LIBRESSL_DISABLE_OVERRIDE_WINCRYPT_DEFINES_WARNING
# endif
# endif
#endif
#ifdef CURL_INLINE
#elif defined(inline)
# define CURL_INLINE inline
#elif defined(__cplusplus)
# define CURL_INLINE inline
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901
# define CURL_INLINE inline
#elif defined(__GNUC__) && __GNUC__ >= 3
# define CURL_INLINE __inline__
#elif defined(_MSC_VER)
# define CURL_INLINE __inline
#else
# define CURL_INLINE
#endif
#endif
#include "curl_mem_undef.h"