diff options
Diffstat (limited to 'Source/CTest/Curl/curl/curl.h')
-rw-r--r-- | Source/CTest/Curl/curl/curl.h | 351 |
1 files changed, 307 insertions, 44 deletions
diff --git a/Source/CTest/Curl/curl/curl.h b/Source/CTest/Curl/curl/curl.h index b6bc3a6..c56c965 100644 --- a/Source/CTest/Curl/curl/curl.h +++ b/Source/CTest/Curl/curl/curl.h @@ -1,27 +1,27 @@ #ifndef __CURL_CURL_H #define __CURL_CURL_H -/***************************************************************************** +/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2002, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * In order to be useful for every potential user, curl and libcurl are - * dual-licensed under the MPL and the MIT/X-derivate licenses. + * Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al. * + * 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. + * * 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 MPL or the MIT/X-derivate - * licenses. You may pick one of these licenses. + * 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. * * $Id$ - *****************************************************************************/ + ***************************************************************************/ #include <stdio.h> /* The include stuff here is mainly for time_t! */ @@ -49,22 +49,31 @@ #define FALSE 0 #endif -#include <curl/types.h> +#include "types.h" #ifdef __cplusplus extern "C" { #endif -struct HttpPost { - struct HttpPost *next; /* next entry in the list */ +/* stupid #define trick to preserve functionality with older code, but + making it use our name space for the future */ +#define HttpPost curl_httppost + +struct curl_httppost { + 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 */ + + /* CMC: Added support for buffer uploads */ + char *buffer; /* pointer to allocated buffer contents */ + long bufferlength; /* length of buffer field */ + char *contenttype; /* Content-Type */ struct curl_slist* contentheader; /* list of extra headers for this form */ - struct HttpPost *more; /* if one field name has more than one file, this - link should link to following files */ + struct curl_httppost *more; /* if one field name has more than one file, this + link should link to following files */ long flags; /* as defined below */ #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */ #define HTTPPOST_READFILE (1<<1) /* specified content is a file name */ @@ -72,6 +81,13 @@ struct HttpPost { do not free in formfree */ #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer do not free in formfree */ + +/* CMC: Added support for buffer uploads */ +#define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */ +#define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */ + + char *showfilename; /* The file name to show. If not set, the actual + file name will be used (if this is a file part) */ }; typedef int (*curl_progress_callback)(void *clientp, @@ -80,6 +96,8 @@ typedef int (*curl_progress_callback)(void *clientp, double ultotal, double ulnow); +#define CURL_MAX_WRITE_SIZE 20480 + typedef size_t (*curl_write_callback)(char *buffer, size_t size, size_t nitems, @@ -95,6 +113,23 @@ typedef int (*curl_passwd_callback)(void *clientp, char *buffer, int buflen); +/* the kind of data that is passed to information_callback*/ +typedef enum { + CURLINFO_TEXT = 0, + CURLINFO_HEADER_IN, /* 1 */ + CURLINFO_HEADER_OUT, /* 2 */ + CURLINFO_DATA_IN, /* 3 */ + CURLINFO_DATA_OUT, /* 4 */ + CURLINFO_END +} curl_infotype; + +typedef int (*curl_debug_callback) + (CURL *handle, /* the handle/transfer this concerns */ + curl_infotype type, /* what kind of data */ + char *data, /* points to the data */ + size_t size, /* size of the data pointed to */ + void *userp); /* whatever the user please */ + /* All possible error codes from all sorts of curl functions. Future versions may return other values, stay prepared. @@ -139,7 +174,7 @@ typedef enum { CURLE_HTTP_RANGE_ERROR, /* 33 - RANGE "command" didn't work */ CURLE_HTTP_POST_ERROR, /* 34 */ CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */ - CURLE_FTP_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */ + CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */ CURLE_FILE_COULDNT_READ_FILE, /* 37 */ CURLE_LDAP_CANNOT_BIND, /* 38 */ CURLE_LDAP_SEARCH_FAILED, /* 39 */ @@ -157,11 +192,28 @@ typedef enum { CURLE_SSL_PEER_CERTIFICATE, /* 51 - peer's certificate wasn't ok */ CURLE_GOT_NOTHING, /* 52 - when this is a specific error */ CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */ - CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as default */ + CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as + default */ + CURLE_SEND_ERROR, /* 55 - failed sending network data */ + CURLE_RECV_ERROR, /* 56 - failure in receiving network data */ + CURLE_SHARE_IN_USE, /* 57 - share is in use */ + CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ + CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ + CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ + CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */ CURL_LAST /* never use! */ } CURLcode; +/* Make a spelling correction for the operation timed-out define */ +#define CURLE_OPERATION_TIMEDOUT CURLE_OPERATION_TIMEOUTED + +typedef enum { + CURLPROXY_HTTP = 0, + CURLPROXY_SOCKS4 = 4, + CURLPROXY_SOCKS5 = 5 +} curl_proxytype; + /* this was the error code 50 in 7.7.3 and a few earlier versions, this is no longer used by libcurl but is instead #defined here only to not make programs break */ @@ -169,22 +221,47 @@ typedef enum { /* This is just to make older programs not break: */ #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE +#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME #define CURL_ERROR_SIZE 256 +/* long may be 32 or 64 bits, but we should never depend on anything else + but 32 */ +#define CURLOPTTYPE_LONG 0 +#define CURLOPTTYPE_OBJECTPOINT 10000 +#define CURLOPTTYPE_FUNCTIONPOINT 20000 + /* name is uppercase CURLOPT_<name>, type is one of the defined CURLOPTTYPE_<type> number is unique identifier */ #ifdef CINIT #undef CINIT #endif -#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number +/* + * Figure out if we can use the ## operator, which is supported by ISO/ANSI C + * and C++. Some compilers support it without setting __STDC__ or __cplusplus + * so we need to carefully check for them too. We don't use configure-checks + * for these since we want these headers to remain generic and working for all + * platforms. + */ +#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ + defined(__HP_aCC) || defined(__BORLANDC__) + /* This compiler is believed to have an ISO compatible preprocessor */ +#define CURL_ISOCPP +#else + /* This compiler is believed NOT to have an ISO compatible preprocessor */ +#undef CURL_ISOCPP +#endif -/* long may be 32 or 64 bits, but we should never depend on anything else - but 32 */ -#define CURLOPTTYPE_LONG 0 -#define CURLOPTTYPE_OBJECTPOINT 10000 -#define CURLOPTTYPE_FUNCTIONPOINT 20000 +#ifdef CURL_ISOCPP +#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number +#else +/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ +#define LONG CURLOPTTYPE_LONG +#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT +#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT +#define CINIT(name,type,number) CURLOPT_/**/name = type + number +#endif typedef enum { CINIT(NOTHING, LONG, 0), /********* the first one is unused ************/ @@ -344,7 +421,11 @@ typedef enum { CINIT(FTPLISTONLY, LONG, 48), /* Use NLST when listing ftp dir */ CINIT(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */ - CINIT(NETRC, LONG, 51), /* read user+password from .netrc */ + + /* Specify whether to read the user+password from the .netrc or the URL. + * This must be one of the CURL_NETRC_* enums below. */ + CINIT(NETRC, LONG, 51), + CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */ /* This FTPASCII name is now obsolete, to be removed, use the TRANSFERTEXT @@ -496,10 +577,49 @@ typedef enum { /* send linked-list of pre-transfer QUOTE commands (Wesley Laxton)*/ CINIT(PREQUOTE, OBJECTPOINT, 93), + + /* set the debug function */ + CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94), + + /* set the data for the debug function */ + CINIT(DEBUGDATA, OBJECTPOINT, 95), + + /* mark this as start of a cookie session */ + CINIT(COOKIESESSION, LONG, 96), + + /* The CApath directory used to validate the peer certificate + this option is used only if SSL_VERIFYPEER is true */ + CINIT(CAPATH, OBJECTPOINT, 97), + + /* Instruct libcurl to use a smaller receive buffer */ + CINIT(BUFFERSIZE, LONG, 98), + + /* Instruct libcurl to not use any signal/alarm handlers, even when using + timeouts. This option is useful for multi-threaded applications. + See libcurl-the-guide for more background information. */ + CINIT(NOSIGNAL, LONG, 99), - CURLOPT_LASTENTRY /* the last unusued */ + /* Provide a CURLShare for mutexing non-ts data */ + CINIT(SHARE, OBJECTPOINT, 100), + + /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default), + CURLPROXY_SOCKS4 and CURLPROXY_SOCKS5. */ + CINIT(PROXYTYPE, LONG, 101), + + /* Set the Accept-Encoding string. Use this to tell a server you would like + the response to be compressed. */ + CINIT(ENCODING, OBJECTPOINT, 102), + + + CURLOPT_LASTENTRY /* the last unused */ } CURLoption; + /* two convenient "aliases" that follow the name scheme better */ +#define CURLOPT_WRITEDATA CURLOPT_FILE +#define CURLOPT_READDATA CURLOPT_INFILE +#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER + + /* These enums are for use with the CURLOPT_HTTP_VERSION option. */ enum { CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd @@ -511,6 +631,18 @@ enum { CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */ }; + /* These enums are for use with the CURLOPT_NETRC option. */ +enum CURL_NETRC_OPTION { + CURL_NETRC_IGNORED, /* The .netrc will never be read. + * This is the default. */ + CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred + * to one in the .netrc. */ + CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored. + * Unless one is set programmatically, the .netrc + * will be queried. */ + CURL_NETRC_LAST +}; + enum { CURL_SSLVERSION_DEFAULT, CURL_SSLVERSION_TLSv1, @@ -522,15 +654,26 @@ enum { typedef enum { - TIMECOND_NONE, + CURL_TIMECOND_NONE, - TIMECOND_IFMODSINCE, - TIMECOND_IFUNMODSINCE, - TIMECOND_LASTMOD, + CURL_TIMECOND_IFMODSINCE, + CURL_TIMECOND_IFUNMODSINCE, + CURL_TIMECOND_LASTMOD, - TIMECOND_LAST + CURL_TIMECOND_LAST } curl_TimeCond; +/* for backwards compatibility */ +#ifndef TIMECOND_IFMODSINCE +#define TIMECOND_IFMODSINCE CURL_TIMECOND_IFMODSINCE +#endif +#ifndef TIMECOND_IFUNMODSINCE +#define TIMECOND_IFUNMODSINCE CURL_TIMECOND_IFUNMODSINCE +#endif +#ifndef TIMECOND_LASTMOD +#define TIMECOND_LASTMOD CURL_TIMECOND_LASTMOD +#endif + #ifdef __BEOS__ #include <support/SupportDefs.h> #endif @@ -548,16 +691,21 @@ extern int (curl_strnequal)(const char *s1, const char *s2, size_t n); #define strequal(a,b) curl_strequal(a,b) #define strnequal(a,b,c) curl_strnequal(a,b,c) -/* external form function */ -int curl_formparse(char *string, - struct HttpPost **httppost, - struct HttpPost **last_post); +/* DEPRECATED function to build formdata */ +int curl_formparse(char *, struct curl_httppost **, + struct curl_httppost **_post); /* name is uppercase CURLFORM_<name> */ #ifdef CFINIT #undef CFINIT #endif + +#ifdef CURL_ISOCPP #define CFINIT(name) CURLFORM_ ## name +#else +/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ +#define CFINIT(name) CURLFORM_/**/name +#endif typedef enum { CFINIT(NOTHING), /********* the first one is unused ************/ @@ -571,29 +719,65 @@ typedef enum { CFINIT(CONTENTSLENGTH), CFINIT(FILECONTENT), CFINIT(ARRAY), - CFINIT(ARRAY_START), /* below are the options allowed within a array */ + CFINIT(OBSOLETE), CFINIT(FILE), + + CFINIT(BUFFER), + CFINIT(BUFFERPTR), + CFINIT(BUFFERLENGTH), + CFINIT(CONTENTTYPE), CFINIT(CONTENTHEADER), + CFINIT(FILENAME), CFINIT(END), - CFINIT(ARRAY_END), /* up are the options allowed within a array */ + CFINIT(OBSOLETE2), CURLFORM_LASTENTRY /* the last unusued */ } CURLformoption; +#undef CFINIT /* done */ + /* structure to be used as parameter for CURLFORM_ARRAY */ struct curl_forms { CURLformoption option; const char *value; }; -/* new external form function */ -int curl_formadd(struct HttpPost **httppost, - struct HttpPost **last_post, +/* use this for multipart formpost building */ +/* Returns code for curl_formadd() + * + * Returns: + * CURL_FORMADD_OK on success + * CURL_FORMADD_MEMORY if the FormInfo allocation fails + * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form + * CURL_FORMADD_NULL if a null pointer was given for a char + * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed + * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used + * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error) + * CURL_FORMADD_MEMORY if a HttpPost struct cannot be allocated + * CURL_FORMADD_MEMORY if some allocation for string copying failed. + * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array + * + ***************************************************************************/ +typedef enum { + CURL_FORMADD_OK, /* first, no error */ + + CURL_FORMADD_MEMORY, + CURL_FORMADD_OPTION_TWICE, + CURL_FORMADD_NULL, + CURL_FORMADD_UNKNOWN_OPTION, + CURL_FORMADD_INCOMPLETE, + CURL_FORMADD_ILLEGAL_ARRAY, + + CURL_FORMADD_LAST /* last */ +} CURLFORMcode; + +CURLFORMcode curl_formadd(struct curl_httppost **httppost, + struct curl_httppost **last_post, ...); /* cleanup a form: */ -void curl_formfree(struct HttpPost *form); +void curl_formfree(struct curl_httppost *form); /* Unix and Win32 getenv function call, this returns a malloc()'ed string that MUST be free()ed after usage is complete. */ @@ -606,6 +790,9 @@ char *curl_version(void); * allocated string or NULL if an error occurred. */ char *curl_escape(const char *string, int length); char *curl_unescape(const char *string, int length); +/* 20020912 WJM. Provide for a de-allocation in the same translation unit + that did the allocation. Added in libcurl 7.10 */ +void curl_free(void *p); /* curl_global_init() should be invoked exactly once for each application that uses libcurl */ @@ -616,8 +803,8 @@ CURLcode curl_global_init(long flags); void curl_global_cleanup(void); /* This is the version number */ -#define LIBCURL_VERSION "7.9.5" -#define LIBCURL_VERSION_NUM 0x070905 +#define LIBCURL_VERSION "7.10.2" +#define LIBCURL_VERSION_NUM 0x070a02 /* linked-list structure for the CURLOPT_QUOTE option (and other) */ struct curl_slist { @@ -671,14 +858,18 @@ typedef enum { CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18, + CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19, + CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20, + /* Fill in new entries here! */ - CURLINFO_LASTONE = 19 + CURLINFO_LASTONE = 21 } CURLINFO; -/* unfortunately, the easy.h include file needs the options and info stuff - before it can be included! */ -#include <curl/easy.h> /* nothing in curl is fun without the easy stuff */ +/* unfortunately, the easy.h and multi.h include files need options and info + stuff before they can be included! */ +#include "easy.h" /* nothing in curl is fun without the easy stuff */ +#include "multi.h" typedef enum { CURLCLOSEPOLICY_NONE, /* first, never use this */ @@ -698,6 +889,78 @@ typedef enum { #define CURL_GLOBAL_NOTHING 0 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL + +/***************************************************************************** + * Setup defines, protos etc for the sharing stuff. + */ + +/* Different types of locks that a share can aquire */ +typedef enum { + CURL_LOCK_TYPE_NONE = 0, + CURL_LOCK_TYPE_COOKIE = 1<<0, + CURL_LOCK_TYPE_DNS = 1<<1, + CURL_LOCK_TYPE_SSL_SESSION = 2<<1, + CURL_LOCK_TYPE_CONNECT = 2<<2, + CURL_LOCK_TYPE_LAST +} curl_lock_type; + +typedef void (*curl_lock_function)(CURL *, curl_lock_type, void *); +typedef void (*curl_unlock_function)(CURL *, curl_lock_type, void *); + +typedef struct { + unsigned int specifier; + unsigned int locked; + unsigned int dirty; + + curl_lock_function lockfunc; + curl_unlock_function unlockfunc; + void *clientdata; +} curl_share; + +curl_share *curl_share_init (void); +CURLcode curl_share_setopt (curl_share *, curl_lock_type, int); +CURLcode curl_share_set_lock_function (curl_share *, curl_lock_function); +CURLcode curl_share_set_unlock_function (curl_share *, curl_unlock_function); +CURLcode curl_share_set_lock_data (curl_share *, void *); +CURLcode curl_share_destroy (curl_share *); + +/**************************************************************************** + * Structures for querying information about the curl library at runtime. + */ + +typedef enum { + CURLVERSION_FIRST, + CURLVERSION_LAST /* never actually use this */ +} CURLversion; + +/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by + basicly all programs ever, that want to get version information. It is + meant to be a built-in version number for what kind of struct the caller + expects. If the struct ever changes, we redfine the NOW to another enum + from above. */ +#define CURLVERSION_NOW CURLVERSION_FIRST + +typedef struct { + CURLversion age; /* age of the returned struct */ + const char *version; /* LIBCURL_VERSION */ + unsigned int version_num; /* LIBCURL_VERSION_NUM */ + const char *host; /* OS/host/cpu/machine when configured */ + int features; /* bitmask, see defines below */ + char *ssl_version; /* human readable string */ + long ssl_version_num; /* number */ + const char *libz_version; /* human readable string */ + /* protocols is terminated by an entry with a NULL protoname */ + const char **protocols; +} curl_version_info_data; + +#define CURL_VERSION_IPV6 (1<<0) +#define CURL_VERSION_KERBEROS4 (1<<1) +#define CURL_VERSION_SSL (1<<2) +#define CURL_VERSION_LIBZ (1<<3) + +/* returns a pointer to a static copy of the version info struct */ +curl_version_info_data *curl_version_info(CURLversion); + #ifdef __cplusplus } #endif |