Skip to content
curl.h 65.2 KiB
Newer Older
#ifndef __CURL_CURL_H
#define __CURL_CURL_H
/***************************************************************************
 *                                  _   _ ____  _
 *  Project                     ___| | | |  _ \| |
 *                             / __| | | | |_) | |
 *                            | (__| |_| |  _ <| |___
Daniel Stenberg's avatar
Daniel Stenberg committed
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
Daniel Stenberg's avatar
Daniel Stenberg committed
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
 * are also available at http://curl.haxx.se/docs/copyright.html.
Daniel Stenberg's avatar
Daniel Stenberg committed
 * 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.
Daniel Stenberg's avatar
Daniel Stenberg committed
 *
Daniel Stenberg's avatar
Daniel Stenberg committed
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
Daniel Stenberg's avatar
Daniel Stenberg committed
 *
Daniel Stenberg's avatar
Daniel Stenberg committed
 * $Id$
 ***************************************************************************/
/* If you have problems, all libcurl docs and details are found here:
   http://curl.haxx.se/libcurl/
*/

#include "curlver.h" /* the libcurl version defines */
/*
 * Define WIN32 when build target is Win32 API
 */

#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
#define WIN32
#endif

#include <stdio.h>
#include <limits.h>

/* The include stuff here below is mainly for time_t! */
#ifdef vms
# include <types.h>
# include <time.h>
#else
# include <sys/types.h>
#endif /* defined (vms) */

#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
  !defined(__CYGWIN__) || defined(__MINGW32__)
#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
/* The check above prevents the winsock2 inclusion if winsock.h already was
   included, since they can't co-exist without problems */
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#else

/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
   libc5-based Linux systems. Only include it on system that are known to
   require it! */
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || defined(__minix)
#include <sys/select.h>
#endif

#ifndef _WIN32_WCE
#include <sys/socket.h>
#endif
#ifndef __WATCOMC__
#include <sys/time.h>
#endif
#include <sys/types.h>
#endif

#ifdef __BEOS__
#include <support/SupportDefs.h>
#endif
Daniel Stenberg's avatar
Daniel Stenberg committed

Daniel Stenberg's avatar
Daniel Stenberg committed
#ifdef  __cplusplus
extern "C" {
#endif

Gisle Vanem's avatar
 
Gisle Vanem committed
/*
Gisle Vanem's avatar
Gisle Vanem committed
 * Decorate exportable functions for Win32 DLL linking.
Gisle Vanem's avatar
 
Gisle Vanem committed
 * This avoids using a .def file for building libcurl.dll.
 */
#if (defined(WIN32) || defined(_WIN32)) && !defined(CURL_STATICLIB)
Gisle Vanem's avatar
 
Gisle Vanem committed
#if defined(BUILDING_LIBCURL)
#define CURL_EXTERN  __declspec(dllexport)
#else
#define CURL_EXTERN  __declspec(dllimport)
#endif
#else
 * This definition is used to make external definitions visibile in the
 * shared library when symbols are hidden by default.  It makes no
 * difference when compiling applications whether this is set or not,
 * only when compiling the library.
#define CURL_EXTERN CURL_EXTERN_SYMBOL
Gisle Vanem's avatar
 
Gisle Vanem committed
#endif

/*
 * We want the typedef curl_off_t setup for large file support on all
 * platforms. We also provide a CURL_FORMAT_OFF_T define to use in *printf
 * format strings when outputting a variable of type curl_off_t.
 *
 * Note: "pocc -Ze" is MSVC compatibily mode and this sets _MSC_VER!
#if (defined(_MSC_VER) && !defined(__POCC__)) || (defined(__LCC__) && defined(WIN32))
#ifdef _WIN32_WCE
  typedef long curl_off_t;
#define CURL_FORMAT_OFF_T "%ld"
#else
  typedef signed __int64 curl_off_t;
#define CURL_FORMAT_OFF_T "%I64d"
#else /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
#if (defined(__GNUC__) && defined(WIN32)) || defined(__WATCOMC__)
/* gcc on windows or Watcom */
  typedef long long curl_off_t;
#define CURL_FORMAT_OFF_T "%I64d"
#else /* GCC or Watcom on Windows  */
#if defined(__ILEC400__)
/* OS400 C compiler. */
  typedef long long curl_off_t;
#define CURL_FORMAT_OFF_T "%lld"
#else /* OS400 C compiler. */

/* "normal" POSIX approach, do note that this does not necessarily mean that
   the type is >32 bits, see the SIZEOF_CURL_OFF_T define for that! */
  typedef off_t curl_off_t;

/* Check a range of defines to detect large file support. On Linux it seems
   none of these are set by default, so if you don't explicitly switches on
   large file support, this define will be made for "small file" support. */
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 0 /* to prevent warnings in the check below */
#define UNDEF_FILE_OFFSET_BITS
#endif
#ifndef FILESIZEBITS
#define FILESIZEBITS 0 /* to prevent warnings in the check below */
#define UNDEF_FILESIZEBITS
#endif

#if defined(_LARGE_FILES) || (_FILE_OFFSET_BITS > 32) || (FILESIZEBITS > 32) \
   || defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)
  /* For now, we assume at least one of these to be set for large files to
     work! */
#define CURL_FORMAT_OFF_T "%lld"
#else /* LARGE_FILE support */
#define CURL_FORMAT_OFF_T "%ld"
#endif /* OS400 C compiler. */
#endif /* GCC or Watcom on Windows */
#endif /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
#ifdef UNDEF_FILE_OFFSET_BITS
/* this was defined above for our checks, undefine it again */
#undef _FILE_OFFSET_BITS
#endif

#ifdef UNDEF_FILESIZEBITS
/* this was defined above for our checks, undefine it again */
#undef FILESIZEBITS
#endif

#ifndef curl_socket_typedef
/* socket typedef */
#ifdef WIN32
typedef SOCKET curl_socket_t;
#define CURL_SOCKET_BAD INVALID_SOCKET
#else
typedef int curl_socket_t;
#define CURL_SOCKET_BAD -1
#endif
#define curl_socket_typedef
#endif /* curl_socket_typedef */

  struct curl_httppost *next;       /* next entry in the list */
  char *name;                       /* pointer to allocated name */
  long namelength;                  /* length of name length */
  char *contents;                   /* pointer to allocated data contents */
  long contentslength;              /* length of contents field */
  char *buffer;                     /* pointer to allocated buffer contents */
  long bufferlength;                /* length of buffer field */
  char *contenttype;                /* Content-Type */
Loading full blame...