3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2005, 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.1 2006/07/09 22:41:14 fred_t_hamster Exp $
24 ***************************************************************************/
26 /* If you have problems, all libcurl docs and details are found here:
27 http://curl.haxx.se/libcurl/
30 #include "curlver.h" /* the libcurl version defines */
35 /* The include stuff here below is mainly for time_t! */
40 # include <sys/types.h>
42 #endif /* defined (vms) */
51 * Decorate exportable functions for Win32 DLL linking.
52 * This avoids using a .def file for building libcurl.dll.
54 #if (defined(WIN32) || defined(_WIN32)) && !defined(CURL_STATICLIB)
55 #if defined(BUILDING_LIBCURL)
56 #define CURL_EXTERN __declspec(dllexport)
58 #define CURL_EXTERN __declspec(dllimport)
65 * We want the typedef curl_off_t setup for large file support on all
66 * platforms. We also provide a CURL_FORMAT_OFF_T define to use in *printf
67 * format strings when outputting a variable of type curl_off_t.
70 #if defined(_MSC_VER) || defined(__LCC__)
73 typedef long curl_off_t;
74 #define CURL_FORMAT_OFF_T "%ld"
76 typedef signed __int64 curl_off_t;
77 #define CURL_FORMAT_OFF_T "%I64d"
79 #else /* _MSC_VER || __LCC__ */
80 #if (defined(__GNUC__) && defined(WIN32)) || defined(__WATCOMC__)
81 /* gcc on windows or Watcom */
82 typedef long long curl_off_t;
83 #define CURL_FORMAT_OFF_T "%I64d"
84 #else /* GCC or Watcom on Windows */
86 /* "normal" POSIX approach, do note that this does not necessarily mean that
87 the type is >32 bits, see the SIZEOF_CURL_OFF_T define for that! */
88 typedef off_t curl_off_t;
90 /* Check a range of defines to detect large file support. On Linux it seems
91 none of these are set by default, so if you don't explicitly switches on
92 large file support, this define will be made for "small file" support. */
93 #ifndef _FILE_OFFSET_BITS
94 #define _FILE_OFFSET_BITS 0 /* to prevent warnings in the check below */
95 #define UNDEF_FILE_OFFSET_BITS
98 #define FILESIZEBITS 0 /* to prevent warnings in the check below */
99 #define UNDEF_FILESIZEBITS
102 #if defined(_LARGE_FILES) || (_FILE_OFFSET_BITS > 32) || (FILESIZEBITS > 32) \
103 || defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)
104 /* For now, we assume at least one of these to be set for large files to
106 #define CURL_FORMAT_OFF_T "%lld"
107 #else /* LARGE_FILE support */
108 #define CURL_FORMAT_OFF_T "%ld"
110 #endif /* GCC or Watcom on Windows */
111 #endif /* _MSC_VER || __LCC__ */
113 #ifdef UNDEF_FILE_OFFSET_BITS
114 /* this was defined above for our checks, undefine it again */
115 #undef _FILE_OFFSET_BITS
118 #ifdef UNDEF_FILESIZEBITS
119 /* this was defined above for our checks, undefine it again */
123 struct curl_httppost {
124 struct curl_httppost *next; /* next entry in the list */
125 char *name; /* pointer to allocated name */
126 long namelength; /* length of name length */
127 char *contents; /* pointer to allocated data contents */
128 long contentslength; /* length of contents field */
129 char *buffer; /* pointer to allocated buffer contents */
130 long bufferlength; /* length of buffer field */
131 char *contenttype; /* Content-Type */
132 struct curl_slist* contentheader; /* list of extra headers for this form */
133 struct curl_httppost *more; /* if one field name has more than one
134 file, this link should link to following
136 long flags; /* as defined below */
137 #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */
138 #define HTTPPOST_READFILE (1<<1) /* specified content is a file name */
139 #define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer
140 do not free in formfree */
141 #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
142 do not free in formfree */
143 #define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */
144 #define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */
146 char *showfilename; /* The file name to show. If not set, the
147 actual file name will be used (if this
151 typedef int (*curl_progress_callback)(void *clientp,
157 /* Tests have proven that 20K is a very bad buffer size for uploads on
158 Windows, while 16K for some odd reason performed a lot better. */
159 #define CURL_MAX_WRITE_SIZE 16384
161 typedef size_t (*curl_write_callback)(char *buffer,
166 /* This is a return code for the read callback that, when returned, will
167 signal libcurl to immediately abort the current transfer. */
168 #define CURL_READFUNC_ABORT 0x10000000
169 typedef size_t (*curl_read_callback)(char *buffer,
175 #ifndef CURL_NO_OLDIES
176 /* not used since 7.10.8, will be removed in a future release */
177 typedef int (*curl_passwd_callback)(void *clientp,
184 CURLIOE_OK, /* I/O operation successful */
185 CURLIOE_UNKNOWNCMD, /* command was unknown to callback */
186 CURLIOE_FAILRESTART, /* failed to restart the read */
187 CURLIOE_LAST /* never use */
191 CURLIOCMD_NOP, /* no operation */
192 CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
193 CURLIOCMD_LAST /* never use */
196 typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
201 * The following typedef's are signatures of malloc, free, realloc, strdup and
202 * calloc respectively. Function pointers of these types can be passed to the
203 * curl_global_init_mem() function to set user defined memory management
206 typedef void *(*curl_malloc_callback)(size_t size);
207 typedef void (*curl_free_callback)(void *ptr);
208 typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
209 typedef char *(*curl_strdup_callback)(const char *str);
210 typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
212 /* the kind of data that is passed to information_callback*/
215 CURLINFO_HEADER_IN, /* 1 */
216 CURLINFO_HEADER_OUT, /* 2 */
217 CURLINFO_DATA_IN, /* 3 */
218 CURLINFO_DATA_OUT, /* 4 */
219 CURLINFO_SSL_DATA_IN, /* 5 */
220 CURLINFO_SSL_DATA_OUT, /* 6 */
224 typedef int (*curl_debug_callback)
225 (CURL *handle, /* the handle/transfer this concerns */
226 curl_infotype type, /* what kind of data */
227 char *data, /* points to the data */
228 size_t size, /* size of the data pointed to */
229 void *userptr); /* whatever the user please */
231 /* All possible error codes from all sorts of curl functions. Future versions
232 may return other values, stay prepared.
234 Always add new return codes last. Never *EVER* remove any. The return
235 codes must remain the same!
240 CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
241 CURLE_FAILED_INIT, /* 2 */
242 CURLE_URL_MALFORMAT, /* 3 */
243 CURLE_URL_MALFORMAT_USER, /* 4 (NOT USED) */
244 CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
245 CURLE_COULDNT_RESOLVE_HOST, /* 6 */
246 CURLE_COULDNT_CONNECT, /* 7 */
247 CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
248 CURLE_FTP_ACCESS_DENIED, /* 9 a service was denied by the FTP server
249 due to lack of access - when login fails
250 this is not returned. */
251 CURLE_FTP_USER_PASSWORD_INCORRECT, /* 10 */
252 CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
253 CURLE_FTP_WEIRD_USER_REPLY, /* 12 */
254 CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
255 CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
256 CURLE_FTP_CANT_GET_HOST, /* 15 */
257 CURLE_FTP_CANT_RECONNECT, /* 16 */
258 CURLE_FTP_COULDNT_SET_BINARY, /* 17 */
259 CURLE_PARTIAL_FILE, /* 18 */
260 CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
261 CURLE_FTP_WRITE_ERROR, /* 20 */
262 CURLE_FTP_QUOTE_ERROR, /* 21 */
263 CURLE_HTTP_RETURNED_ERROR, /* 22 */
264 CURLE_WRITE_ERROR, /* 23 */
265 CURLE_MALFORMAT_USER, /* 24 - NOT USED */
266 CURLE_FTP_COULDNT_STOR_FILE, /* 25 - failed FTP upload */
267 CURLE_READ_ERROR, /* 26 - could open/read from file */
268 CURLE_OUT_OF_MEMORY, /* 27 */
269 CURLE_OPERATION_TIMEOUTED, /* 28 - the timeout time was reached */
270 CURLE_FTP_COULDNT_SET_ASCII, /* 29 - TYPE A failed */
271 CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
272 CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
273 CURLE_FTP_COULDNT_GET_SIZE, /* 32 - the SIZE command failed */
274 CURLE_HTTP_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
275 CURLE_HTTP_POST_ERROR, /* 34 */
276 CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
277 CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
278 CURLE_FILE_COULDNT_READ_FILE, /* 37 */
279 CURLE_LDAP_CANNOT_BIND, /* 38 */
280 CURLE_LDAP_SEARCH_FAILED, /* 39 */
281 CURLE_LIBRARY_NOT_FOUND, /* 40 */
282 CURLE_FUNCTION_NOT_FOUND, /* 41 */
283 CURLE_ABORTED_BY_CALLBACK, /* 42 */
284 CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
285 CURLE_BAD_CALLING_ORDER, /* 44 - NOT USED */
286 CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
287 CURLE_BAD_PASSWORD_ENTERED, /* 46 - NOT USED */
288 CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
289 CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */
290 CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
291 CURLE_OBSOLETE, /* 50 - NOT USED */
292 CURLE_SSL_PEER_CERTIFICATE, /* 51 - peer's certificate wasn't ok */
293 CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
294 CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
295 CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
297 CURLE_SEND_ERROR, /* 55 - failed sending network data */
298 CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
299 CURLE_SHARE_IN_USE, /* 57 - share is in use */
300 CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
301 CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
302 CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
303 CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */
304 CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
305 CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
306 CURLE_FTP_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
307 CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
309 CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
310 CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
311 accepted and we failed to login */
312 CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */
313 CURLE_TFTP_PERM, /* 69 - permission problem on server */
314 CURLE_TFTP_DISKFULL, /* 70 - out of disk space on server */
315 CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */
316 CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */
317 CURLE_TFTP_EXISTS, /* 73 - File already exists */
318 CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */
319 CURL_LAST /* never use! */
322 typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
323 void *ssl_ctx, /* actually an
327 /* Make a spelling correction for the operation timed-out define */
328 #define CURLE_OPERATION_TIMEDOUT CURLE_OPERATION_TIMEOUTED
330 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
331 the obsolete stuff removed! */
332 /* backwards compatibility with older names */
333 #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
334 #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
339 CURLPROXY_SOCKS4 = 4,
343 #define CURLAUTH_NONE 0 /* nothing */
344 #define CURLAUTH_BASIC (1<<0) /* Basic (default) */
345 #define CURLAUTH_DIGEST (1<<1) /* Digest */
346 #define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */
347 #define CURLAUTH_NTLM (1<<3) /* NTLM */
348 #define CURLAUTH_ANY ~0 /* all types set */
349 #define CURLAUTH_ANYSAFE (~CURLAUTH_BASIC)
351 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
352 the obsolete stuff removed! */
353 /* this was the error code 50 in 7.7.3 and a few earlier versions, this
354 is no longer used by libcurl but is instead #defined here only to not
355 make programs break */
356 #define CURLE_ALREADY_COMPLETE 99999
358 /* These are just to make older programs not break: */
359 #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
360 #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
363 #define CURL_ERROR_SIZE 256
365 /* parameter for the CURLOPT_FTP_SSL option */
367 CURLFTPSSL_NONE, /* do not attempt to use SSL */
368 CURLFTPSSL_TRY, /* try using SSL, proceed anyway otherwise */
369 CURLFTPSSL_CONTROL, /* SSL for the control connection or fail */
370 CURLFTPSSL_ALL, /* SSL for all communication or fail */
371 CURLFTPSSL_LAST /* not an option, never use */
374 /* parameter for the CURLOPT_FTPSSLAUTH option */
376 CURLFTPAUTH_DEFAULT, /* let libcurl decide */
377 CURLFTPAUTH_SSL, /* use "AUTH SSL" */
378 CURLFTPAUTH_TLS, /* use "AUTH TLS" */
379 CURLFTPAUTH_LAST /* not an option, never use */
382 /* long may be 32 or 64 bits, but we should never depend on anything else
384 #define CURLOPTTYPE_LONG 0
385 #define CURLOPTTYPE_OBJECTPOINT 10000
386 #define CURLOPTTYPE_FUNCTIONPOINT 20000
387 #define CURLOPTTYPE_OFF_T 30000
389 /* name is uppercase CURLOPT_<name>,
390 type is one of the defined CURLOPTTYPE_<type>
391 number is unique identifier */
396 * Figure out if we can use the ## operator, which is supported by ISO/ANSI C
397 * and C++. Some compilers support it without setting __STDC__ or __cplusplus
398 * so we need to carefully check for them too. We don't use configure-checks
399 * for these since we want these headers to remain generic and working for all
402 #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
403 defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__)
404 /* This compiler is believed to have an ISO compatible preprocessor */
407 /* This compiler is believed NOT to have an ISO compatible preprocessor */
412 #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
414 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
415 #define LONG CURLOPTTYPE_LONG
416 #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
417 #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
418 #define OFF_T CURLOPTTYPE_OFF_T
419 #define CINIT(name,type,number) CURLOPT_/**/name = type + number
423 * This macro-mania below setups the CURLOPT_[what] enum, to be used with
424 * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
429 /* This is the FILE * or void * the regular output should be written to. */
430 CINIT(FILE, OBJECTPOINT, 1),
432 /* The full URL to get/put */
433 CINIT(URL, OBJECTPOINT, 2),
435 /* Port number to connect to, if other than default. */
436 CINIT(PORT, LONG, 3),
438 /* Name of proxy to use. */
439 CINIT(PROXY, OBJECTPOINT, 4),
441 /* "name:password" to use when fetching. */
442 CINIT(USERPWD, OBJECTPOINT, 5),
444 /* "name:password" to use with proxy. */
445 CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
447 /* Range to get, specified as an ASCII string. */
448 CINIT(RANGE, OBJECTPOINT, 7),
452 /* Specified file stream to upload from (use as input): */
453 CINIT(INFILE, OBJECTPOINT, 9),
455 /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
456 * bytes big. If this is not used, error messages go to stderr instead: */
457 CINIT(ERRORBUFFER, OBJECTPOINT, 10),
459 /* Function that will be called to store the output (instead of fwrite). The
460 * parameters will use fwrite() syntax, make sure to follow them. */
461 CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
463 /* Function that will be called to read the input (instead of fread). The
464 * parameters will use fread() syntax, make sure to follow them. */
465 CINIT(READFUNCTION, FUNCTIONPOINT, 12),
467 /* Time-out the read operation after this amount of seconds */
468 CINIT(TIMEOUT, LONG, 13),
470 /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
471 * how large the file being sent really is. That allows better error
472 * checking and better verifies that the upload was succcessful. -1 means
475 * For large file support, there is also a _LARGE version of the key
476 * which takes an off_t type, allowing platforms with larger off_t
477 * sizes to handle larger files. See below for INFILESIZE_LARGE.
479 CINIT(INFILESIZE, LONG, 14),
481 /* POST input fields. */
482 CINIT(POSTFIELDS, OBJECTPOINT, 15),
484 /* Set the referer page (needed by some CGIs) */
485 CINIT(REFERER, OBJECTPOINT, 16),
487 /* Set the FTP PORT string (interface name, named or numerical IP address)
488 Use i.e '-' to use default address. */
489 CINIT(FTPPORT, OBJECTPOINT, 17),
491 /* Set the User-Agent string (examined by some CGIs) */
492 CINIT(USERAGENT, OBJECTPOINT, 18),
494 /* If the download receives less than "low speed limit" bytes/second
495 * during "low speed time" seconds, the operations is aborted.
496 * You could i.e if you have a pretty high speed connection, abort if
497 * it is less than 2000 bytes/sec during 20 seconds.
500 /* Set the "low speed limit" */
501 CINIT(LOW_SPEED_LIMIT, LONG , 19),
503 /* Set the "low speed time" */
504 CINIT(LOW_SPEED_TIME, LONG, 20),
506 /* Set the continuation offset.
508 * Note there is also a _LARGE version of this key which uses
509 * off_t types, allowing for large file offsets on platforms which
510 * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
512 CINIT(RESUME_FROM, LONG, 21),
514 /* Set cookie in request: */
515 CINIT(COOKIE, OBJECTPOINT, 22),
517 /* This points to a linked list of headers, struct curl_slist kind */
518 CINIT(HTTPHEADER, OBJECTPOINT, 23),
520 /* This points to a linked list of post entries, struct HttpPost */
521 CINIT(HTTPPOST, OBJECTPOINT, 24),
523 /* name of the file keeping your private SSL-certificate */
524 CINIT(SSLCERT, OBJECTPOINT, 25),
526 /* password for the SSL-private key, keep this for compatibility */
527 CINIT(SSLCERTPASSWD, OBJECTPOINT, 26),
528 /* password for the SSL private key */
529 CINIT(SSLKEYPASSWD, OBJECTPOINT, 26),
531 /* send TYPE parameter? */
532 CINIT(CRLF, LONG, 27),
534 /* send linked-list of QUOTE commands */
535 CINIT(QUOTE, OBJECTPOINT, 28),
537 /* send FILE * or void * to store headers to, if you use a callback it
538 is simply passed to the callback unmodified */
539 CINIT(WRITEHEADER, OBJECTPOINT, 29),
541 /* point to a file to read the initial cookies from, also enables
542 "cookie awareness" */
543 CINIT(COOKIEFILE, OBJECTPOINT, 31),
545 /* What version to specifly try to use.
546 See CURL_SSLVERSION defines below. */
547 CINIT(SSLVERSION, LONG, 32),
549 /* What kind of HTTP time condition to use, see defines */
550 CINIT(TIMECONDITION, LONG, 33),
552 /* Time to use with the above condition. Specified in number of seconds
554 CINIT(TIMEVALUE, LONG, 34),
558 /* Custom request, for customizing the get command like
559 HTTP: DELETE, TRACE and others
560 FTP: to use a different list command
562 CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
564 /* HTTP request, for odd commands like DELETE, TRACE and others */
565 CINIT(STDERR, OBJECTPOINT, 37),
569 /* send linked-list of post-transfer QUOTE commands */
570 CINIT(POSTQUOTE, OBJECTPOINT, 39),
572 /* Pass a pointer to string of the output using full variable-replacement
573 as described elsewhere. */
574 CINIT(WRITEINFO, OBJECTPOINT, 40),
576 CINIT(VERBOSE, LONG, 41), /* talk a lot */
577 CINIT(HEADER, LONG, 42), /* throw the header out too */
578 CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */
579 CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */
580 CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */
581 CINIT(UPLOAD, LONG, 46), /* this is an upload */
582 CINIT(POST, LONG, 47), /* HTTP POST method */
583 CINIT(FTPLISTONLY, LONG, 48), /* Use NLST when listing ftp dir */
585 CINIT(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
587 /* Specify whether to read the user+password from the .netrc or the URL.
588 * This must be one of the CURL_NETRC_* enums below. */
589 CINIT(NETRC, LONG, 51),
591 CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
593 CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
594 CINIT(PUT, LONG, 54), /* HTTP PUT */
598 /* Function that will be called instead of the internal progress display
599 * function. This function should be defined as the curl_progress_callback
600 * prototype defines. */
601 CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
603 /* Data passed to the progress callback */
604 CINIT(PROGRESSDATA, OBJECTPOINT, 57),
606 /* We want the referer field set automatically when following locations */
607 CINIT(AUTOREFERER, LONG, 58),
609 /* Port of the proxy, can be set in the proxy string as well with:
611 CINIT(PROXYPORT, LONG, 59),
613 /* size of the POST input data, if strlen() is not good to use */
614 CINIT(POSTFIELDSIZE, LONG, 60),
616 /* tunnel non-http operations through a HTTP proxy */
617 CINIT(HTTPPROXYTUNNEL, LONG, 61),
619 /* Set the interface string to use as outgoing network interface */
620 CINIT(INTERFACE, OBJECTPOINT, 62),
622 /* Set the krb4 security level, this also enables krb4 awareness. This is a
623 * string, 'clear', 'safe', 'confidential' or 'private'. If the string is
624 * set but doesn't match one of these, 'private' will be used. */
625 CINIT(KRB4LEVEL, OBJECTPOINT, 63),
627 /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
628 CINIT(SSL_VERIFYPEER, LONG, 64),
630 /* The CApath or CAfile used to validate the peer certificate
631 this option is used only if SSL_VERIFYPEER is true */
632 CINIT(CAINFO, OBJECTPOINT, 65),
637 /* Maximum number of http redirects to follow */
638 CINIT(MAXREDIRS, LONG, 68),
640 /* Pass a long set to 1 to get the date of the requested document (if
641 possible)! Pass a zero to shut it off. */
642 CINIT(FILETIME, LONG, 69),
644 /* This points to a linked list of telnet options */
645 CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
647 /* Max amount of cached alive connections */
648 CINIT(MAXCONNECTS, LONG, 71),
650 /* What policy to use when closing connections when the cache is filled
652 CINIT(CLOSEPOLICY, LONG, 72),
656 /* Set to explicitly use a new connection for the upcoming transfer.
657 Do not use this unless you're absolutely sure of this, as it makes the
658 operation slower and is less friendly for the network. */
659 CINIT(FRESH_CONNECT, LONG, 74),
661 /* Set to explicitly forbid the upcoming transfer's connection to be re-used
662 when done. Do not use this unless you're absolutely sure of this, as it
663 makes the operation slower and is less friendly for the network. */
664 CINIT(FORBID_REUSE, LONG, 75),
666 /* Set to a file name that contains random data for libcurl to use to
667 seed the random engine when doing SSL connects. */
668 CINIT(RANDOM_FILE, OBJECTPOINT, 76),
670 /* Set to the Entropy Gathering Daemon socket pathname */
671 CINIT(EGDSOCKET, OBJECTPOINT, 77),
673 /* Time-out connect operations after this amount of seconds, if connects
674 are OK within this time, then fine... This only aborts the connect
675 phase. [Only works on unix-style/SIGALRM operating systems] */
676 CINIT(CONNECTTIMEOUT, LONG, 78),
678 /* Function that will be called to store headers (instead of fwrite). The
679 * parameters will use fwrite() syntax, make sure to follow them. */
680 CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
682 /* Set this to force the HTTP request to get back to GET. Only really usable
683 if POST, PUT or a custom request have been used first.
685 CINIT(HTTPGET, LONG, 80),
687 /* Set if we should verify the Common name from the peer certificate in ssl
688 * handshake, set 1 to check existence, 2 to ensure that it matches the
689 * provided hostname. */
690 CINIT(SSL_VERIFYHOST, LONG, 81),
692 /* Specify which file name to write all known cookies in after completed
693 operation. Set file name to "-" (dash) to make it go to stdout. */
694 CINIT(COOKIEJAR, OBJECTPOINT, 82),
696 /* Specify which SSL ciphers to use */
697 CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),
699 /* Specify which HTTP version to use! This must be set to one of the
700 CURL_HTTP_VERSION* enums set below. */
701 CINIT(HTTP_VERSION, LONG, 84),
703 /* Specificly switch on or off the FTP engine's use of the EPSV command. By
704 default, that one will always be attempted before the more traditional
706 CINIT(FTP_USE_EPSV, LONG, 85),
708 /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
709 CINIT(SSLCERTTYPE, OBJECTPOINT, 86),
711 /* name of the file keeping your private SSL-key */
712 CINIT(SSLKEY, OBJECTPOINT, 87),
714 /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
715 CINIT(SSLKEYTYPE, OBJECTPOINT, 88),
717 /* crypto engine for the SSL-sub system */
718 CINIT(SSLENGINE, OBJECTPOINT, 89),
720 /* set the crypto engine for the SSL-sub system as default
721 the param has no meaning...
723 CINIT(SSLENGINE_DEFAULT, LONG, 90),
725 /* Non-zero value means to use the global dns cache */
726 CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To becomeO BSOLETE soon */
728 /* DNS cache timeout */
729 CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
731 /* send linked-list of pre-transfer QUOTE commands (Wesley Laxton)*/
732 CINIT(PREQUOTE, OBJECTPOINT, 93),
734 /* set the debug function */
735 CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
737 /* set the data for the debug function */
738 CINIT(DEBUGDATA, OBJECTPOINT, 95),
740 /* mark this as start of a cookie session */
741 CINIT(COOKIESESSION, LONG, 96),
743 /* The CApath directory used to validate the peer certificate
744 this option is used only if SSL_VERIFYPEER is true */
745 CINIT(CAPATH, OBJECTPOINT, 97),
747 /* Instruct libcurl to use a smaller receive buffer */
748 CINIT(BUFFERSIZE, LONG, 98),
750 /* Instruct libcurl to not use any signal/alarm handlers, even when using
751 timeouts. This option is useful for multi-threaded applications.
752 See libcurl-the-guide for more background information. */
753 CINIT(NOSIGNAL, LONG, 99),
755 /* Provide a CURLShare for mutexing non-ts data */
756 CINIT(SHARE, OBJECTPOINT, 100),
758 /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
759 CURLPROXY_SOCKS4 and CURLPROXY_SOCKS5. */
760 CINIT(PROXYTYPE, LONG, 101),
762 /* Set the Accept-Encoding string. Use this to tell a server you would like
763 the response to be compressed. */
764 CINIT(ENCODING, OBJECTPOINT, 102),
766 /* Set pointer to private data */
767 CINIT(PRIVATE, OBJECTPOINT, 103),
769 /* Set aliases for HTTP 200 in the HTTP Response header */
770 CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
772 /* Continue to send authentication (user+password) when following locations,
773 even when hostname changed. This can potentionally send off the name
774 and password to whatever host the server decides. */
775 CINIT(UNRESTRICTED_AUTH, LONG, 105),
777 /* Specificly switch on or off the FTP engine's use of the EPRT command ( it
778 also disables the LPRT attempt). By default, those ones will always be
779 attempted before the good old traditional PORT command. */
780 CINIT(FTP_USE_EPRT, LONG, 106),
782 /* Set this to a bitmask value to enable the particular authentications
783 methods you like. Use this in combination with CURLOPT_USERPWD.
784 Note that setting multiple bits may cause extra network round-trips. */
785 CINIT(HTTPAUTH, LONG, 107),
787 /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
788 in second argument. The function must be matching the
789 curl_ssl_ctx_callback proto. */
790 CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
792 /* Set the userdata for the ssl context callback function's third
794 CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
796 /* FTP Option that causes missing dirs to be created on the remote server */
797 CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
799 /* Set this to a bitmask value to enable the particular authentications
800 methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
801 Note that setting multiple bits may cause extra network round-trips. */
802 CINIT(PROXYAUTH, LONG, 111),
804 /* FTP option that changes the timeout, in seconds, associated with
805 getting a response. This is different from transfer timeout time and
806 essentially places a demand on the FTP server to acknowledge commands
807 in a timely manner. */
808 CINIT(FTP_RESPONSE_TIMEOUT, LONG , 112),
810 /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
811 tell libcurl to resolve names to those IP versions only. This only has
812 affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
813 CINIT(IPRESOLVE, LONG, 113),
815 /* Set this option to limit the size of a file that will be downloaded from
816 an HTTP or FTP server.
818 Note there is also _LARGE version which adds large file support for
819 platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
820 CINIT(MAXFILESIZE, LONG, 114),
822 /* See the comment for INFILESIZE above, but in short, specifies
823 * the size of the file being uploaded. -1 means unknown.
825 CINIT(INFILESIZE_LARGE, OFF_T, 115),
827 /* Sets the continuation offset. There is also a LONG version of this;
828 * look above for RESUME_FROM.
830 CINIT(RESUME_FROM_LARGE, OFF_T, 116),
832 /* Sets the maximum size of data that will be downloaded from
833 * an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
835 CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
837 /* Set this option to the file name of your .netrc file you want libcurl
838 to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
839 a poor attempt to find the user's home directory and check for a .netrc
841 CINIT(NETRC_FILE, OBJECTPOINT, 118),
843 /* Enable SSL/TLS for FTP, pick one of:
844 CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise
845 CURLFTPSSL_CONTROL - SSL for the control connection or fail
846 CURLFTPSSL_ALL - SSL for all communication or fail
848 CINIT(FTP_SSL, LONG, 119),
850 /* The _LARGE version of the standard POSTFIELDSIZE option */
851 CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
853 /* Enable/disable the TCP Nagle algorithm */
854 CINIT(TCP_NODELAY, LONG, 121),
856 /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
858 /* When doing 3rd party transfer, set the source user and password with
860 CINIT(SOURCE_USERPWD, OBJECTPOINT, 123),
862 /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
863 /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
864 /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
866 /* When doing 3rd party transfer, set the source pre-quote linked list
867 of commands with this */
868 CINIT(SOURCE_PREQUOTE, OBJECTPOINT, 127),
870 /* When doing 3rd party transfer, set the source post-quote linked list
871 of commands with this */
872 CINIT(SOURCE_POSTQUOTE, OBJECTPOINT, 128),
874 /* When FTP over SSL/TLS is selected (with CURLOPT_FTP_SSL), this option
875 can be used to change libcurl's default action which is to first try
876 "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
877 response has been received.
879 Available parameters are:
880 CURLFTPAUTH_DEFAULT - let libcurl decide
881 CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
882 CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
884 CINIT(FTPSSLAUTH, LONG, 129),
886 CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
887 CINIT(IOCTLDATA, OBJECTPOINT, 131),
889 /* To make a 3rd party transfer, set the source URL with this */
890 CINIT(SOURCE_URL, OBJECTPOINT, 132),
892 /* When doing 3rd party transfer, set the source quote linked list of
893 commands with this */
894 CINIT(SOURCE_QUOTE, OBJECTPOINT, 133),
896 /* zero terminated string for pass on to the FTP server when asked for
898 CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
900 /* feed cookies into cookie engine */
901 CINIT(COOKIELIST, OBJECTPOINT, 135),
903 /* ignore Content-Length */
904 CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
906 /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
907 response. Typically used for FTP-SSL purposes but is not restricted to
908 that. libcurl will then instead use the same IP address it used for the
909 control connection. */
910 CINIT(FTP_SKIP_PASV_IP, LONG, 137),
912 /* Select "file method" to use when doing FTP */
913 CINIT(FTP_FILEMETHOD, LONG, 138),
915 CURLOPT_LASTENTRY /* the last unused */
918 /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
919 name resolves addresses using more than one IP protocol version, this
920 option might be handy to force libcurl to use a specific IP version. */
921 #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
922 versions that your system allows */
923 #define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */
924 #define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */
926 /* three convenient "aliases" that follow the name scheme better */
927 #define CURLOPT_WRITEDATA CURLOPT_FILE
928 #define CURLOPT_READDATA CURLOPT_INFILE
929 #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
931 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
932 the obsolete stuff removed! */
933 #define CURLOPT_HTTPREQUEST -1
934 #define CURLOPT_FTPASCII CURLOPT_TRANSFERTEXT
935 #define CURLOPT_MUTE -2
936 #define CURLOPT_PASSWDFUNCTION -3
937 #define CURLOPT_PASSWDDATA -4
938 #define CURLOPT_CLOSEFUNCTION -5
940 #define CURLOPT_SOURCE_HOST -6
941 #define CURLOPT_SOURCE_PATH -7
942 #define CURLOPT_SOURCE_PORT -8
943 #define CURLOPT_PASV_HOST -9
946 /* This is set if CURL_NO_OLDIES is defined at compile-time */
947 #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
951 /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
953 CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
954 like the library to choose the best possible
956 CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */
957 CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */
959 CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
962 /* These enums are for use with the CURLOPT_NETRC option. */
963 enum CURL_NETRC_OPTION {
964 CURL_NETRC_IGNORED, /* The .netrc will never be read.
965 * This is the default. */
966 CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred
967 * to one in the .netrc. */
968 CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored.
969 * Unless one is set programmatically, the .netrc
970 * will be queried. */
975 CURL_SSLVERSION_DEFAULT,
976 CURL_SSLVERSION_TLSv1,
977 CURL_SSLVERSION_SSLv2,
978 CURL_SSLVERSION_SSLv3,
980 CURL_SSLVERSION_LAST /* never use, keep last */
987 CURL_TIMECOND_IFMODSINCE,
988 CURL_TIMECOND_IFUNMODSINCE,
989 CURL_TIMECOND_LASTMOD,
995 #include <support/SupportDefs.h>
999 /* curl_strequal() and curl_strnequal() are subject for removal in a future
1000 libcurl, see lib/README.curlx for details */
1001 CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
1002 CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
1004 /* name is uppercase CURLFORM_<name> */
1010 #define CFINIT(name) CURLFORM_ ## name
1012 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
1013 #define CFINIT(name) CURLFORM_/**/name
1017 CFINIT(NOTHING), /********* the first one is unused ************/
1023 CFINIT(COPYCONTENTS),
1024 CFINIT(PTRCONTENTS),
1025 CFINIT(CONTENTSLENGTH),
1026 CFINIT(FILECONTENT),
1033 CFINIT(BUFFERLENGTH),
1035 CFINIT(CONTENTTYPE),
1036 CFINIT(CONTENTHEADER),
1041 CURLFORM_LASTENTRY /* the last unusued */
1044 #undef CFINIT /* done */
1046 /* structure to be used as parameter for CURLFORM_ARRAY */
1048 CURLformoption option;
1052 /* use this for multipart formpost building */
1053 /* Returns code for curl_formadd()
1056 * CURL_FORMADD_OK on success
1057 * CURL_FORMADD_MEMORY if the FormInfo allocation fails
1058 * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
1059 * CURL_FORMADD_NULL if a null pointer was given for a char
1060 * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
1061 * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
1062 * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
1063 * CURL_FORMADD_MEMORY if a HttpPost struct cannot be allocated
1064 * CURL_FORMADD_MEMORY if some allocation for string copying failed.
1065 * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
1067 ***************************************************************************/
1069 CURL_FORMADD_OK, /* first, no error */
1071 CURL_FORMADD_MEMORY,
1072 CURL_FORMADD_OPTION_TWICE,
1074 CURL_FORMADD_UNKNOWN_OPTION,
1075 CURL_FORMADD_INCOMPLETE,
1076 CURL_FORMADD_ILLEGAL_ARRAY,
1077 CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
1079 CURL_FORMADD_LAST /* last */
1083 * NAME curl_formadd()
1087 * Pretty advanved function for building multi-part formposts. Each invoke
1088 * adds one part that together construct a full post. Then use
1089 * CURLOPT_HTTPPOST to send it off to libcurl.
1091 CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
1092 struct curl_httppost **last_post,
1096 * NAME curl_formfree()
1100 * Free a multipart formpost previously built with curl_formadd().
1102 CURL_EXTERN void curl_formfree(struct curl_httppost *form);
1105 * NAME curl_getenv()
1109 * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
1110 * complete. DEPRECATED - see lib/README.curlx
1112 CURL_EXTERN char *curl_getenv(const char *variable);
1115 * NAME curl_version()
1119 * Returns a static ascii string of the libcurl version.
1121 CURL_EXTERN char *curl_version(void);
1124 * NAME curl_escape()
1128 * Escapes URL strings (converts all letters consider illegal in URLs to their
1129 * %XX versions). This function returns a new allocated string or NULL if an
1132 CURL_EXTERN char *curl_escape(const char *string, int length);
1135 * NAME curl_unescape()
1139 * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
1140 * versions). This function returns a new allocated string or NULL if an error
1143 CURL_EXTERN char *curl_unescape(const char *string, int length);
1150 * Provided for de-allocation in the same translation unit that did the
1151 * allocation. Added in libcurl 7.10
1153 CURL_EXTERN void curl_free(void *p);
1156 * NAME curl_global_init()
1160 * curl_global_init() should be invoked exactly once for each application that
1163 CURL_EXTERN CURLcode curl_global_init(long flags);
1166 * NAME curl_global_init_mem()
1170 * curl_global_init() or curl_global_init_mem() should be invoked exactly once
1171 * for each application that uses libcurl. This function can be used to
1172 * initialize libcurl and set user defined memory management callback
1173 * functions. Users can implement memory management routines to check for
1174 * memory leaks, check for mis-use of the curl library etc. User registered
1175 * callback routines with be invoked by this library instead of the system
1176 * memory management routines like malloc, free etc.
1178 CURL_EXTERN CURLcode curl_global_init_mem(long flags,
1179 curl_malloc_callback m,
1180 curl_free_callback f,
1181 curl_realloc_callback r,
1182 curl_strdup_callback s,
1183 curl_calloc_callback c);
1186 * NAME curl_global_cleanup()
1190 * curl_global_cleanup() should be invoked exactly once for each application
1193 CURL_EXTERN void curl_global_cleanup(void);
1195 /* linked-list structure for the CURLOPT_QUOTE option (and other) */
1198 struct curl_slist *next;
1202 * NAME curl_slist_append()
1206 * Appends a string to a linked list. If no list exists, it will be created
1207 * first. Returns the new list, after appending.
1209 CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
1213 * NAME curl_slist_free_all()
1217 * free a previously built curl_slist.
1219 CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
1222 * NAME curl_getdate()
1226 * Returns the time, in seconds since 1 Jan 1970 of the time string given in
1227 * the first argument. The time argument in the second parameter is unused
1228 * and should be set to NULL.
1230 CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
1232 #define CURLINFO_STRING 0x100000
1233 #define CURLINFO_LONG 0x200000
1234 #define CURLINFO_DOUBLE 0x300000
1235 #define CURLINFO_SLIST 0x400000
1236 #define CURLINFO_MASK 0x0fffff
1237 #define CURLINFO_TYPEMASK 0xf00000
1240 CURLINFO_NONE, /* first, never use this */
1241 CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1,
1242 CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2,
1243 CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3,
1244 CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4,
1245 CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5,
1246 CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
1247 CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7,
1248 CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8,
1249 CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9,
1250 CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10,
1251 CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11,
1252 CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12,
1253 CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13,
1254 CURLINFO_FILETIME = CURLINFO_LONG + 14,
1255 CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15,
1256 CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16,
1257 CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
1258 CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18,
1259 CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19,
1260 CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20,
1261 CURLINFO_PRIVATE = CURLINFO_STRING + 21,
1262 CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22,
1263 CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23,
1264 CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24,
1265 CURLINFO_OS_ERRNO = CURLINFO_LONG + 25,
1266 CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26,
1267 CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27,
1268 CURLINFO_COOKIELIST = CURLINFO_SLIST + 28,
1269 /* Fill in new entries below here! */
1271 CURLINFO_LASTONE = 28
1274 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
1275 CURLINFO_HTTP_CODE */
1276 #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
1279 CURLCLOSEPOLICY_NONE, /* first, never use this */
1281 CURLCLOSEPOLICY_OLDEST,
1282 CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
1283 CURLCLOSEPOLICY_LEAST_TRAFFIC,
1284 CURLCLOSEPOLICY_SLOWEST,
1285 CURLCLOSEPOLICY_CALLBACK,
1287 CURLCLOSEPOLICY_LAST /* last, never use this */
1290 #define CURL_GLOBAL_SSL (1<<0)
1291 #define CURL_GLOBAL_WIN32 (1<<1)
1292 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
1293 #define CURL_GLOBAL_NOTHING 0
1294 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
1297 /*****************************************************************************
1298 * Setup defines, protos etc for the sharing stuff.
1301 /* Different data locks for a single share */
1303 CURL_LOCK_DATA_NONE = 0,
1304 /* CURL_LOCK_DATA_SHARE is used internaly to say that
1305 * the locking is just made to change the internal state of the share
1308 CURL_LOCK_DATA_SHARE,
1309 CURL_LOCK_DATA_COOKIE,
1311 CURL_LOCK_DATA_SSL_SESSION,
1312 CURL_LOCK_DATA_CONNECT,
1316 /* Different lock access types */
1318 CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */
1319 CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
1320 CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
1321 CURL_LOCK_ACCESS_LAST /* never use */
1324 typedef void (*curl_lock_function)(CURL *handle,
1325 curl_lock_data data,
1326 curl_lock_access locktype,
1328 typedef void (*curl_unlock_function)(CURL *handle,
1329 curl_lock_data data,
1332 typedef void CURLSH;
1335 CURLSHE_OK, /* all is fine */
1336 CURLSHE_BAD_OPTION, /* 1 */
1337 CURLSHE_IN_USE, /* 2 */
1338 CURLSHE_INVALID, /* 3 */
1339 CURLSHE_NOMEM, /* out of memory */
1340 CURLSHE_LAST /* never use */
1344 CURLSHOPT_NONE, /* don't use */
1345 CURLSHOPT_SHARE, /* specify a data type to share */
1346 CURLSHOPT_UNSHARE, /* specify shich data type to stop sharing */
1347 CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */
1348 CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
1349 CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock
1350 callback functions */
1351 CURLSHOPT_LAST /* never use */
1354 CURL_EXTERN CURLSH *curl_share_init(void);
1355 CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
1356 CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
1358 /****************************************************************************
1359 * Structures for querying information about the curl library at runtime.
1366 CURLVERSION_LAST /* never actually use this */
1369 /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
1370 basicly all programs ever, that want to get version information. It is
1371 meant to be a built-in version number for what kind of struct the caller
1372 expects. If the struct ever changes, we redefine the NOW to another enum
1374 #define CURLVERSION_NOW CURLVERSION_THIRD
1377 CURLversion age; /* age of the returned struct */
1378 const char *version; /* LIBCURL_VERSION */
1379 unsigned int version_num; /* LIBCURL_VERSION_NUM */
1380 const char *host; /* OS/host/cpu/machine when configured */
1381 int features; /* bitmask, see defines below */
1382 const char *ssl_version; /* human readable string */
1383 long ssl_version_num; /* not used anymore, always 0 */
1384 const char *libz_version; /* human readable string */
1385 /* protocols is terminated by an entry with a NULL protoname */
1386 const char * const *protocols;
1388 /* The fields below this were added in CURLVERSION_SECOND */
1392 /* This field was aded in CURLVERSION_THIRD */
1394 } curl_version_info_data;
1396 #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */
1397 #define CURL_VERSION_KERBEROS4 (1<<1) /* kerberos auth is supported */
1398 #define CURL_VERSION_SSL (1<<2) /* SSL options are present */
1399 #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */
1400 #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */
1401 #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */
1402 #define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */
1403 #define CURL_VERSION_ASYNCHDNS (1<<7) /* asynchronous dns resolves */
1404 #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */
1405 #define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */
1406 #define CURL_VERSION_IDN (1<<10) /* International Domain Names support */
1407 #define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */
1410 * NAME curl_version_info()
1414 * This function returns a pointer to a static copy of the version info
1415 * struct. See above.
1417 CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
1420 * NAME curl_easy_strerror()
1424 * The curl_easy_strerror function may be used to turn a CURLcode value
1425 * into the equivalent human readable error string. This is useful
1426 * for printing meaningful error messages.
1428 CURL_EXTERN const char *curl_easy_strerror(CURLcode);
1431 * NAME curl_share_strerror()
1435 * The curl_share_strerror function may be used to turn a CURLSHcode value
1436 * into the equivalent human readable error string. This is useful
1437 * for printing meaningful error messages.
1439 CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
1445 /* unfortunately, the easy.h and multi.h include files need options and info
1446 stuff before they can be included! */
1447 #include "easy.h" /* nothing in curl is fun without the easy stuff */
1450 #endif /* __CURL_CURL_H */