2012-12-28 06:03:09 -05:00
|
|
|
#ifndef HEADER_CURL_SETUP_ONCE_H
|
|
|
|
#define HEADER_CURL_SETUP_ONCE_H
|
2006-07-28 10:19:02 -04:00
|
|
|
/***************************************************************************
|
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2013-02-14 20:11:57 -05:00
|
|
|
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
2006-07-28 10:19:02 -04:00
|
|
|
*
|
|
|
|
* This software is licensed as described in the file COPYING, which
|
|
|
|
* you should have received as part of this distribution. The terms
|
2016-02-02 18:19:02 -05:00
|
|
|
* are also available at https://curl.haxx.se/docs/copyright.html.
|
2006-07-28 10:19:02 -04:00
|
|
|
*
|
|
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
* copies of the Software, and permit persons to whom the Software is
|
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
2007-02-17 19:34:37 -05:00
|
|
|
/*
|
|
|
|
* Inclusion of common header files.
|
|
|
|
*/
|
|
|
|
|
2007-02-20 07:12:27 -05:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <ctype.h>
|
2011-07-23 22:39:43 -04:00
|
|
|
|
|
|
|
#ifdef HAVE_ERRNO_H
|
2007-02-17 19:34:37 -05:00
|
|
|
#include <errno.h>
|
2011-07-23 22:39:43 -04:00
|
|
|
#endif
|
2007-02-17 19:34:37 -05:00
|
|
|
|
2007-02-20 07:12:27 -05:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
2009-04-21 06:26:58 -04:00
|
|
|
#ifdef NEED_MALLOC_H
|
|
|
|
#include <malloc.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef NEED_MEMORY_H
|
|
|
|
#include <memory.h>
|
|
|
|
#endif
|
|
|
|
|
2007-02-20 07:12:27 -05:00
|
|
|
#ifdef HAVE_SYS_STAT_H
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
#include <sys/time.h>
|
|
|
|
#ifdef TIME_WITH_SYS_TIME
|
|
|
|
#include <time.h>
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#ifdef HAVE_TIME_H
|
|
|
|
#include <time.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#include <io.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
|
|
|
|
2012-04-14 09:41:38 -04:00
|
|
|
#if defined(HAVE_STDBOOL_H) && defined(HAVE_BOOL_T)
|
2007-02-21 21:51:54 -05:00
|
|
|
#include <stdbool.h>
|
|
|
|
#endif
|
|
|
|
|
2012-12-14 11:38:18 -05:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2012-12-14 13:39:22 -05:00
|
|
|
#ifdef __hpux
|
|
|
|
# if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)
|
|
|
|
# ifdef _APP32_64BIT_OFF_T
|
|
|
|
# define OLD_APP32_64BIT_OFF_T _APP32_64BIT_OFF_T
|
|
|
|
# undef _APP32_64BIT_OFF_T
|
|
|
|
# else
|
|
|
|
# undef OLD_APP32_64BIT_OFF_T
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2012-12-14 11:38:18 -05:00
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#endif
|
|
|
|
|
2012-12-14 13:39:22 -05:00
|
|
|
#ifdef __hpux
|
|
|
|
# if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)
|
|
|
|
# ifdef OLD_APP32_64BIT_OFF_T
|
|
|
|
# define _APP32_64BIT_OFF_T OLD_APP32_64BIT_OFF_T
|
|
|
|
# undef OLD_APP32_64BIT_OFF_T
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2007-02-20 07:12:27 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Definition of timeval struct for platforms that don't have it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HAVE_STRUCT_TIMEVAL
|
|
|
|
struct timeval {
|
|
|
|
long tv_sec;
|
|
|
|
long tv_usec;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2007-02-17 19:34:37 -05:00
|
|
|
|
2006-07-28 10:19:02 -04:00
|
|
|
/*
|
|
|
|
* If we have the MSG_NOSIGNAL define, make sure we use
|
2007-01-26 20:56:20 -05:00
|
|
|
* it as the fourth argument of function send()
|
2006-07-28 10:19:02 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_MSG_NOSIGNAL
|
|
|
|
#define SEND_4TH_ARG MSG_NOSIGNAL
|
|
|
|
#else
|
|
|
|
#define SEND_4TH_ARG 0
|
2006-08-29 12:26:41 -04:00
|
|
|
#endif
|
2006-07-28 10:19:02 -04:00
|
|
|
|
|
|
|
|
2007-09-05 18:01:57 -04:00
|
|
|
#if defined(__minix)
|
|
|
|
/* Minix doesn't support recv on TCP sockets */
|
|
|
|
#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \
|
|
|
|
(RECV_TYPE_ARG2)(y), \
|
|
|
|
(RECV_TYPE_ARG3)(z))
|
|
|
|
|
|
|
|
#elif defined(HAVE_RECV)
|
2006-07-28 10:19:02 -04:00
|
|
|
/*
|
|
|
|
* The definitions for the return type and arguments types
|
|
|
|
* of functions recv() and send() belong and come from the
|
|
|
|
* configuration file. Do not define them in any other place.
|
|
|
|
*
|
|
|
|
* HAVE_RECV is defined if you have a function named recv()
|
|
|
|
* which is used to read incoming data from sockets. If your
|
|
|
|
* function has another name then don't define HAVE_RECV.
|
|
|
|
*
|
|
|
|
* If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2,
|
|
|
|
* RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also
|
|
|
|
* be defined.
|
|
|
|
*
|
|
|
|
* HAVE_SEND is defined if you have a function named send()
|
|
|
|
* which is used to write outgoing data on a connected socket.
|
|
|
|
* If yours has another name then don't define HAVE_SEND.
|
|
|
|
*
|
|
|
|
* If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2,
|
|
|
|
* SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and
|
|
|
|
* SEND_TYPE_RETV must also be defined.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if !defined(RECV_TYPE_ARG1) || \
|
|
|
|
!defined(RECV_TYPE_ARG2) || \
|
|
|
|
!defined(RECV_TYPE_ARG3) || \
|
|
|
|
!defined(RECV_TYPE_ARG4) || \
|
|
|
|
!defined(RECV_TYPE_RETV)
|
|
|
|
/* */
|
|
|
|
Error Missing_definition_of_return_and_arguments_types_of_recv
|
|
|
|
/* */
|
|
|
|
#else
|
|
|
|
#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \
|
|
|
|
(RECV_TYPE_ARG2)(y), \
|
|
|
|
(RECV_TYPE_ARG3)(z), \
|
2006-12-16 17:28:08 -05:00
|
|
|
(RECV_TYPE_ARG4)(0))
|
2006-07-28 10:19:02 -04:00
|
|
|
#endif
|
|
|
|
#else /* HAVE_RECV */
|
2006-07-31 13:12:24 -04:00
|
|
|
#ifndef sread
|
|
|
|
/* */
|
|
|
|
Error Missing_definition_of_macro_sread
|
|
|
|
/* */
|
|
|
|
#endif
|
2006-07-28 10:19:02 -04:00
|
|
|
#endif /* HAVE_RECV */
|
|
|
|
|
2007-09-05 18:01:57 -04:00
|
|
|
|
|
|
|
#if defined(__minix)
|
|
|
|
/* Minix doesn't support send on TCP sockets */
|
|
|
|
#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \
|
|
|
|
(SEND_TYPE_ARG2)(y), \
|
|
|
|
(SEND_TYPE_ARG3)(z))
|
|
|
|
|
|
|
|
#elif defined(HAVE_SEND)
|
2006-07-28 10:19:02 -04:00
|
|
|
#if !defined(SEND_TYPE_ARG1) || \
|
|
|
|
!defined(SEND_QUAL_ARG2) || \
|
|
|
|
!defined(SEND_TYPE_ARG2) || \
|
|
|
|
!defined(SEND_TYPE_ARG3) || \
|
|
|
|
!defined(SEND_TYPE_ARG4) || \
|
|
|
|
!defined(SEND_TYPE_RETV)
|
|
|
|
/* */
|
|
|
|
Error Missing_definition_of_return_and_arguments_types_of_send
|
|
|
|
/* */
|
|
|
|
#else
|
|
|
|
#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
|
2017-05-04 02:50:35 -04:00
|
|
|
(SEND_QUAL_ARG2 SEND_TYPE_ARG2)(y), \
|
2006-07-28 10:19:02 -04:00
|
|
|
(SEND_TYPE_ARG3)(z), \
|
|
|
|
(SEND_TYPE_ARG4)(SEND_4TH_ARG))
|
|
|
|
#endif
|
|
|
|
#else /* HAVE_SEND */
|
2006-07-31 13:12:24 -04:00
|
|
|
#ifndef swrite
|
|
|
|
/* */
|
|
|
|
Error Missing_definition_of_macro_swrite
|
|
|
|
/* */
|
|
|
|
#endif
|
2006-07-28 10:19:02 -04:00
|
|
|
#endif /* HAVE_SEND */
|
|
|
|
|
|
|
|
|
2008-08-26 20:25:02 -04:00
|
|
|
#if 0
|
2008-07-16 15:16:41 -04:00
|
|
|
#if defined(HAVE_RECVFROM)
|
|
|
|
/*
|
|
|
|
* Currently recvfrom is only used on udp sockets.
|
|
|
|
*/
|
|
|
|
#if !defined(RECVFROM_TYPE_ARG1) || \
|
|
|
|
!defined(RECVFROM_TYPE_ARG2) || \
|
|
|
|
!defined(RECVFROM_TYPE_ARG3) || \
|
|
|
|
!defined(RECVFROM_TYPE_ARG4) || \
|
|
|
|
!defined(RECVFROM_TYPE_ARG5) || \
|
|
|
|
!defined(RECVFROM_TYPE_ARG6) || \
|
|
|
|
!defined(RECVFROM_TYPE_RETV)
|
|
|
|
/* */
|
|
|
|
Error Missing_definition_of_return_and_arguments_types_of_recvfrom
|
|
|
|
/* */
|
|
|
|
#else
|
2008-07-16 23:07:54 -04:00
|
|
|
#define sreadfrom(s,b,bl,f,fl) (ssize_t)recvfrom((RECVFROM_TYPE_ARG1) (s), \
|
|
|
|
(RECVFROM_TYPE_ARG2 *)(b), \
|
|
|
|
(RECVFROM_TYPE_ARG3) (bl), \
|
|
|
|
(RECVFROM_TYPE_ARG4) (0), \
|
|
|
|
(RECVFROM_TYPE_ARG5 *)(f), \
|
|
|
|
(RECVFROM_TYPE_ARG6 *)(fl))
|
2008-07-16 15:16:41 -04:00
|
|
|
#endif
|
|
|
|
#else /* HAVE_RECVFROM */
|
|
|
|
#ifndef sreadfrom
|
|
|
|
/* */
|
|
|
|
Error Missing_definition_of_macro_sreadfrom
|
|
|
|
/* */
|
|
|
|
#endif
|
|
|
|
#endif /* HAVE_RECVFROM */
|
|
|
|
|
|
|
|
|
2008-07-20 23:06:07 -04:00
|
|
|
#ifdef RECVFROM_TYPE_ARG6_IS_VOID
|
2008-07-21 14:24:32 -04:00
|
|
|
# define RECVFROM_ARG6_T int
|
2008-07-20 23:06:07 -04:00
|
|
|
#else
|
|
|
|
# define RECVFROM_ARG6_T RECVFROM_TYPE_ARG6
|
|
|
|
#endif
|
2008-08-26 20:25:02 -04:00
|
|
|
#endif /* if 0 */
|
2008-07-20 23:06:07 -04:00
|
|
|
|
|
|
|
|
2009-06-18 20:41:03 -04:00
|
|
|
/*
|
|
|
|
* Function-like macro definition used to close a socket.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined(HAVE_CLOSESOCKET)
|
|
|
|
# define sclose(x) closesocket((x))
|
|
|
|
#elif defined(HAVE_CLOSESOCKET_CAMEL)
|
|
|
|
# define sclose(x) CloseSocket((x))
|
2013-02-14 20:11:57 -05:00
|
|
|
#elif defined(HAVE_CLOSE_S)
|
|
|
|
# define sclose(x) close_s((x))
|
2012-03-17 18:02:21 -04:00
|
|
|
#elif defined(USE_LWIPSOCK)
|
|
|
|
# define sclose(x) lwip_close((x))
|
2009-06-18 20:41:03 -04:00
|
|
|
#else
|
|
|
|
# define sclose(x) close((x))
|
|
|
|
#endif
|
|
|
|
|
2012-03-17 18:02:21 -04:00
|
|
|
/*
|
|
|
|
* Stack-independent version of fcntl() on sockets:
|
|
|
|
*/
|
|
|
|
#if defined(USE_LWIPSOCK)
|
|
|
|
# define sfcntl lwip_fcntl
|
|
|
|
#else
|
|
|
|
# define sfcntl fcntl
|
|
|
|
#endif
|
|
|
|
|
2006-10-17 23:41:19 -04:00
|
|
|
/*
|
2006-10-18 09:50:23 -04:00
|
|
|
* Uppercase macro versions of ANSI/ISO is*() functions/macros which
|
2006-10-18 08:59:02 -04:00
|
|
|
* avoid negative number inputs with argument byte codes > 127.
|
2006-10-17 23:41:19 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define ISSPACE(x) (isspace((int) ((unsigned char)x)))
|
|
|
|
#define ISDIGIT(x) (isdigit((int) ((unsigned char)x)))
|
|
|
|
#define ISALNUM(x) (isalnum((int) ((unsigned char)x)))
|
|
|
|
#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x)))
|
|
|
|
#define ISGRAPH(x) (isgraph((int) ((unsigned char)x)))
|
|
|
|
#define ISALPHA(x) (isalpha((int) ((unsigned char)x)))
|
2006-10-18 09:50:23 -04:00
|
|
|
#define ISPRINT(x) (isprint((int) ((unsigned char)x)))
|
2007-02-13 13:02:20 -05:00
|
|
|
#define ISUPPER(x) (isupper((int) ((unsigned char)x)))
|
|
|
|
#define ISLOWER(x) (islower((int) ((unsigned char)x)))
|
2011-09-04 11:09:22 -04:00
|
|
|
#define ISASCII(x) (isascii((int) ((unsigned char)x)))
|
2006-10-17 23:41:19 -04:00
|
|
|
|
2007-02-13 14:01:03 -05:00
|
|
|
#define ISBLANK(x) (int)((((unsigned char)x) == ' ') || \
|
|
|
|
(((unsigned char)x) == '\t'))
|
|
|
|
|
2011-09-04 11:09:22 -04:00
|
|
|
#define TOLOWER(x) (tolower((int) ((unsigned char)x)))
|
|
|
|
|
2006-10-17 23:41:19 -04:00
|
|
|
|
2012-12-16 20:07:10 -05:00
|
|
|
/*
|
|
|
|
* 'bool' stuff compatible with HP-UX headers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined(__hpux) && !defined(HAVE_BOOL_T)
|
|
|
|
typedef int bool;
|
|
|
|
# define false 0
|
|
|
|
# define true 1
|
|
|
|
# define HAVE_BOOL_T
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-02-21 21:51:54 -05:00
|
|
|
/*
|
2010-05-27 10:58:15 -04:00
|
|
|
* 'bool' exists on platforms with <stdbool.h>, i.e. C99 platforms.
|
|
|
|
* On non-C99 platforms there's no bool, so define an enum for that.
|
|
|
|
* On C99 platforms 'false' and 'true' also exist. Enum uses a
|
|
|
|
* global namespace though, so use bool_false and bool_true.
|
2007-02-21 21:51:54 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HAVE_BOOL_T
|
2010-05-27 10:58:15 -04:00
|
|
|
typedef enum {
|
|
|
|
bool_false = 0,
|
|
|
|
bool_true = 1
|
|
|
|
} bool;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Use a define to let 'true' and 'false' use those enums. There
|
|
|
|
* are currently no use of true and false in libcurl proper, but
|
|
|
|
* there are some in the examples. This will cater for any later
|
|
|
|
* code happening to use true and false.
|
|
|
|
*/
|
|
|
|
# define false bool_false
|
|
|
|
# define true bool_true
|
|
|
|
# define HAVE_BOOL_T
|
2007-02-21 21:51:54 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2010-05-27 10:58:15 -04:00
|
|
|
* Redefine TRUE and FALSE too, to catch current use. With this
|
|
|
|
* change, 'bool found = 1' will give a warning on MIPSPro, but
|
|
|
|
* 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro,
|
|
|
|
* AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too.
|
2007-02-21 21:51:54 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TRUE
|
2010-05-27 10:58:15 -04:00
|
|
|
#define TRUE true
|
2007-02-21 21:51:54 -05:00
|
|
|
#endif
|
|
|
|
#ifndef FALSE
|
2010-05-27 10:58:15 -04:00
|
|
|
#define FALSE false
|
2007-02-21 21:51:54 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2011-09-02 13:40:53 -04:00
|
|
|
/*
|
|
|
|
* Macro WHILE_FALSE may be used to build single-iteration do-while loops,
|
|
|
|
* avoiding compiler warnings. Mostly intended for other macro definitions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define WHILE_FALSE while(0)
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) && !defined(__POCC__)
|
|
|
|
# undef WHILE_FALSE
|
|
|
|
# if (_MSC_VER < 1500)
|
|
|
|
# define WHILE_FALSE while(1, 0)
|
|
|
|
# else
|
|
|
|
# define WHILE_FALSE \
|
|
|
|
__pragma(warning(push)) \
|
|
|
|
__pragma(warning(disable:4127)) \
|
|
|
|
while(0) \
|
|
|
|
__pragma(warning(pop))
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2006-11-22 13:41:34 -05:00
|
|
|
/*
|
|
|
|
* Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HAVE_SIG_ATOMIC_T
|
|
|
|
typedef int sig_atomic_t;
|
|
|
|
#define HAVE_SIG_ATOMIC_T
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-04-11 07:02:13 -04:00
|
|
|
/*
|
|
|
|
* Convenience SIG_ATOMIC_T definition
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_SIG_ATOMIC_T_VOLATILE
|
|
|
|
#define SIG_ATOMIC_T static sig_atomic_t
|
|
|
|
#else
|
|
|
|
#define SIG_ATOMIC_T static volatile sig_atomic_t
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2006-11-24 20:02:52 -05:00
|
|
|
/*
|
|
|
|
* Default return type for signal handlers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RETSIGTYPE
|
|
|
|
#define RETSIGTYPE void
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-02-02 10:31:32 -05:00
|
|
|
/*
|
|
|
|
* Macro used to include code only in debug builds.
|
|
|
|
*/
|
|
|
|
|
2009-06-09 22:49:42 -04:00
|
|
|
#ifdef DEBUGBUILD
|
2007-02-21 14:03:20 -05:00
|
|
|
#define DEBUGF(x) x
|
2007-02-02 10:31:32 -05:00
|
|
|
#else
|
2011-09-04 11:09:22 -04:00
|
|
|
#define DEBUGF(x) do { } WHILE_FALSE
|
2007-02-21 14:03:20 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Macro used to include assertion code only in debug builds.
|
|
|
|
*/
|
|
|
|
|
2009-06-09 22:49:42 -04:00
|
|
|
#if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H)
|
2007-02-21 14:03:20 -05:00
|
|
|
#define DEBUGASSERT(x) assert(x)
|
|
|
|
#else
|
2011-09-04 11:09:22 -04:00
|
|
|
#define DEBUGASSERT(x) do { } WHILE_FALSE
|
2007-02-02 10:31:32 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-02-15 11:23:24 -05:00
|
|
|
/*
|
|
|
|
* Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno
|
|
|
|
* (or equivalent) on this platform to hide platform details to code using it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef USE_WINSOCK
|
|
|
|
#define SOCKERRNO ((int)WSAGetLastError())
|
|
|
|
#define SET_SOCKERRNO(x) (WSASetLastError((int)(x)))
|
|
|
|
#else
|
|
|
|
#define SOCKERRNO (errno)
|
|
|
|
#define SET_SOCKERRNO(x) (errno = (x))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-02-17 08:51:24 -05:00
|
|
|
/*
|
|
|
|
* Portable error number symbolic names defined to Winsock error codes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef USE_WINSOCK
|
2007-04-04 02:06:36 -04:00
|
|
|
#undef EBADF /* override definition in errno.h */
|
|
|
|
#define EBADF WSAEBADF
|
|
|
|
#undef EINTR /* override definition in errno.h */
|
|
|
|
#define EINTR WSAEINTR
|
|
|
|
#undef EINVAL /* override definition in errno.h */
|
|
|
|
#define EINVAL WSAEINVAL
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EWOULDBLOCK /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EWOULDBLOCK WSAEWOULDBLOCK
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EINPROGRESS /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EINPROGRESS WSAEINPROGRESS
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EALREADY /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EALREADY WSAEALREADY
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ENOTSOCK /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ENOTSOCK WSAENOTSOCK
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EDESTADDRREQ /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EDESTADDRREQ WSAEDESTADDRREQ
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EMSGSIZE /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EMSGSIZE WSAEMSGSIZE
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EPROTOTYPE /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EPROTOTYPE WSAEPROTOTYPE
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ENOPROTOOPT /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ENOPROTOOPT WSAENOPROTOOPT
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EPROTONOSUPPORT /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
|
|
|
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EOPNOTSUPP /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EOPNOTSUPP WSAEOPNOTSUPP
|
|
|
|
#define EPFNOSUPPORT WSAEPFNOSUPPORT
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EAFNOSUPPORT /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EAFNOSUPPORT WSAEAFNOSUPPORT
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EADDRINUSE /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EADDRINUSE WSAEADDRINUSE
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EADDRNOTAVAIL /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ENETDOWN /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ENETDOWN WSAENETDOWN
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ENETUNREACH /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ENETUNREACH WSAENETUNREACH
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ENETRESET /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ENETRESET WSAENETRESET
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ECONNABORTED /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ECONNABORTED WSAECONNABORTED
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ECONNRESET /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ECONNRESET WSAECONNRESET
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ENOBUFS /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ENOBUFS WSAENOBUFS
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EISCONN /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EISCONN WSAEISCONN
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ENOTCONN /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ENOTCONN WSAENOTCONN
|
|
|
|
#define ESHUTDOWN WSAESHUTDOWN
|
|
|
|
#define ETOOMANYREFS WSAETOOMANYREFS
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ETIMEDOUT /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ETIMEDOUT WSAETIMEDOUT
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ECONNREFUSED /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ECONNREFUSED WSAECONNREFUSED
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef ELOOP /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ELOOP WSAELOOP
|
2007-02-17 19:34:37 -05:00
|
|
|
#ifndef ENAMETOOLONG /* possible previous definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ENAMETOOLONG WSAENAMETOOLONG
|
2007-02-17 19:34:37 -05:00
|
|
|
#endif
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EHOSTDOWN WSAEHOSTDOWN
|
2010-05-20 16:40:48 -04:00
|
|
|
#undef EHOSTUNREACH /* override definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EHOSTUNREACH WSAEHOSTUNREACH
|
2007-02-17 19:34:37 -05:00
|
|
|
#ifndef ENOTEMPTY /* possible previous definition in errno.h */
|
2007-02-17 08:51:24 -05:00
|
|
|
#define ENOTEMPTY WSAENOTEMPTY
|
2007-02-17 19:34:37 -05:00
|
|
|
#endif
|
2007-02-17 08:51:24 -05:00
|
|
|
#define EPROCLIM WSAEPROCLIM
|
|
|
|
#define EUSERS WSAEUSERS
|
|
|
|
#define EDQUOT WSAEDQUOT
|
|
|
|
#define ESTALE WSAESTALE
|
|
|
|
#define EREMOTE WSAEREMOTE
|
|
|
|
#endif
|
|
|
|
|
2007-04-24 23:00:10 -04:00
|
|
|
/*
|
|
|
|
* Macro argv_item_t hides platform details to code using it.
|
|
|
|
*/
|
|
|
|
|
2009-12-30 12:59:56 -05:00
|
|
|
#ifdef __VMS
|
2007-04-24 23:00:10 -04:00
|
|
|
#define argv_item_t __char_ptr32
|
|
|
|
#else
|
|
|
|
#define argv_item_t char *
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-10-17 12:58:32 -04:00
|
|
|
/*
|
|
|
|
* We use this ZERO_NULL to avoid picky compiler warnings,
|
|
|
|
* when assigning a NULL pointer to a function pointer var.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define ZERO_NULL 0
|
|
|
|
|
2011-08-05 09:42:05 -04:00
|
|
|
|
2012-12-28 06:03:09 -05:00
|
|
|
#endif /* HEADER_CURL_SETUP_ONCE_H */
|
|
|
|
|