20
20
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
21
* KIND, either express or implied.
23
* $Id: curl.h,v 1.352 2008-06-03 18:00:48 danf Exp $
23
* $Id: curl.h,v 1.379 2009-03-02 23:05:31 bagder Exp $
24
24
***************************************************************************/
26
/* If you have problems, all libcurl docs and details are found here:
27
http://curl.haxx.se/libcurl/
27
* If you have libcurl problems, all docs and details are found here:
28
* http://curl.haxx.se/libcurl/
30
* curl-library mailing list subscription and unsubscription web interface:
31
* http://cool.haxx.se/mailman/listinfo/curl-library/
30
#include "curlver.h" /* the libcurl version defines */
34
#include "curlver.h" /* libcurl version defines */
35
#include "curl/curlbuild.h" /* libcurl build definitions */
36
#include "curlrules.h" /* libcurl rules enforcement */
33
39
* Define WIN32 when build target is Win32 API
117
* We want the typedef curl_off_t setup for large file support on all
118
* platforms. We also provide a CURL_FORMAT_OFF_T define to use in *printf
119
* format strings when outputting a variable of type curl_off_t.
121
* Note: "pocc -Ze" is MSVC compatibility mode and this sets _MSC_VER!
124
#if (defined(_MSC_VER) && !defined(__POCC__)) || (defined(__LCC__) && \
128
typedef long curl_off_t;
129
#define CURL_FORMAT_OFF_T "%ld"
131
typedef signed __int64 curl_off_t;
132
#define CURL_FORMAT_OFF_T "%I64d"
134
#else /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
135
#if (defined(__GNUC__) && defined(WIN32)) || defined(__WATCOMC__)
136
/* gcc on windows or Watcom */
137
typedef long long curl_off_t;
138
#define CURL_FORMAT_OFF_T "%I64d"
139
#else /* GCC or Watcom on Windows */
140
#if defined(__ILEC400__)
141
/* OS400 C compiler. */
142
typedef long long curl_off_t;
143
#define CURL_FORMAT_OFF_T "%lld"
144
#else /* OS400 C compiler. */
146
/* "normal" POSIX approach, do note that this does not necessarily mean that
147
the type is >32 bits, see the SIZEOF_CURL_OFF_T define for that! */
148
typedef off_t curl_off_t;
150
/* Check a range of defines to detect large file support. On Linux it seems
151
none of these are set by default, so if you don't explicitly switches on
152
large file support, this define will be made for "small file" support. */
153
#ifndef _FILE_OFFSET_BITS
154
#define _FILE_OFFSET_BITS 0 /* to prevent warnings in the check below */
155
#define UNDEF_FILE_OFFSET_BITS
158
#define FILESIZEBITS 0 /* to prevent warnings in the check below */
159
#define UNDEF_FILESIZEBITS
162
#if defined(_LARGE_FILES) || (_FILE_OFFSET_BITS > 32) || (FILESIZEBITS > 32) \
163
|| defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)
164
/* For now, we assume at least one of these to be set for large files to
166
#define CURL_FORMAT_OFF_T "%lld"
167
#else /* LARGE_FILE support */
168
#define CURL_FORMAT_OFF_T "%ld"
170
#endif /* OS400 C compiler. */
171
#endif /* GCC or Watcom on Windows */
172
#endif /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
174
#ifdef UNDEF_FILE_OFFSET_BITS
175
/* this was defined above for our checks, undefine it again */
176
#undef _FILE_OFFSET_BITS
179
#ifdef UNDEF_FILESIZEBITS
180
/* this was defined above for our checks, undefine it again */
184
122
#ifndef curl_socket_typedef
185
123
/* socket typedef */
452
390
CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL
454
392
CURLE_AGAIN, /* 81 - socket is not ready for send/recv,
455
wait till it's ready and try again */
393
wait till it's ready and try again (Added
395
CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or
396
wrong format (Added in 7.19.0) */
397
CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in
456
399
CURL_LAST /* never use! */
531
477
#define CURLAUTH_DIGEST (1<<1) /* Digest */
532
478
#define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */
533
479
#define CURLAUTH_NTLM (1<<3) /* NTLM */
534
#define CURLAUTH_ANY ~0 /* all types set */
535
#define CURLAUTH_ANYSAFE (~CURLAUTH_BASIC)
480
#define CURLAUTH_DIGEST_IE (1<<4) /* Digest with IE flavour */
481
#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) /* all fine types set */
482
#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
537
484
#define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */
538
485
#define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */
583
530
CURLFTPAUTH_LAST /* not an option, never use */
533
/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
535
CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */
536
CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD
537
again if MKD succeeded, for SFTP this does
539
CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
540
again even if MKD failed! */
541
CURLFTP_CREATE_DIR_LAST /* not an option, never use */
586
544
/* parameter for the CURLOPT_FTP_FILEMETHOD option */
588
546
CURLFTPMETHOD_DEFAULT, /* let libcurl pick */
592
550
CURLFTPMETHOD_LAST /* not an option, never use */
593
551
} curl_ftpmethod;
553
/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
554
#define CURLPROTO_HTTP (1<<0)
555
#define CURLPROTO_HTTPS (1<<1)
556
#define CURLPROTO_FTP (1<<2)
557
#define CURLPROTO_FTPS (1<<3)
558
#define CURLPROTO_SCP (1<<4)
559
#define CURLPROTO_SFTP (1<<5)
560
#define CURLPROTO_TELNET (1<<6)
561
#define CURLPROTO_LDAP (1<<7)
562
#define CURLPROTO_LDAPS (1<<8)
563
#define CURLPROTO_DICT (1<<9)
564
#define CURLPROTO_FILE (1<<10)
565
#define CURLPROTO_TFTP (1<<11)
566
#define CURLPROTO_ALL (~0) /* enable everything */
595
568
/* long may be 32 or 64 bits, but we should never depend on anything else
597
570
#define CURLOPTTYPE_LONG 0
609
* Figure out if we can use the ## operator, which is supported by ISO/ANSI C
610
* and C++. Some compilers support it without setting __STDC__ or __cplusplus
611
* so we need to carefully check for them too. We don't use configure-checks
612
* for these since we want these headers to remain generic and working for all
615
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
616
defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
617
defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
619
/* This compiler is believed to have an ISO compatible preprocessor */
622
/* This compiler is believed NOT to have an ISO compatible preprocessor */
626
582
#ifdef CURL_ISOCPP
627
583
#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
732
688
/* This points to a linked list of headers, struct curl_slist kind */
733
689
CINIT(HTTPHEADER, OBJECTPOINT, 23),
735
/* This points to a linked list of post entries, struct HttpPost */
691
/* This points to a linked list of post entries, struct curl_httppost */
736
692
CINIT(HTTPPOST, OBJECTPOINT, 24),
738
694
/* name of the file keeping your private SSL-certificate */
1007
963
CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
1009
/* FTP Option that causes missing dirs to be created on the remote server */
965
/* FTP Option that causes missing dirs to be created on the remote server.
966
In 7.19.4 we introduced the convenience enums for this option using the
967
CURLFTP_CREATE_DIR prefix.
1010
969
CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
1012
971
/* Set this to a bitmask value to enable the particular authentications
1177
1136
CINIT(NEW_FILE_PERMS, LONG, 159),
1178
1137
CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
1180
/* Obey RFC 2616/10.3.2 and keep POSTs as POSTs after a 301 */
1181
CINIT(POST301, LONG, 161),
1139
/* Set the behaviour of POST when redirecting. Values must be set to one
1140
of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
1141
CINIT(POSTREDIR, LONG, 161),
1183
1143
/* used by scp/sftp to verify the host's public key */
1184
1144
CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),
1200
1160
CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
1201
1161
CINIT(SEEKDATA, OBJECTPOINT, 168),
1164
CINIT(CRLFILE, OBJECTPOINT, 169),
1166
/* Issuer certificate */
1167
CINIT(ISSUERCERT, OBJECTPOINT, 170),
1169
/* (IPv6) Address scope */
1170
CINIT(ADDRESS_SCOPE, LONG, 171),
1172
/* Collect certificate chain info and allow it to get retrievable with
1173
CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only
1174
working with OpenSSL-powered builds. */
1175
CINIT(CERTINFO, LONG, 172),
1177
/* "name" and "pwd" to use when fetching. */
1178
CINIT(USERNAME, OBJECTPOINT, 173),
1179
CINIT(PASSWORD, OBJECTPOINT, 174),
1181
/* "name" and "pwd" to use with Proxy when fetching. */
1182
CINIT(PROXYUSERNAME, OBJECTPOINT, 175),
1183
CINIT(PROXYPASSWORD, OBJECTPOINT, 176),
1185
/* Comma separated list of hostnames defining no-proxy zones. These should
1186
match both hostnames directly, and hostnames within a domain. For
1187
example, local.com will match local.com and www.local.com, but NOT
1188
notlocal.com or www.notlocal.com. For compatibility with other
1189
implementations of this, .local.com will be considered to be the same as
1190
local.com. A single * is the only valid wildcard, and effectively
1191
disables the use of proxy. */
1192
CINIT(NOPROXY, OBJECTPOINT, 177),
1194
/* block size for TFTP transfers */
1195
CINIT(TFTP_BLKSIZE, LONG, 178),
1198
CINIT(SOCKS5_GSSAPI_SERVICE, LONG, 179),
1201
CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
1203
/* set the bitmask for the protocols that are allowed to be used for the
1204
transfer, which thus helps the app which takes URLs from users or other
1205
external inputs and want to restrict what protocol(s) to deal
1206
with. Defaults to CURLPROTO_ALL. */
1207
CINIT(PROTOCOLS, LONG, 181),
1209
/* set the bitmask for the protocols that libcurl is allowed to follow to,
1210
as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
1211
to be set in both bitmasks to be allowed to get redirected to. Defaults
1212
to all protocols except FILE and SCP. */
1213
CINIT(REDIR_PROTOCOLS, LONG, 182),
1203
1215
CURLOPT_LASTENTRY /* the last unused */
1557
1582
CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
1584
/* info about the certificate chain, only for OpenSSL builds. Asked
1585
for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
1586
struct curl_certinfo {
1587
int num_of_certs; /* number of certificates with information */
1588
struct curl_slist **certinfo; /* for each index in this array, there's a
1589
linked list with textual information in the
1590
format "name: value" */
1559
1593
#define CURLINFO_STRING 0x100000
1560
1594
#define CURLINFO_LONG 0x200000
1561
1595
#define CURLINFO_DOUBLE 0x300000
1596
1630
CURLINFO_LASTSOCKET = CURLINFO_LONG + 29,
1597
1631
CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30,
1598
1632
CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31,
1633
CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32,
1634
CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33,
1635
CURLINFO_CERTINFO = CURLINFO_SLIST + 34,
1636
CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35,
1599
1637
/* Fill in new entries below here! */
1601
CURLINFO_LASTONE = 31
1639
CURLINFO_LASTONE = 35
1604
1642
/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as