3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at http://curl.haxx.se/docs/copyright.html.
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 * $Id: curl.h,v 1.243 2004/03/12 08:55:50 bagder Exp $
24 ***************************************************************************/
26 /* If you have problems, all libcurl docs and details are found here:
27 http://curl.haxx.se/libcurl/
30 /* This is the version number of the libcurl package from which this header
32 #define LIBCURL_VERSION "7.11.1"
34 /* This is the numeric version of the libcurl version number, meant for easier
35 parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
36 always follow this syntax:
40 Where XX, YY and ZZ are the main version, release and patch numbers in
41 hexadecimal. All three numbers are always represented using two digits. 1.2
42 would appear as "0x010200" while version 9.11.7 appears as "0x090b07".
44 This 6-digit hexadecimal number does not show pre-release number, and it is
45 always a greater number in a more recent release. It makes comparisons with
46 greater than and less than work.
48 #define LIBCURL_VERSION_NUM 0x70B01
50 /* The numeric version number is also available "in parts" by using these
52 #define LIBCURL_VERSION_MAJOR 7
53 #define LIBCURL_VERSION_MINOR 11
54 #define LIBCURL_VERSION_PATCH 1
59 /* The include stuff here below is mainly for time_t! */
64 #if !__MACH__ && __MWERKS__
67 # include <sys/types.h>
70 #endif /* defined (vms) */
79 * We want the typedef curl_off_t setup for large file support on all
80 * platforms. We also provide a CURL_FORMAT_OFF_T define to use in *printf
81 * format strings when outputting a variable of type curl_off_t.
85 typedef signed __int64 curl_off_t;
86 #define CURL_FORMAT_OFF_T "%I64d"
88 #if (defined(__GNUC__) && defined(WIN32)) || defined(__WATCOMC__)
89 /* gcc on windows or Watcom */
90 typedef long long curl_off_t;
91 #define CURL_FORMAT_OFF_T "%I64d"
92 #else /* GCC or Watcom on Windows */
94 /* "normal" POSIX approach, do note that this does not necessarily mean that
95 the type is >32 bits, see the SIZEOF_CURL_OFF_T define for that! */
96 typedef off_t curl_off_t;
98 /* Check a range of defines to detect large file support. On Linux it seems
99 none of these are set by default, so if you don't explicitly switches on
100 large file support, this define will be made for "small file" support. */
101 #ifndef _FILE_OFFSET_BITS
102 #define _FILE_OFFSET_BITS 0 /* to prevent warnings in the check below */
103 #define UNDEF_FILE_OFFSET_BITS
106 #define FILESIZEBITS 0 /* to prevent warnings in the check below */
107 #define UNDEF_FILESIZEBITS
110 #if defined(_LARGE_FILES) || (_FILE_OFFSET_BITS > 32) || (FILESIZEBITS > 32) \
111 || defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)
112 /* For now, we assume at least one of these to be set for large files to
114 #define CURL_FORMAT_OFF_T "%lld"
115 #else /* LARGE_FILE support */
116 #define CURL_FORMAT_OFF_T "%ld"
118 #endif /* GCC or Watcom on Windows */
121 #ifdef UNDEF_FILE_OFFSET_BITS
122 /* this was defined above for our checks, undefine it again */
123 #undef _FILE_OFFSET_BITS
126 #ifdef UNDEF_FILESIZEBITS
127 /* this was defined above for our checks, undefine it again */
131 struct curl_httppost {
132 struct curl_httppost *next; /* next entry in the list */
133 char *name; /* pointer to allocated name */
134 long namelength; /* length of name length */
135 char *contents; /* pointer to allocated data contents */
136 long contentslength; /* length of contents field */
137 char *buffer; /* pointer to allocated buffer contents */
138 long bufferlength; /* length of buffer field */
139 char *contenttype; /* Content-Type */
140 struct curl_slist* contentheader; /* list of extra headers for this form */
141 struct curl_httppost *more; /* if one field name has more than one
142 file, this link should link to following
144 long flags; /* as defined below */
145 #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */
146 #define HTTPPOST_READFILE (1<<1) /* specified content is a file name */
147 #define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer
148 do not free in formfree */
149 #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
150 do not free in formfree */
151 #define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */
152 #define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */
154 char *showfilename; /* The file name to show. If not set, the
155 actual file name will be used (if this
159 typedef int (*curl_progress_callback)(void *clientp,
165 /* Tests have proven that 20K is a very bad buffer size for uploads on
166 Windows, while 16K for some odd reason performed a lot better. */
167 #define CURL_MAX_WRITE_SIZE 16384
169 typedef size_t (*curl_write_callback)(char *buffer,
174 typedef size_t (*curl_read_callback)(char *buffer,
179 /* not used since 7.10.8, will be removed in a future release */
180 typedef int (*curl_passwd_callback)(void *clientp,
185 /* the kind of data that is passed to information_callback*/
188 CURLINFO_HEADER_IN, /* 1 */
189 CURLINFO_HEADER_OUT, /* 2 */
190 CURLINFO_DATA_IN, /* 3 */
191 CURLINFO_DATA_OUT, /* 4 */
195 typedef int (*curl_debug_callback)
196 (CURL *handle, /* the handle/transfer this concerns */
197 curl_infotype type, /* what kind of data */
198 char *data, /* points to the data */
199 size_t size, /* size of the data pointed to */
200 void *userptr); /* whatever the user please */
202 /* All possible error codes from all sorts of curl functions. Future versions
203 may return other values, stay prepared.
205 Always add new return codes last. Never *EVER* remove any. The return
206 codes must remain the same!
211 CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
212 CURLE_FAILED_INIT, /* 2 */
213 CURLE_URL_MALFORMAT, /* 3 */
214 CURLE_URL_MALFORMAT_USER, /* 4 */
215 CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
216 CURLE_COULDNT_RESOLVE_HOST, /* 6 */
217 CURLE_COULDNT_CONNECT, /* 7 */
218 CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
219 CURLE_FTP_ACCESS_DENIED, /* 9 */
220 CURLE_FTP_USER_PASSWORD_INCORRECT, /* 10 */
221 CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
222 CURLE_FTP_WEIRD_USER_REPLY, /* 12 */
223 CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
224 CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
225 CURLE_FTP_CANT_GET_HOST, /* 15 */
226 CURLE_FTP_CANT_RECONNECT, /* 16 */
227 CURLE_FTP_COULDNT_SET_BINARY, /* 17 */
228 CURLE_PARTIAL_FILE, /* 18 */
229 CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
230 CURLE_FTP_WRITE_ERROR, /* 20 */
231 CURLE_FTP_QUOTE_ERROR, /* 21 */
232 CURLE_HTTP_RETURNED_ERROR, /* 22 */
233 CURLE_WRITE_ERROR, /* 23 */
234 CURLE_MALFORMAT_USER, /* 24 - user name is illegally specified */
235 CURLE_FTP_COULDNT_STOR_FILE, /* 25 - failed FTP upload */
236 CURLE_READ_ERROR, /* 26 - could open/read from file */
237 CURLE_OUT_OF_MEMORY, /* 27 */
238 CURLE_OPERATION_TIMEOUTED, /* 28 - the timeout time was reached */
239 CURLE_FTP_COULDNT_SET_ASCII, /* 29 - TYPE A failed */
240 CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
241 CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
242 CURLE_FTP_COULDNT_GET_SIZE, /* 32 - the SIZE command failed */
243 CURLE_HTTP_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
244 CURLE_HTTP_POST_ERROR, /* 34 */
245 CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
246 CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
247 CURLE_FILE_COULDNT_READ_FILE, /* 37 */
248 CURLE_LDAP_CANNOT_BIND, /* 38 */
249 CURLE_LDAP_SEARCH_FAILED, /* 39 */
250 CURLE_LIBRARY_NOT_FOUND, /* 40 */
251 CURLE_FUNCTION_NOT_FOUND, /* 41 */
252 CURLE_ABORTED_BY_CALLBACK, /* 42 */
253 CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
254 CURLE_BAD_CALLING_ORDER, /* 44 */
255 CURLE_HTTP_PORT_FAILED, /* 45 - HTTP Interface operation failed */
256 CURLE_BAD_PASSWORD_ENTERED, /* 46 - my_getpass() returns fail */
257 CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
258 CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */
259 CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
260 CURLE_OBSOLETE, /* 50 - removed after 7.7.3 */
261 CURLE_SSL_PEER_CERTIFICATE, /* 51 - peer's certificate wasn't ok */
262 CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
263 CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
264 CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
266 CURLE_SEND_ERROR, /* 55 - failed sending network data */
267 CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
268 CURLE_SHARE_IN_USE, /* 57 - share is in use */
269 CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
270 CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
271 CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
272 CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */
273 CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
274 CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
275 CURLE_FTP_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
277 CURL_LAST /* never use! */
280 typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
281 void *ssl_ctx, /* actually an
285 /* Make a spelling correction for the operation timed-out define */
286 #define CURLE_OPERATION_TIMEDOUT CURLE_OPERATION_TIMEOUTED
287 #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
291 CURLPROXY_SOCKS4 = 4,
295 #define CURLAUTH_NONE 0 /* nothing */
296 #define CURLAUTH_BASIC (1<<0) /* Basic (default) */
297 #define CURLAUTH_DIGEST (1<<1) /* Digest */
298 #define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */
299 #define CURLAUTH_NTLM (1<<3) /* NTLM */
300 #define CURLAUTH_ANY ~0 /* all types set */
301 #define CURLAUTH_ANYSAFE (~CURLAUTH_BASIC)
303 /* this was the error code 50 in 7.7.3 and a few earlier versions, this
304 is no longer used by libcurl but is instead #defined here only to not
305 make programs break */
306 #define CURLE_ALREADY_COMPLETE 99999
308 /* This is just to make older programs not break: */
309 #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
310 #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
312 #define CURL_ERROR_SIZE 256
315 CURLFTPSSL_NONE, /* do not attempt to use SSL */
316 CURLFTPSSL_TRY, /* try using SSL, proceed anyway otherwise */
317 CURLFTPSSL_CONTROL, /* SSL for the control connection or fail */
318 CURLFTPSSL_ALL, /* SSL for all communication or fail */
319 CURLFTPSSL_LAST /* not an option, never use */
322 /* long may be 32 or 64 bits, but we should never depend on anything else
324 #define CURLOPTTYPE_LONG 0
325 #define CURLOPTTYPE_OBJECTPOINT 10000
326 #define CURLOPTTYPE_FUNCTIONPOINT 20000
327 #define CURLOPTTYPE_OFF_T 30000
329 /* name is uppercase CURLOPT_<name>,
330 type is one of the defined CURLOPTTYPE_<type>
331 number is unique identifier */
336 * Figure out if we can use the ## operator, which is supported by ISO/ANSI C
337 * and C++. Some compilers support it without setting __STDC__ or __cplusplus
338 * so we need to carefully check for them too. We don't use configure-checks
339 * for these since we want these headers to remain generic and working for all
342 #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
343 defined(__HP_aCC) || defined(__BORLANDC__)
344 /* This compiler is believed to have an ISO compatible preprocessor */
347 /* This compiler is believed NOT to have an ISO compatible preprocessor */
352 #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
354 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
355 #define LONG CURLOPTTYPE_LONG
356 #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
357 #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
358 #define OFF_T CURLOPTTYPE_OFF_T
359 #define CINIT(name,type,number) CURLOPT_/**/name = type + number
363 * This macro-mania below setups the CURLOPT_[what] enum, to be used with
364 * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
369 /* This is the FILE * or void * the regular output should be written to. */
370 CINIT(FILE, OBJECTPOINT, 1),
372 /* The full URL to get/put */
373 CINIT(URL, OBJECTPOINT, 2),
375 /* Port number to connect to, if other than default. */
376 CINIT(PORT, LONG, 3),
378 /* Name of proxy to use. */
379 CINIT(PROXY, OBJECTPOINT, 4),
381 /* "name:password" to use when fetching. */
382 CINIT(USERPWD, OBJECTPOINT, 5),
384 /* "name:password" to use with proxy. */
385 CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
387 /* Range to get, specified as an ASCII string. */
388 CINIT(RANGE, OBJECTPOINT, 7),
392 /* Specified file stream to upload from (use as input): */
393 CINIT(INFILE, OBJECTPOINT, 9),
395 /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
396 * bytes big. If this is not used, error messages go to stderr instead: */
397 CINIT(ERRORBUFFER, OBJECTPOINT, 10),
399 /* Function that will be called to store the output (instead of fwrite). The
400 * parameters will use fwrite() syntax, make sure to follow them. */
401 CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
403 /* Function that will be called to read the input (instead of fread). The
404 * parameters will use fread() syntax, make sure to follow them. */
405 CINIT(READFUNCTION, FUNCTIONPOINT, 12),
407 /* Time-out the read operation after this amount of seconds */
408 CINIT(TIMEOUT, LONG, 13),
410 /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
411 * how large the file being sent really is. That allows better error
412 * checking and better verifies that the upload was succcessful. -1 means
415 * For large file support, there is also a _LARGE version of the key
416 * which takes an off_t type, allowing platforms with larger off_t
417 * sizes to handle larger files. See below for INFILESIZE_LARGE.
419 CINIT(INFILESIZE, LONG, 14),
421 /* POST input fields. */
422 CINIT(POSTFIELDS, OBJECTPOINT, 15),
424 /* Set the referer page (needed by some CGIs) */
425 CINIT(REFERER, OBJECTPOINT, 16),
427 /* Set the FTP PORT string (interface name, named or numerical IP address)
428 Use i.e '-' to use default address. */
429 CINIT(FTPPORT, OBJECTPOINT, 17),
431 /* Set the User-Agent string (examined by some CGIs) */
432 CINIT(USERAGENT, OBJECTPOINT, 18),
434 /* If the download receives less than "low speed limit" bytes/second
435 * during "low speed time" seconds, the operations is aborted.
436 * You could i.e if you have a pretty high speed connection, abort if
437 * it is less than 2000 bytes/sec during 20 seconds.
440 /* Set the "low speed limit" */
441 CINIT(LOW_SPEED_LIMIT, LONG , 19),
443 /* Set the "low speed time" */
444 CINIT(LOW_SPEED_TIME, LONG, 20),
446 /* Set the continuation offset.
448 * Note there is also a _LARGE version of this key which uses
449 * off_t types, allowing for large file offsets on platforms which
450 * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
452 CINIT(RESUME_FROM, LONG, 21),
454 /* Set cookie in request: */
455 CINIT(COOKIE, OBJECTPOINT, 22),
457 /* This points to a linked list of headers, struct curl_slist kind */
458 CINIT(HTTPHEADER, OBJECTPOINT, 23),
460 /* This points to a linked list of post entries, struct HttpPost */
461 CINIT(HTTPPOST, OBJECTPOINT, 24),
463 /* name of the file keeping your private SSL-certificate */
464 CINIT(SSLCERT, OBJECTPOINT, 25),
466 /* password for the SSL-private key, keep this for compatibility */
467 CINIT(SSLCERTPASSWD, OBJECTPOINT, 26),
468 /* password for the SSL private key */
469 CINIT(SSLKEYPASSWD, OBJECTPOINT, 26),
471 /* send TYPE parameter? */
472 CINIT(CRLF, LONG, 27),
474 /* send linked-list of QUOTE commands */
475 CINIT(QUOTE, OBJECTPOINT, 28),
477 /* send FILE * or void * to store headers to, if you use a callback it
478 is simply passed to the callback unmodified */
479 CINIT(WRITEHEADER, OBJECTPOINT, 29),
481 /* point to a file to read the initial cookies from, also enables
482 "cookie awareness" */
483 CINIT(COOKIEFILE, OBJECTPOINT, 31),
485 /* What version to specifly try to use.
486 See CURL_SSLVERSION defines below. */
487 CINIT(SSLVERSION, LONG, 32),
489 /* What kind of HTTP time condition to use, see defines */
490 CINIT(TIMECONDITION, LONG, 33),
492 /* Time to use with the above condition. Specified in number of seconds
494 CINIT(TIMEVALUE, LONG, 34),
498 /* Custom request, for customizing the get command like
499 HTTP: DELETE, TRACE and others
500 FTP: to use a different list command
502 CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
504 /* HTTP request, for odd commands like DELETE, TRACE and others */
505 CINIT(STDERR, OBJECTPOINT, 37),
509 /* send linked-list of post-transfer QUOTE commands */
510 CINIT(POSTQUOTE, OBJECTPOINT, 39),
512 /* Pass a pointer to string of the output using full variable-replacement
513 as described elsewhere. */
514 CINIT(WRITEINFO, OBJECTPOINT, 40),
516 CINIT(VERBOSE, LONG, 41), /* talk a lot */
517 CINIT(HEADER, LONG, 42), /* throw the header out too */
518 CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */
519 CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */
520 CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */
521 CINIT(UPLOAD, LONG, 46), /* this is an upload */
522 CINIT(POST, LONG, 47), /* HTTP POST method */
523 CINIT(FTPLISTONLY, LONG, 48), /* Use NLST when listing ftp dir */
525 CINIT(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
527 /* Specify whether to read the user+password from the .netrc or the URL.
528 * This must be one of the CURL_NETRC_* enums below. */
529 CINIT(NETRC, LONG, 51),
531 CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
533 CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
534 CINIT(PUT, LONG, 54), /* PUT the input file */
538 /* Function that will be called instead of the internal progress display
539 * function. This function should be defined as the curl_progress_callback
540 * prototype defines. */
541 CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
543 /* Data passed to the progress callback */
544 CINIT(PROGRESSDATA, OBJECTPOINT, 57),
546 /* We want the referer field set automatically when following locations */
547 CINIT(AUTOREFERER, LONG, 58),
549 /* Port of the proxy, can be set in the proxy string as well with:
551 CINIT(PROXYPORT, LONG, 59),
553 /* size of the POST input data, if strlen() is not good to use */
554 CINIT(POSTFIELDSIZE, LONG, 60),
556 /* tunnel non-http operations through a HTTP proxy */
557 CINIT(HTTPPROXYTUNNEL, LONG, 61),
559 /* Set the interface string to use as outgoing network interface */
560 CINIT(INTERFACE, OBJECTPOINT, 62),
562 /* Set the krb4 security level, this also enables krb4 awareness. This is a
563 * string, 'clear', 'safe', 'confidential' or 'private'. If the string is
564 * set but doesn't match one of these, 'private' will be used. */
565 CINIT(KRB4LEVEL, OBJECTPOINT, 63),
567 /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
568 CINIT(SSL_VERIFYPEER, LONG, 64),
570 /* The CApath or CAfile used to validate the peer certificate
571 this option is used only if SSL_VERIFYPEER is true */
572 CINIT(CAINFO, OBJECTPOINT, 65),
577 /* Maximum number of http redirects to follow */
578 CINIT(MAXREDIRS, LONG, 68),
580 /* Pass a pointer to a time_t to get a possible date of the requested
581 document! Pass a NULL to shut it off. */
582 CINIT(FILETIME, OBJECTPOINT, 69),
584 /* This points to a linked list of telnet options */
585 CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
587 /* Max amount of cached alive connections */
588 CINIT(MAXCONNECTS, LONG, 71),
590 /* What policy to use when closing connections when the cache is filled
592 CINIT(CLOSEPOLICY, LONG, 72),
596 /* Set to explicitly use a new connection for the upcoming transfer.
597 Do not use this unless you're absolutely sure of this, as it makes the
598 operation slower and is less friendly for the network. */
599 CINIT(FRESH_CONNECT, LONG, 74),
601 /* Set to explicitly forbid the upcoming transfer's connection to be re-used
602 when done. Do not use this unless you're absolutely sure of this, as it
603 makes the operation slower and is less friendly for the network. */
604 CINIT(FORBID_REUSE, LONG, 75),
606 /* Set to a file name that contains random data for libcurl to use to
607 seed the random engine when doing SSL connects. */
608 CINIT(RANDOM_FILE, OBJECTPOINT, 76),
610 /* Set to the Entropy Gathering Daemon socket pathname */
611 CINIT(EGDSOCKET, OBJECTPOINT, 77),
613 /* Time-out connect operations after this amount of seconds, if connects
614 are OK within this time, then fine... This only aborts the connect
615 phase. [Only works on unix-style/SIGALRM operating systems] */
616 CINIT(CONNECTTIMEOUT, LONG, 78),
618 /* Function that will be called to store headers (instead of fwrite). The
619 * parameters will use fwrite() syntax, make sure to follow them. */
620 CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
622 /* Set this to force the HTTP request to get back to GET. Only really usable
623 if POST, PUT or a custom request have been used first.
625 CINIT(HTTPGET, LONG, 80),
627 /* Set if we should verify the Common name from the peer certificate in ssl
628 * handshake, set 1 to check existence, 2 to ensure that it matches the
629 * provided hostname. */
630 CINIT(SSL_VERIFYHOST, LONG, 81),
632 /* Specify which file name to write all known cookies in after completed
633 operation. Set file name to "-" (dash) to make it go to stdout. */
634 CINIT(COOKIEJAR, OBJECTPOINT, 82),
636 /* Specify which SSL ciphers to use */
637 CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),
639 /* Specify which HTTP version to use! This must be set to one of the
640 CURL_HTTP_VERSION* enums set below. */
641 CINIT(HTTP_VERSION, LONG, 84),
643 /* Specificly switch on or off the FTP engine's use of the EPSV command. By
644 default, that one will always be attempted before the more traditional
646 CINIT(FTP_USE_EPSV, LONG, 85),
648 /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
649 CINIT(SSLCERTTYPE, OBJECTPOINT, 86),
651 /* name of the file keeping your private SSL-key */
652 CINIT(SSLKEY, OBJECTPOINT, 87),
654 /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
655 CINIT(SSLKEYTYPE, OBJECTPOINT, 88),
657 /* crypto engine for the SSL-sub system */
658 CINIT(SSLENGINE, OBJECTPOINT, 89),
660 /* set the crypto engine for the SSL-sub system as default
661 the param has no meaning...
663 CINIT(SSLENGINE_DEFAULT, LONG, 90),
665 /* Non-zero value means to use the global dns cache */
666 CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */
668 /* DNS cache timeout */
669 CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
671 /* send linked-list of pre-transfer QUOTE commands (Wesley Laxton)*/
672 CINIT(PREQUOTE, OBJECTPOINT, 93),
674 /* set the debug function */
675 CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
677 /* set the data for the debug function */
678 CINIT(DEBUGDATA, OBJECTPOINT, 95),
680 /* mark this as start of a cookie session */
681 CINIT(COOKIESESSION, LONG, 96),
683 /* The CApath directory used to validate the peer certificate
684 this option is used only if SSL_VERIFYPEER is true */
685 CINIT(CAPATH, OBJECTPOINT, 97),
687 /* Instruct libcurl to use a smaller receive buffer */
688 CINIT(BUFFERSIZE, LONG, 98),
690 /* Instruct libcurl to not use any signal/alarm handlers, even when using
691 timeouts. This option is useful for multi-threaded applications.
692 See libcurl-the-guide for more background information. */
693 CINIT(NOSIGNAL, LONG, 99),
695 /* Provide a CURLShare for mutexing non-ts data */
696 CINIT(SHARE, OBJECTPOINT, 100),
698 /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
699 CURLPROXY_SOCKS4 and CURLPROXY_SOCKS5. */
700 CINIT(PROXYTYPE, LONG, 101),
702 /* Set the Accept-Encoding string. Use this to tell a server you would like
703 the response to be compressed. */
704 CINIT(ENCODING, OBJECTPOINT, 102),
706 /* Set pointer to private data */
707 CINIT(PRIVATE, OBJECTPOINT, 103),
709 /* Set aliases for HTTP 200 in the HTTP Response header */
710 CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
712 /* Continue to send authentication (user+password) when following locations,
713 even when hostname changed. This can potentionally send off the name
714 and password to whatever host the server decides. */
715 CINIT(UNRESTRICTED_AUTH, LONG, 105),
717 /* Specificly switch on or off the FTP engine's use of the EPRT command ( it
718 also disables the LPRT attempt). By default, those ones will always be
719 attempted before the good old traditional PORT command. */
720 CINIT(FTP_USE_EPRT, LONG, 106),
722 /* Set this to a bitmask value to enable the particular authentications
723 methods you like. Use this in combination with CURLOPT_USERPWD.
724 Note that setting multiple bits may cause extra network round-trips. */
725 CINIT(HTTPAUTH, LONG, 107),
727 /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
728 in second argument. The function must be matching the
729 curl_ssl_ctx_callback proto. */
730 CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
732 /* Set the userdata for the ssl context callback function's third
734 CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
736 /* FTP Option that causes missing dirs to be created on the remote server */
737 CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
739 /* Set this to a bitmask value to enable the particular authentications
740 methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
741 Note that setting multiple bits may cause extra network round-trips. */
742 CINIT(PROXYAUTH, LONG, 111),
744 /* FTP option that changes the timeout, in seconds, associated with
745 getting a response. This is different from transfer timeout time and
746 essentially places a demand on the FTP server to acknowledge commands
747 in a timely manner. */
748 CINIT(FTP_RESPONSE_TIMEOUT, LONG , 112),
750 /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
751 tell libcurl to resolve names to those IP versions only. This only has
752 affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
753 CINIT(IPRESOLVE, LONG, 113),
755 /* Set this option to limit the size of a file that will be downloaded from
756 an HTTP or FTP server.
758 Note there is also _LARGE version which adds large file support for
759 platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
760 CINIT(MAXFILESIZE, LONG, 114),
762 /* See the comment for INFILESIZE above, but in short, specifies
763 * the size of the file being uploaded. -1 means unknown.
765 CINIT(INFILESIZE_LARGE, OFF_T, 115),
767 /* Sets the continuation offset. There is also a LONG version of this;
768 * look above for RESUME_FROM.
770 CINIT(RESUME_FROM_LARGE, OFF_T, 116),
772 /* Sets the maximum size of data that will be downloaded from
773 * an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
775 CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
777 /* Set this option to the file name of your .netrc file you want libcurl
778 to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
779 a poor attempt to find the user's home directory and check for a .netrc
781 CINIT(NETRC_FILE, OBJECTPOINT, 118),
783 /* Enable SSL/TLS for FTP, pick one of:
784 CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise
785 CURLFTPSSL_CONTROL - SSL for the control connection or fail
786 CURLFTPSSL_ALL - SSL for all communication or fail
788 CINIT(FTP_SSL, LONG, 119),
790 /* The _LARGE version of the standard POSTFIELDSIZE option */
791 CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
793 CURLOPT_LASTENTRY /* the last unused */
796 /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
797 name resolves addresses using more than one IP protocol version, this
798 option might be handy to force libcurl to use a specific IP version. */
799 #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
800 versions that your system allows */
801 #define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */
802 #define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */
804 /* three convenient "aliases" that follow the name scheme better */
805 #define CURLOPT_WRITEDATA CURLOPT_FILE
806 #define CURLOPT_READDATA CURLOPT_INFILE
807 #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
809 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
810 the obsolete stuff removed! */
811 #define CURLOPT_HTTPREQUEST 0
812 #define CURLOPT_FTPASCII CURLOPT_TRANSFERTEXT
813 #define CURLOPT_MUTE 0
814 #define CURLOPT_PASSWDFUNCTION 0
815 #define CURLOPT_PASSWDDATA 0
816 #define CURLOPT_CLOSEFUNCTION 0
819 /* This is set if CURL_NO_OLDIES is defined at compile-time */
820 #define curl_formparse "curl_formparse is obsolete"
821 #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
825 /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
827 CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
828 like the library to choose the best possible
830 CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */
831 CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */
833 CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
836 /* These enums are for use with the CURLOPT_NETRC option. */
837 enum CURL_NETRC_OPTION {
838 CURL_NETRC_IGNORED, /* The .netrc will never be read.
839 * This is the default. */
840 CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred
841 * to one in the .netrc. */
842 CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored.
843 * Unless one is set programmatically, the .netrc
844 * will be queried. */
849 CURL_SSLVERSION_DEFAULT,
850 CURL_SSLVERSION_TLSv1,
851 CURL_SSLVERSION_SSLv2,
852 CURL_SSLVERSION_SSLv3,
854 CURL_SSLVERSION_LAST /* never use, keep last */
861 CURL_TIMECOND_IFMODSINCE,
862 CURL_TIMECOND_IFUNMODSINCE,
863 CURL_TIMECOND_LASTMOD,
869 #include <support/SupportDefs.h>
873 /* These functions are in libcurl, they're here for portable reasons and they
874 are used by the 'curl' client. They really should be moved to some kind of
875 "portability library" since it has nothing to do with file transfers and
876 might be usable to other programs...
878 NOTE: they return TRUE if the strings match *case insensitively*.
880 extern int (curl_strequal)(const char *s1, const char *s2);
881 extern int (curl_strnequal)(const char *s1, const char *s2, size_t n);
884 /* DEPRECATED function to build formdata. Stop using this, it will cease
886 int curl_formparse(char *, struct curl_httppost **,
887 struct curl_httppost **_post);
890 /* name is uppercase CURLFORM_<name> */
896 #define CFINIT(name) CURLFORM_ ## name
898 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
899 #define CFINIT(name) CURLFORM_/**/name
903 CFINIT(NOTHING), /********* the first one is unused ************/
909 CFINIT(COPYCONTENTS),
911 CFINIT(CONTENTSLENGTH),
919 CFINIT(BUFFERLENGTH),
922 CFINIT(CONTENTHEADER),
927 CURLFORM_LASTENTRY /* the last unusued */
930 #undef CFINIT /* done */
932 /* structure to be used as parameter for CURLFORM_ARRAY */
934 CURLformoption option;
938 /* use this for multipart formpost building */
939 /* Returns code for curl_formadd()
942 * CURL_FORMADD_OK on success
943 * CURL_FORMADD_MEMORY if the FormInfo allocation fails
944 * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
945 * CURL_FORMADD_NULL if a null pointer was given for a char
946 * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
947 * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
948 * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
949 * CURL_FORMADD_MEMORY if a HttpPost struct cannot be allocated
950 * CURL_FORMADD_MEMORY if some allocation for string copying failed.
951 * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
953 ***************************************************************************/
955 CURL_FORMADD_OK, /* first, no error */
958 CURL_FORMADD_OPTION_TWICE,
960 CURL_FORMADD_UNKNOWN_OPTION,
961 CURL_FORMADD_INCOMPLETE,
962 CURL_FORMADD_ILLEGAL_ARRAY,
964 CURL_FORMADD_LAST /* last */
968 * NAME curl_formadd()
972 * Pretty advanved function for building multi-part formposts. Each invoke
973 * adds one part that together construct a full post. Then use
974 * CURLOPT_HTTPPOST to send it off to libcurl.
976 CURLFORMcode curl_formadd(struct curl_httppost **httppost,
977 struct curl_httppost **last_post,
981 * NAME curl_formfree()
985 * Free a multipart formpost previously built with curl_formadd().
987 void curl_formfree(struct curl_httppost *form);
994 * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
997 char *curl_getenv(const char *variable);
1000 * NAME curl_version()
1004 * Returns a static ascii string of the libcurl version.
1006 char *curl_version(void);
1009 * NAME curl_escape()
1013 * Escapes URL strings (converts all letters consider illegal in URLs to their
1014 * %XX versions). This function returns a new allocated string or NULL if an
1017 char *curl_escape(const char *string, int length);
1020 * NAME curl_unescape()
1024 * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
1025 * versions). This function returns a new allocated string or NULL if an error
1028 char *curl_unescape(const char *string, int length);
1035 * Provided for de-allocation in the same translation unit that did the
1036 * allocation. Added in libcurl 7.10
1038 void curl_free(void *p);
1041 * NAME curl_global_init()
1045 * curl_global_init() should be invoked exactly once for each application that
1048 CURLcode curl_global_init(long flags);
1051 * NAME curl_global_cleanup()
1055 * curl_global_cleanup() should be invoked exactly once for each application
1058 void curl_global_cleanup(void);
1060 /* linked-list structure for the CURLOPT_QUOTE option (and other) */
1063 struct curl_slist *next;
1067 * NAME curl_slist_append()
1071 * Appends a string to a linked list. If no list exists, it will be created
1072 * first. Returns the new list, after appending.
1074 struct curl_slist *curl_slist_append(struct curl_slist *, const char *);
1077 * NAME curl_slist_free_all()
1081 * free a previously built curl_slist.
1083 void curl_slist_free_all(struct curl_slist *);
1086 * NAME curl_getdate()
1090 * Returns the time, in seconds since 1 Jan 1970 of the time string given in
1091 * the first argument. The time argument in the second parameter is for cases
1092 * where the specified time is relative now, like 'two weeks' or 'tomorrow'
1095 time_t curl_getdate(const char *p, const time_t *now);
1098 #define CURLINFO_STRING 0x100000
1099 #define CURLINFO_LONG 0x200000
1100 #define CURLINFO_DOUBLE 0x300000
1101 #define CURLINFO_MASK 0x0fffff
1102 #define CURLINFO_TYPEMASK 0xf00000
1105 CURLINFO_NONE, /* first, never use this */
1106 CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1,
1107 CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2,
1108 CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3,
1109 CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4,
1110 CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5,
1111 CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
1112 CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7,
1113 CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8,
1114 CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9,
1115 CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10,
1116 CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11,
1117 CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12,
1118 CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13,
1119 CURLINFO_FILETIME = CURLINFO_LONG + 14,
1120 CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15,
1121 CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16,
1122 CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
1123 CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18,
1124 CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19,
1125 CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20,
1126 CURLINFO_PRIVATE = CURLINFO_STRING + 21,
1127 CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22,
1128 CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23,
1129 CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24,
1130 /* Fill in new entries below here! */
1132 CURLINFO_LASTONE = 23
1135 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
1136 CURLINFO_HTTP_CODE */
1137 #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
1140 CURLCLOSEPOLICY_NONE, /* first, never use this */
1142 CURLCLOSEPOLICY_OLDEST,
1143 CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
1144 CURLCLOSEPOLICY_LEAST_TRAFFIC,
1145 CURLCLOSEPOLICY_SLOWEST,
1146 CURLCLOSEPOLICY_CALLBACK,
1148 CURLCLOSEPOLICY_LAST /* last, never use this */
1151 #define CURL_GLOBAL_SSL (1<<0)
1152 #define CURL_GLOBAL_WIN32 (1<<1)
1153 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
1154 #define CURL_GLOBAL_NOTHING 0
1155 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
1158 /*****************************************************************************
1159 * Setup defines, protos etc for the sharing stuff.
1162 /* Different data locks for a single share */
1164 CURL_LOCK_DATA_NONE = 0,
1165 /* CURL_LOCK_DATA_SHARE is used internaly to say that
1166 * the locking is just made to change the internal state of the share
1169 CURL_LOCK_DATA_SHARE,
1170 CURL_LOCK_DATA_COOKIE,
1172 CURL_LOCK_DATA_SSL_SESSION,
1173 CURL_LOCK_DATA_CONNECT,
1177 /* Different lock access types */
1179 CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */
1180 CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
1181 CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
1182 CURL_LOCK_ACCESS_LAST /* never use */
1185 typedef void (*curl_lock_function)(CURL *handle,
1186 curl_lock_data data,
1187 curl_lock_access locktype,
1189 typedef void (*curl_unlock_function)(CURL *handle,
1190 curl_lock_data data,
1193 typedef void CURLSH;
1196 CURLSHE_OK, /* all is fine */
1197 CURLSHE_BAD_OPTION, /* 1 */
1198 CURLSHE_IN_USE, /* 2 */
1199 CURLSHE_INVALID, /* 3 */
1200 CURLSHE_LAST /* never use */
1204 CURLSHOPT_NONE, /* don't use */
1205 CURLSHOPT_SHARE, /* specify a data type to share */
1206 CURLSHOPT_UNSHARE, /* specify shich data type to stop sharing */
1207 CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */
1208 CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
1209 CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock
1210 callback functions */
1211 CURLSHOPT_LAST /* never use */
1214 CURLSH *curl_share_init(void);
1215 CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
1216 CURLSHcode curl_share_cleanup(CURLSH *);
1218 /****************************************************************************
1219 * Structures for querying information about the curl library at runtime.
1225 CURLVERSION_LAST /* never actually use this */
1228 /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
1229 basicly all programs ever, that want to get version information. It is
1230 meant to be a built-in version number for what kind of struct the caller
1231 expects. If the struct ever changes, we redfine the NOW to another enum
1233 #define CURLVERSION_NOW CURLVERSION_SECOND
1236 CURLversion age; /* age of the returned struct */
1237 const char *version; /* LIBCURL_VERSION */
1238 unsigned int version_num; /* LIBCURL_VERSION_NUM */
1239 const char *host; /* OS/host/cpu/machine when configured */
1240 int features; /* bitmask, see defines below */
1241 char *ssl_version; /* human readable string */
1242 long ssl_version_num; /* number */
1243 const char *libz_version; /* human readable string */
1244 /* protocols is terminated by an entry with a NULL protoname */
1245 const char **protocols;
1247 /* The fields below this were added in CURLVERSION_SECOND */
1250 } curl_version_info_data;
1252 #define CURL_VERSION_IPV6 (1<<0)
1253 #define CURL_VERSION_KERBEROS4 (1<<1)
1254 #define CURL_VERSION_SSL (1<<2)
1255 #define CURL_VERSION_LIBZ (1<<3)
1256 #define CURL_VERSION_NTLM (1<<4)
1257 #define CURL_VERSION_GSSNEGOTIATE (1<<5)
1258 #define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */
1259 #define CURL_VERSION_ASYNCHDNS (1<<7)
1260 #define CURL_VERSION_SPNEGO (1<<8)
1261 #define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */
1264 * NAME curl_version_info()
1268 * This function returns a pointer to a static copy of the version info
1269 * struct. See above.
1271 curl_version_info_data *curl_version_info(CURLversion);
1277 /* unfortunately, the easy.h and multi.h include files need options and info
1278 stuff before they can be included! */
1279 #include "easy.h" /* nothing in curl is fun without the easy stuff */
1282 #endif /* __CURL_CURL_H */