xref: /third_party/curl/lib/curl_setup_once.h (revision 13498266)
113498266Sopenharmony_ci#ifndef HEADER_CURL_SETUP_ONCE_H
213498266Sopenharmony_ci#define HEADER_CURL_SETUP_ONCE_H
313498266Sopenharmony_ci/***************************************************************************
413498266Sopenharmony_ci *                                  _   _ ____  _
513498266Sopenharmony_ci *  Project                     ___| | | |  _ \| |
613498266Sopenharmony_ci *                             / __| | | | |_) | |
713498266Sopenharmony_ci *                            | (__| |_| |  _ <| |___
813498266Sopenharmony_ci *                             \___|\___/|_| \_\_____|
913498266Sopenharmony_ci *
1013498266Sopenharmony_ci * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
1113498266Sopenharmony_ci *
1213498266Sopenharmony_ci * This software is licensed as described in the file COPYING, which
1313498266Sopenharmony_ci * you should have received as part of this distribution. The terms
1413498266Sopenharmony_ci * are also available at https://curl.se/docs/copyright.html.
1513498266Sopenharmony_ci *
1613498266Sopenharmony_ci * You may opt to use, copy, modify, merge, publish, distribute and/or sell
1713498266Sopenharmony_ci * copies of the Software, and permit persons to whom the Software is
1813498266Sopenharmony_ci * furnished to do so, under the terms of the COPYING file.
1913498266Sopenharmony_ci *
2013498266Sopenharmony_ci * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2113498266Sopenharmony_ci * KIND, either express or implied.
2213498266Sopenharmony_ci *
2313498266Sopenharmony_ci * SPDX-License-Identifier: curl
2413498266Sopenharmony_ci *
2513498266Sopenharmony_ci ***************************************************************************/
2613498266Sopenharmony_ci
2713498266Sopenharmony_ci
2813498266Sopenharmony_ci/*
2913498266Sopenharmony_ci * Inclusion of common header files.
3013498266Sopenharmony_ci */
3113498266Sopenharmony_ci
3213498266Sopenharmony_ci#include <stdio.h>
3313498266Sopenharmony_ci#include <stdlib.h>
3413498266Sopenharmony_ci#include <string.h>
3513498266Sopenharmony_ci#include <stdarg.h>
3613498266Sopenharmony_ci#include <time.h>
3713498266Sopenharmony_ci#include <errno.h>
3813498266Sopenharmony_ci
3913498266Sopenharmony_ci#ifdef HAVE_SYS_TYPES_H
4013498266Sopenharmony_ci#include <sys/types.h>
4113498266Sopenharmony_ci#endif
4213498266Sopenharmony_ci
4313498266Sopenharmony_ci#ifdef NEED_MALLOC_H
4413498266Sopenharmony_ci#include <malloc.h>
4513498266Sopenharmony_ci#endif
4613498266Sopenharmony_ci
4713498266Sopenharmony_ci#ifdef NEED_MEMORY_H
4813498266Sopenharmony_ci#include <memory.h>
4913498266Sopenharmony_ci#endif
5013498266Sopenharmony_ci
5113498266Sopenharmony_ci#ifdef HAVE_SYS_STAT_H
5213498266Sopenharmony_ci#include <sys/stat.h>
5313498266Sopenharmony_ci#endif
5413498266Sopenharmony_ci
5513498266Sopenharmony_ci#ifdef HAVE_SYS_TIME_H
5613498266Sopenharmony_ci#include <sys/time.h>
5713498266Sopenharmony_ci#endif
5813498266Sopenharmony_ci
5913498266Sopenharmony_ci#ifdef _WIN32
6013498266Sopenharmony_ci#include <io.h>
6113498266Sopenharmony_ci#include <fcntl.h>
6213498266Sopenharmony_ci#endif
6313498266Sopenharmony_ci
6413498266Sopenharmony_ci#if defined(HAVE_STDBOOL_H) && defined(HAVE_BOOL_T)
6513498266Sopenharmony_ci#include <stdbool.h>
6613498266Sopenharmony_ci#endif
6713498266Sopenharmony_ci
6813498266Sopenharmony_ci#ifdef HAVE_UNISTD_H
6913498266Sopenharmony_ci#include <unistd.h>
7013498266Sopenharmony_ci#endif
7113498266Sopenharmony_ci
7213498266Sopenharmony_ci#ifdef USE_WOLFSSL
7313498266Sopenharmony_ci#include <stdint.h>
7413498266Sopenharmony_ci#endif
7513498266Sopenharmony_ci
7613498266Sopenharmony_ci#ifdef USE_SCHANNEL
7713498266Sopenharmony_ci/* Must set this before <schannel.h> is included directly or indirectly by
7813498266Sopenharmony_ci   another Windows header. */
7913498266Sopenharmony_ci#  define SCHANNEL_USE_BLACKLISTS 1
8013498266Sopenharmony_ci#endif
8113498266Sopenharmony_ci
8213498266Sopenharmony_ci#ifdef __hpux
8313498266Sopenharmony_ci#  if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)
8413498266Sopenharmony_ci#    ifdef _APP32_64BIT_OFF_T
8513498266Sopenharmony_ci#      define OLD_APP32_64BIT_OFF_T _APP32_64BIT_OFF_T
8613498266Sopenharmony_ci#      undef _APP32_64BIT_OFF_T
8713498266Sopenharmony_ci#    else
8813498266Sopenharmony_ci#      undef OLD_APP32_64BIT_OFF_T
8913498266Sopenharmony_ci#    endif
9013498266Sopenharmony_ci#  endif
9113498266Sopenharmony_ci#endif
9213498266Sopenharmony_ci
9313498266Sopenharmony_ci#ifdef HAVE_SYS_SOCKET_H
9413498266Sopenharmony_ci#include <sys/socket.h>
9513498266Sopenharmony_ci#endif
9613498266Sopenharmony_ci
9713498266Sopenharmony_ci#include "functypes.h"
9813498266Sopenharmony_ci
9913498266Sopenharmony_ci#ifdef __hpux
10013498266Sopenharmony_ci#  if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)
10113498266Sopenharmony_ci#    ifdef OLD_APP32_64BIT_OFF_T
10213498266Sopenharmony_ci#      define _APP32_64BIT_OFF_T OLD_APP32_64BIT_OFF_T
10313498266Sopenharmony_ci#      undef OLD_APP32_64BIT_OFF_T
10413498266Sopenharmony_ci#    endif
10513498266Sopenharmony_ci#  endif
10613498266Sopenharmony_ci#endif
10713498266Sopenharmony_ci
10813498266Sopenharmony_ci/*
10913498266Sopenharmony_ci * Definition of timeval struct for platforms that don't have it.
11013498266Sopenharmony_ci */
11113498266Sopenharmony_ci
11213498266Sopenharmony_ci#ifndef HAVE_STRUCT_TIMEVAL
11313498266Sopenharmony_cistruct timeval {
11413498266Sopenharmony_ci long tv_sec;
11513498266Sopenharmony_ci long tv_usec;
11613498266Sopenharmony_ci};
11713498266Sopenharmony_ci#endif
11813498266Sopenharmony_ci
11913498266Sopenharmony_ci
12013498266Sopenharmony_ci/*
12113498266Sopenharmony_ci * If we have the MSG_NOSIGNAL define, make sure we use
12213498266Sopenharmony_ci * it as the fourth argument of function send()
12313498266Sopenharmony_ci */
12413498266Sopenharmony_ci
12513498266Sopenharmony_ci#ifdef HAVE_MSG_NOSIGNAL
12613498266Sopenharmony_ci#define SEND_4TH_ARG MSG_NOSIGNAL
12713498266Sopenharmony_ci#else
12813498266Sopenharmony_ci#define SEND_4TH_ARG 0
12913498266Sopenharmony_ci#endif
13013498266Sopenharmony_ci
13113498266Sopenharmony_ci
13213498266Sopenharmony_ci#if defined(__minix)
13313498266Sopenharmony_ci/* Minix doesn't support recv on TCP sockets */
13413498266Sopenharmony_ci#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \
13513498266Sopenharmony_ci                                   (RECV_TYPE_ARG2)(y), \
13613498266Sopenharmony_ci                                   (RECV_TYPE_ARG3)(z))
13713498266Sopenharmony_ci
13813498266Sopenharmony_ci#elif defined(HAVE_RECV)
13913498266Sopenharmony_ci/*
14013498266Sopenharmony_ci * The definitions for the return type and arguments types
14113498266Sopenharmony_ci * of functions recv() and send() belong and come from the
14213498266Sopenharmony_ci * configuration file. Do not define them in any other place.
14313498266Sopenharmony_ci *
14413498266Sopenharmony_ci * HAVE_RECV is defined if you have a function named recv()
14513498266Sopenharmony_ci * which is used to read incoming data from sockets. If your
14613498266Sopenharmony_ci * function has another name then don't define HAVE_RECV.
14713498266Sopenharmony_ci *
14813498266Sopenharmony_ci * If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2,
14913498266Sopenharmony_ci * RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also
15013498266Sopenharmony_ci * be defined.
15113498266Sopenharmony_ci *
15213498266Sopenharmony_ci * HAVE_SEND is defined if you have a function named send()
15313498266Sopenharmony_ci * which is used to write outgoing data on a connected socket.
15413498266Sopenharmony_ci * If yours has another name then don't define HAVE_SEND.
15513498266Sopenharmony_ci *
15613498266Sopenharmony_ci * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2,
15713498266Sopenharmony_ci * SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and
15813498266Sopenharmony_ci * SEND_TYPE_RETV must also be defined.
15913498266Sopenharmony_ci */
16013498266Sopenharmony_ci
16113498266Sopenharmony_ci#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \
16213498266Sopenharmony_ci                                   (RECV_TYPE_ARG2)(y), \
16313498266Sopenharmony_ci                                   (RECV_TYPE_ARG3)(z), \
16413498266Sopenharmony_ci                                   (RECV_TYPE_ARG4)(0))
16513498266Sopenharmony_ci#else /* HAVE_RECV */
16613498266Sopenharmony_ci#ifndef sread
16713498266Sopenharmony_ci  /* */
16813498266Sopenharmony_ci  Error Missing_definition_of_macro_sread
16913498266Sopenharmony_ci  /* */
17013498266Sopenharmony_ci#endif
17113498266Sopenharmony_ci#endif /* HAVE_RECV */
17213498266Sopenharmony_ci
17313498266Sopenharmony_ci
17413498266Sopenharmony_ci#if defined(__minix)
17513498266Sopenharmony_ci/* Minix doesn't support send on TCP sockets */
17613498266Sopenharmony_ci#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \
17713498266Sopenharmony_ci                                    (SEND_TYPE_ARG2)(y), \
17813498266Sopenharmony_ci                                    (SEND_TYPE_ARG3)(z))
17913498266Sopenharmony_ci
18013498266Sopenharmony_ci#elif defined(HAVE_SEND)
18113498266Sopenharmony_ci#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
18213498266Sopenharmony_ci                                    (SEND_QUAL_ARG2 SEND_TYPE_ARG2)(y), \
18313498266Sopenharmony_ci                                    (SEND_TYPE_ARG3)(z), \
18413498266Sopenharmony_ci                                    (SEND_TYPE_ARG4)(SEND_4TH_ARG))
18513498266Sopenharmony_ci#else /* HAVE_SEND */
18613498266Sopenharmony_ci#ifndef swrite
18713498266Sopenharmony_ci  /* */
18813498266Sopenharmony_ci  Error Missing_definition_of_macro_swrite
18913498266Sopenharmony_ci  /* */
19013498266Sopenharmony_ci#endif
19113498266Sopenharmony_ci#endif /* HAVE_SEND */
19213498266Sopenharmony_ci
19313498266Sopenharmony_ci
19413498266Sopenharmony_ci/*
19513498266Sopenharmony_ci * Function-like macro definition used to close a socket.
19613498266Sopenharmony_ci */
19713498266Sopenharmony_ci
19813498266Sopenharmony_ci#if defined(HAVE_CLOSESOCKET)
19913498266Sopenharmony_ci#  define sclose(x)  closesocket((x))
20013498266Sopenharmony_ci#elif defined(HAVE_CLOSESOCKET_CAMEL)
20113498266Sopenharmony_ci#  define sclose(x)  CloseSocket((x))
20213498266Sopenharmony_ci#elif defined(HAVE_CLOSE_S)
20313498266Sopenharmony_ci#  define sclose(x)  close_s((x))
20413498266Sopenharmony_ci#elif defined(USE_LWIPSOCK)
20513498266Sopenharmony_ci#  define sclose(x)  lwip_close((x))
20613498266Sopenharmony_ci#else
20713498266Sopenharmony_ci#  define sclose(x)  close((x))
20813498266Sopenharmony_ci#endif
20913498266Sopenharmony_ci
21013498266Sopenharmony_ci/*
21113498266Sopenharmony_ci * Stack-independent version of fcntl() on sockets:
21213498266Sopenharmony_ci */
21313498266Sopenharmony_ci#if defined(USE_LWIPSOCK)
21413498266Sopenharmony_ci#  define sfcntl  lwip_fcntl
21513498266Sopenharmony_ci#else
21613498266Sopenharmony_ci#  define sfcntl  fcntl
21713498266Sopenharmony_ci#endif
21813498266Sopenharmony_ci
21913498266Sopenharmony_ci/*
22013498266Sopenharmony_ci * 'bool' stuff compatible with HP-UX headers.
22113498266Sopenharmony_ci */
22213498266Sopenharmony_ci
22313498266Sopenharmony_ci#if defined(__hpux) && !defined(HAVE_BOOL_T)
22413498266Sopenharmony_ci   typedef int bool;
22513498266Sopenharmony_ci#  define false 0
22613498266Sopenharmony_ci#  define true 1
22713498266Sopenharmony_ci#  define HAVE_BOOL_T
22813498266Sopenharmony_ci#endif
22913498266Sopenharmony_ci
23013498266Sopenharmony_ci
23113498266Sopenharmony_ci/*
23213498266Sopenharmony_ci * 'bool' exists on platforms with <stdbool.h>, i.e. C99 platforms.
23313498266Sopenharmony_ci * On non-C99 platforms there's no bool, so define an enum for that.
23413498266Sopenharmony_ci * On C99 platforms 'false' and 'true' also exist. Enum uses a
23513498266Sopenharmony_ci * global namespace though, so use bool_false and bool_true.
23613498266Sopenharmony_ci */
23713498266Sopenharmony_ci
23813498266Sopenharmony_ci#ifndef HAVE_BOOL_T
23913498266Sopenharmony_ci  typedef enum {
24013498266Sopenharmony_ci      bool_false = 0,
24113498266Sopenharmony_ci      bool_true  = 1
24213498266Sopenharmony_ci  } bool;
24313498266Sopenharmony_ci
24413498266Sopenharmony_ci/*
24513498266Sopenharmony_ci * Use a define to let 'true' and 'false' use those enums.  There
24613498266Sopenharmony_ci * are currently no use of true and false in libcurl proper, but
24713498266Sopenharmony_ci * there are some in the examples. This will cater for any later
24813498266Sopenharmony_ci * code happening to use true and false.
24913498266Sopenharmony_ci */
25013498266Sopenharmony_ci#  define false bool_false
25113498266Sopenharmony_ci#  define true  bool_true
25213498266Sopenharmony_ci#  define HAVE_BOOL_T
25313498266Sopenharmony_ci#endif
25413498266Sopenharmony_ci
25513498266Sopenharmony_ci/* the type we use for storing a single boolean bit */
25613498266Sopenharmony_ci#ifdef _MSC_VER
25713498266Sopenharmony_citypedef bool bit;
25813498266Sopenharmony_ci#define BIT(x) bool x
25913498266Sopenharmony_ci#else
26013498266Sopenharmony_citypedef unsigned int bit;
26113498266Sopenharmony_ci#define BIT(x) bit x:1
26213498266Sopenharmony_ci#endif
26313498266Sopenharmony_ci
26413498266Sopenharmony_ci/*
26513498266Sopenharmony_ci * Redefine TRUE and FALSE too, to catch current use. With this
26613498266Sopenharmony_ci * change, 'bool found = 1' will give a warning on MIPSPro, but
26713498266Sopenharmony_ci * 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro,
26813498266Sopenharmony_ci * AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too.
26913498266Sopenharmony_ci */
27013498266Sopenharmony_ci
27113498266Sopenharmony_ci#ifndef TRUE
27213498266Sopenharmony_ci#define TRUE true
27313498266Sopenharmony_ci#endif
27413498266Sopenharmony_ci#ifndef FALSE
27513498266Sopenharmony_ci#define FALSE false
27613498266Sopenharmony_ci#endif
27713498266Sopenharmony_ci
27813498266Sopenharmony_ci#include "curl_ctype.h"
27913498266Sopenharmony_ci
28013498266Sopenharmony_ci
28113498266Sopenharmony_ci/*
28213498266Sopenharmony_ci * Macro used to include code only in debug builds.
28313498266Sopenharmony_ci */
28413498266Sopenharmony_ci
28513498266Sopenharmony_ci#ifdef DEBUGBUILD
28613498266Sopenharmony_ci#define DEBUGF(x) x
28713498266Sopenharmony_ci#else
28813498266Sopenharmony_ci#define DEBUGF(x) do { } while(0)
28913498266Sopenharmony_ci#endif
29013498266Sopenharmony_ci
29113498266Sopenharmony_ci
29213498266Sopenharmony_ci/*
29313498266Sopenharmony_ci * Macro used to include assertion code only in debug builds.
29413498266Sopenharmony_ci */
29513498266Sopenharmony_ci
29613498266Sopenharmony_ci#undef DEBUGASSERT
29713498266Sopenharmony_ci#if defined(DEBUGBUILD)
29813498266Sopenharmony_ci#define DEBUGASSERT(x) assert(x)
29913498266Sopenharmony_ci#else
30013498266Sopenharmony_ci#define DEBUGASSERT(x) do { } while(0)
30113498266Sopenharmony_ci#endif
30213498266Sopenharmony_ci
30313498266Sopenharmony_ci
30413498266Sopenharmony_ci/*
30513498266Sopenharmony_ci * Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno
30613498266Sopenharmony_ci * (or equivalent) on this platform to hide platform details to code using it.
30713498266Sopenharmony_ci */
30813498266Sopenharmony_ci
30913498266Sopenharmony_ci#ifdef USE_WINSOCK
31013498266Sopenharmony_ci#define SOCKERRNO         ((int)WSAGetLastError())
31113498266Sopenharmony_ci#define SET_SOCKERRNO(x)  (WSASetLastError((int)(x)))
31213498266Sopenharmony_ci#else
31313498266Sopenharmony_ci#define SOCKERRNO         (errno)
31413498266Sopenharmony_ci#define SET_SOCKERRNO(x)  (errno = (x))
31513498266Sopenharmony_ci#endif
31613498266Sopenharmony_ci
31713498266Sopenharmony_ci
31813498266Sopenharmony_ci/*
31913498266Sopenharmony_ci * Portable error number symbolic names defined to Winsock error codes.
32013498266Sopenharmony_ci */
32113498266Sopenharmony_ci
32213498266Sopenharmony_ci#ifdef USE_WINSOCK
32313498266Sopenharmony_ci#undef  EBADF            /* override definition in errno.h */
32413498266Sopenharmony_ci#define EBADF            WSAEBADF
32513498266Sopenharmony_ci#undef  EINTR            /* override definition in errno.h */
32613498266Sopenharmony_ci#define EINTR            WSAEINTR
32713498266Sopenharmony_ci#undef  EINVAL           /* override definition in errno.h */
32813498266Sopenharmony_ci#define EINVAL           WSAEINVAL
32913498266Sopenharmony_ci#undef  EWOULDBLOCK      /* override definition in errno.h */
33013498266Sopenharmony_ci#define EWOULDBLOCK      WSAEWOULDBLOCK
33113498266Sopenharmony_ci#undef  EINPROGRESS      /* override definition in errno.h */
33213498266Sopenharmony_ci#define EINPROGRESS      WSAEINPROGRESS
33313498266Sopenharmony_ci#undef  EALREADY         /* override definition in errno.h */
33413498266Sopenharmony_ci#define EALREADY         WSAEALREADY
33513498266Sopenharmony_ci#undef  ENOTSOCK         /* override definition in errno.h */
33613498266Sopenharmony_ci#define ENOTSOCK         WSAENOTSOCK
33713498266Sopenharmony_ci#undef  EDESTADDRREQ     /* override definition in errno.h */
33813498266Sopenharmony_ci#define EDESTADDRREQ     WSAEDESTADDRREQ
33913498266Sopenharmony_ci#undef  EMSGSIZE         /* override definition in errno.h */
34013498266Sopenharmony_ci#define EMSGSIZE         WSAEMSGSIZE
34113498266Sopenharmony_ci#undef  EPROTOTYPE       /* override definition in errno.h */
34213498266Sopenharmony_ci#define EPROTOTYPE       WSAEPROTOTYPE
34313498266Sopenharmony_ci#undef  ENOPROTOOPT      /* override definition in errno.h */
34413498266Sopenharmony_ci#define ENOPROTOOPT      WSAENOPROTOOPT
34513498266Sopenharmony_ci#undef  EPROTONOSUPPORT  /* override definition in errno.h */
34613498266Sopenharmony_ci#define EPROTONOSUPPORT  WSAEPROTONOSUPPORT
34713498266Sopenharmony_ci#define ESOCKTNOSUPPORT  WSAESOCKTNOSUPPORT
34813498266Sopenharmony_ci#undef  EOPNOTSUPP       /* override definition in errno.h */
34913498266Sopenharmony_ci#define EOPNOTSUPP       WSAEOPNOTSUPP
35013498266Sopenharmony_ci#define EPFNOSUPPORT     WSAEPFNOSUPPORT
35113498266Sopenharmony_ci#undef  EAFNOSUPPORT     /* override definition in errno.h */
35213498266Sopenharmony_ci#define EAFNOSUPPORT     WSAEAFNOSUPPORT
35313498266Sopenharmony_ci#undef  EADDRINUSE       /* override definition in errno.h */
35413498266Sopenharmony_ci#define EADDRINUSE       WSAEADDRINUSE
35513498266Sopenharmony_ci#undef  EADDRNOTAVAIL    /* override definition in errno.h */
35613498266Sopenharmony_ci#define EADDRNOTAVAIL    WSAEADDRNOTAVAIL
35713498266Sopenharmony_ci#undef  ENETDOWN         /* override definition in errno.h */
35813498266Sopenharmony_ci#define ENETDOWN         WSAENETDOWN
35913498266Sopenharmony_ci#undef  ENETUNREACH      /* override definition in errno.h */
36013498266Sopenharmony_ci#define ENETUNREACH      WSAENETUNREACH
36113498266Sopenharmony_ci#undef  ENETRESET        /* override definition in errno.h */
36213498266Sopenharmony_ci#define ENETRESET        WSAENETRESET
36313498266Sopenharmony_ci#undef  ECONNABORTED     /* override definition in errno.h */
36413498266Sopenharmony_ci#define ECONNABORTED     WSAECONNABORTED
36513498266Sopenharmony_ci#undef  ECONNRESET       /* override definition in errno.h */
36613498266Sopenharmony_ci#define ECONNRESET       WSAECONNRESET
36713498266Sopenharmony_ci#undef  ENOBUFS          /* override definition in errno.h */
36813498266Sopenharmony_ci#define ENOBUFS          WSAENOBUFS
36913498266Sopenharmony_ci#undef  EISCONN          /* override definition in errno.h */
37013498266Sopenharmony_ci#define EISCONN          WSAEISCONN
37113498266Sopenharmony_ci#undef  ENOTCONN         /* override definition in errno.h */
37213498266Sopenharmony_ci#define ENOTCONN         WSAENOTCONN
37313498266Sopenharmony_ci#define ESHUTDOWN        WSAESHUTDOWN
37413498266Sopenharmony_ci#define ETOOMANYREFS     WSAETOOMANYREFS
37513498266Sopenharmony_ci#undef  ETIMEDOUT        /* override definition in errno.h */
37613498266Sopenharmony_ci#define ETIMEDOUT        WSAETIMEDOUT
37713498266Sopenharmony_ci#undef  ECONNREFUSED     /* override definition in errno.h */
37813498266Sopenharmony_ci#define ECONNREFUSED     WSAECONNREFUSED
37913498266Sopenharmony_ci#undef  ELOOP            /* override definition in errno.h */
38013498266Sopenharmony_ci#define ELOOP            WSAELOOP
38113498266Sopenharmony_ci#ifndef ENAMETOOLONG     /* possible previous definition in errno.h */
38213498266Sopenharmony_ci#define ENAMETOOLONG     WSAENAMETOOLONG
38313498266Sopenharmony_ci#endif
38413498266Sopenharmony_ci#define EHOSTDOWN        WSAEHOSTDOWN
38513498266Sopenharmony_ci#undef  EHOSTUNREACH     /* override definition in errno.h */
38613498266Sopenharmony_ci#define EHOSTUNREACH     WSAEHOSTUNREACH
38713498266Sopenharmony_ci#ifndef ENOTEMPTY        /* possible previous definition in errno.h */
38813498266Sopenharmony_ci#define ENOTEMPTY        WSAENOTEMPTY
38913498266Sopenharmony_ci#endif
39013498266Sopenharmony_ci#define EPROCLIM         WSAEPROCLIM
39113498266Sopenharmony_ci#define EUSERS           WSAEUSERS
39213498266Sopenharmony_ci#define EDQUOT           WSAEDQUOT
39313498266Sopenharmony_ci#define ESTALE           WSAESTALE
39413498266Sopenharmony_ci#define EREMOTE          WSAEREMOTE
39513498266Sopenharmony_ci#endif
39613498266Sopenharmony_ci
39713498266Sopenharmony_ci/*
39813498266Sopenharmony_ci * Macro argv_item_t hides platform details to code using it.
39913498266Sopenharmony_ci */
40013498266Sopenharmony_ci
40113498266Sopenharmony_ci#ifdef __VMS
40213498266Sopenharmony_ci#define argv_item_t  __char_ptr32
40313498266Sopenharmony_ci#elif defined(_UNICODE)
40413498266Sopenharmony_ci#define argv_item_t wchar_t *
40513498266Sopenharmony_ci#else
40613498266Sopenharmony_ci#define argv_item_t  char *
40713498266Sopenharmony_ci#endif
40813498266Sopenharmony_ci
40913498266Sopenharmony_ci
41013498266Sopenharmony_ci/*
41113498266Sopenharmony_ci * We use this ZERO_NULL to avoid picky compiler warnings,
41213498266Sopenharmony_ci * when assigning a NULL pointer to a function pointer var.
41313498266Sopenharmony_ci */
41413498266Sopenharmony_ci
41513498266Sopenharmony_ci#define ZERO_NULL 0
41613498266Sopenharmony_ci
41713498266Sopenharmony_ci
41813498266Sopenharmony_ci#endif /* HEADER_CURL_SETUP_ONCE_H */
419