Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl / curl / curl.h
blob0142683e0eb76f282c4f8eb8921985814b6bf89a
1 #ifndef __CURL_CURL_H
2 #define __CURL_CURL_H
3 /***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2007, 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 <<<<<<< curl.h
24 * $Id: curl.h,v 1.3 2007/03/16 22:44:39 king Exp $
25 =======
26 * $Id: curl.h,v 1.4 2008-09-15 21:53:28 hoffman Exp $
27 >>>>>>> 1.4
28 ***************************************************************************/
30 /* If you have problems, all libcurl docs and details are found here:
31 http://curl.haxx.se/libcurl/
34 #include "curlver.h" /* the libcurl version defines */
36 #include <stdio.h>
37 #include <limits.h>
39 /* The include stuff here below is mainly for time_t! */
40 #ifdef vms
41 # include <types.h>
42 # include <time.h>
43 #else
44 # include <sys/types.h>
45 # include <time.h>
46 #endif /* defined (vms) */
48 typedef void CURL;
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
55 * Decorate exportable functions for Win32 DLL linking.
56 * This avoids using a .def file for building libcurl.dll.
58 #if (defined(WIN32) || defined(_WIN32)) && !defined(CURL_STATICLIB)
59 #if defined(BUILDING_LIBCURL)
60 #define CURL_EXTERN __declspec(dllexport)
61 #else
62 #define CURL_EXTERN __declspec(dllimport)
63 #endif
64 #else
66 #ifdef CURL_HIDDEN_SYMBOLS
68 * This definition is used to make external definitions visibile in the
69 * shared library when symbols are hidden by default. It makes no
70 * difference when compiling applications whether this is set or not,
71 * only when compiling the library.
73 #define CURL_EXTERN CURL_EXTERN_SYMBOL
74 #else
75 #define CURL_EXTERN
76 #endif
77 #endif
80 * We want the typedef curl_off_t setup for large file support on all
81 * platforms. We also provide a CURL_FORMAT_OFF_T define to use in *printf
82 * format strings when outputting a variable of type curl_off_t.
84 * Note: "pocc -Ze" is MSVC compatibily mode and this sets _MSC_VER!
87 #if (defined(_MSC_VER) && !defined(__POCC__)) || (defined(__LCC__) && defined(WIN32))
88 /* MSVC */
89 #ifdef _WIN32_WCE
90 typedef long curl_off_t;
91 #define CURL_FORMAT_OFF_T "%ld"
92 #else
93 typedef signed __int64 curl_off_t;
94 #define CURL_FORMAT_OFF_T "%I64d"
95 #endif
96 #else /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
97 #if (defined(__GNUC__) && defined(WIN32)) || defined(__WATCOMC__)
98 /* gcc on windows or Watcom */
99 typedef long long curl_off_t;
100 #define CURL_FORMAT_OFF_T "%I64d"
101 #else /* GCC or Watcom on Windows */
103 /* "normal" POSIX approach, do note that this does not necessarily mean that
104 the type is >32 bits, see the SIZEOF_CURL_OFF_T define for that! */
105 typedef off_t curl_off_t;
107 /* Check a range of defines to detect large file support. On Linux it seems
108 none of these are set by default, so if you don't explicitly switches on
109 large file support, this define will be made for "small file" support. */
110 #ifndef _FILE_OFFSET_BITS
111 #define _FILE_OFFSET_BITS 0 /* to prevent warnings in the check below */
112 #define UNDEF_FILE_OFFSET_BITS
113 #endif
114 #ifndef FILESIZEBITS
115 #define FILESIZEBITS 0 /* to prevent warnings in the check below */
116 #define UNDEF_FILESIZEBITS
117 #endif
119 #if defined(_LARGE_FILES) || (_FILE_OFFSET_BITS > 32) || (FILESIZEBITS > 32) \
120 || defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)
121 /* For now, we assume at least one of these to be set for large files to
122 work! */
123 #define CURL_FORMAT_OFF_T "%lld"
124 #else /* LARGE_FILE support */
125 #define CURL_FORMAT_OFF_T "%ld"
126 #endif
127 #endif /* GCC or Watcom on Windows */
128 #endif /* (_MSC_VER && !__POCC__) || (__LCC__ && WIN32) */
130 #ifdef UNDEF_FILE_OFFSET_BITS
131 /* this was defined above for our checks, undefine it again */
132 #undef _FILE_OFFSET_BITS
133 #endif
135 #ifdef UNDEF_FILESIZEBITS
136 /* this was defined above for our checks, undefine it again */
137 #undef FILESIZEBITS
138 #endif
140 #if defined(_WIN32) && !defined(WIN32)
141 /* Chris Lewis mentioned that he doesn't get WIN32 defined, only _WIN32 so we
142 make this adjustment to catch this. */
143 #define WIN32 1
144 #endif
146 #ifdef __cplusplus
148 #endif
150 #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
151 !defined(__CYGWIN__) || defined(__MINGW32__)
152 #if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
153 /* The check above prevents the winsock2 inclusion if winsock.h already was
154 included, since they can't co-exist without problems */
155 #include <winsock2.h>
156 #endif
157 #else
159 /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
160 libc5-based Linux systems. Only include it on system that are known to
161 require it! */
162 #if defined(_AIX) || defined(NETWARE) || defined(__NetBSD__) || defined(__minix)
163 #include <sys/select.h>
164 #endif
166 #ifndef _WIN32_WCE
167 #include <sys/socket.h>
168 #endif
169 #ifndef __WATCOMC__
170 #include <sys/time.h>
171 #endif
172 #include <sys/types.h>
173 #endif
175 #ifdef __cplusplus
176 extern "C" {
177 #endif
179 #ifndef curl_socket_typedef
180 /* socket typedef */
181 #ifdef WIN32
182 typedef SOCKET curl_socket_t;
183 #define CURL_SOCKET_BAD INVALID_SOCKET
184 #else
185 typedef int curl_socket_t;
186 #define CURL_SOCKET_BAD -1
187 #endif
188 #define curl_socket_typedef
189 #endif /* curl_socket_typedef */
191 struct curl_httppost {
192 struct curl_httppost *next; /* next entry in the list */
193 char *name; /* pointer to allocated name */
194 long namelength; /* length of name length */
195 char *contents; /* pointer to allocated data contents */
196 long contentslength; /* length of contents field */
197 char *buffer; /* pointer to allocated buffer contents */
198 long bufferlength; /* length of buffer field */
199 char *contenttype; /* Content-Type */
200 struct curl_slist* contentheader; /* list of extra headers for this form */
201 struct curl_httppost *more; /* if one field name has more than one
202 file, this link should link to following
203 files */
204 long flags; /* as defined below */
205 #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */
206 #define HTTPPOST_READFILE (1<<1) /* specified content is a file name */
207 #define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer
208 do not free in formfree */
209 #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
210 do not free in formfree */
211 #define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */
212 #define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */
214 char *showfilename; /* The file name to show. If not set, the
215 actual file name will be used (if this
216 is a file part) */
219 typedef int (*curl_progress_callback)(void *clientp,
220 double dltotal,
221 double dlnow,
222 double ultotal,
223 double ulnow);
225 /* Tests have proven that 20K is a very bad buffer size for uploads on
226 Windows, while 16K for some odd reason performed a lot better. */
227 #define CURL_MAX_WRITE_SIZE 16384
229 typedef size_t (*curl_write_callback)(char *buffer,
230 size_t size,
231 size_t nitems,
232 void *outstream);
234 /* This is a return code for the read callback that, when returned, will
235 signal libcurl to immediately abort the current transfer. */
236 #define CURL_READFUNC_ABORT 0x10000000
237 typedef size_t (*curl_read_callback)(char *buffer,
238 size_t size,
239 size_t nitems,
240 void *instream);
242 typedef enum {
243 CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
244 CURLSOCKTYPE_LAST /* never use */
245 } curlsocktype;
247 typedef int (*curl_sockopt_callback)(void *clientp,
248 curl_socket_t curlfd,
249 curlsocktype purpose);
251 #ifndef CURL_NO_OLDIES
252 /* not used since 7.10.8, will be removed in a future release */
253 typedef int (*curl_passwd_callback)(void *clientp,
254 const char *prompt,
255 char *buffer,
256 int buflen);
257 #endif
259 typedef enum {
260 CURLIOE_OK, /* I/O operation successful */
261 CURLIOE_UNKNOWNCMD, /* command was unknown to callback */
262 CURLIOE_FAILRESTART, /* failed to restart the read */
263 CURLIOE_LAST /* never use */
264 } curlioerr;
266 typedef enum {
267 CURLIOCMD_NOP, /* no operation */
268 CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
269 CURLIOCMD_LAST /* never use */
270 } curliocmd;
272 typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
273 int cmd,
274 void *clientp);
277 * The following typedef's are signatures of malloc, free, realloc, strdup and
278 * calloc respectively. Function pointers of these types can be passed to the
279 * curl_global_init_mem() function to set user defined memory management
280 * callback routines.
282 typedef void *(*curl_malloc_callback)(size_t size);
283 typedef void (*curl_free_callback)(void *ptr);
284 typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
285 typedef char *(*curl_strdup_callback)(const char *str);
286 typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
288 /* the kind of data that is passed to information_callback*/
289 typedef enum {
290 CURLINFO_TEXT = 0,
291 CURLINFO_HEADER_IN, /* 1 */
292 CURLINFO_HEADER_OUT, /* 2 */
293 CURLINFO_DATA_IN, /* 3 */
294 CURLINFO_DATA_OUT, /* 4 */
295 CURLINFO_SSL_DATA_IN, /* 5 */
296 CURLINFO_SSL_DATA_OUT, /* 6 */
297 CURLINFO_END
298 } curl_infotype;
300 typedef int (*curl_debug_callback)
301 (CURL *handle, /* the handle/transfer this concerns */
302 curl_infotype type, /* what kind of data */
303 char *data, /* points to the data */
304 size_t size, /* size of the data pointed to */
305 void *userptr); /* whatever the user please */
307 /* All possible error codes from all sorts of curl functions. Future versions
308 may return other values, stay prepared.
310 Always add new return codes last. Never *EVER* remove any. The return
311 codes must remain the same!
314 typedef enum {
315 CURLE_OK = 0,
316 CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
317 CURLE_FAILED_INIT, /* 2 */
318 CURLE_URL_MALFORMAT, /* 3 */
319 CURLE_URL_MALFORMAT_USER, /* 4 - NOT USED */
320 CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
321 CURLE_COULDNT_RESOLVE_HOST, /* 6 */
322 CURLE_COULDNT_CONNECT, /* 7 */
323 CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
324 CURLE_FTP_ACCESS_DENIED, /* 9 a service was denied by the FTP server
325 due to lack of access - when login fails
326 this is not returned. */
327 CURLE_FTP_USER_PASSWORD_INCORRECT, /* 10 - NOT USED */
328 CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
329 CURLE_FTP_WEIRD_USER_REPLY, /* 12 */
330 CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
331 CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
332 CURLE_FTP_CANT_GET_HOST, /* 15 */
333 CURLE_FTP_CANT_RECONNECT, /* 16 */
334 CURLE_FTP_COULDNT_SET_BINARY, /* 17 */
335 CURLE_PARTIAL_FILE, /* 18 */
336 CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
337 CURLE_FTP_WRITE_ERROR, /* 20 */
338 CURLE_FTP_QUOTE_ERROR, /* 21 */
339 CURLE_HTTP_RETURNED_ERROR, /* 22 */
340 CURLE_WRITE_ERROR, /* 23 */
341 CURLE_MALFORMAT_USER, /* 24 - NOT USED */
342 CURLE_FTP_COULDNT_STOR_FILE, /* 25 - failed FTP upload */
343 CURLE_READ_ERROR, /* 26 - could open/read from file */
344 CURLE_OUT_OF_MEMORY, /* 27 */
345 /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
346 instead of a memory allocation error if CURL_DOES_CONVERSIONS
347 is defined
349 CURLE_OPERATION_TIMEOUTED, /* 28 - the timeout time was reached */
350 CURLE_FTP_COULDNT_SET_ASCII, /* 29 - TYPE A failed */
351 CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
352 CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
353 CURLE_FTP_COULDNT_GET_SIZE, /* 32 - the SIZE command failed */
354 CURLE_HTTP_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
355 CURLE_HTTP_POST_ERROR, /* 34 */
356 CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
357 CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
358 CURLE_FILE_COULDNT_READ_FILE, /* 37 */
359 CURLE_LDAP_CANNOT_BIND, /* 38 */
360 CURLE_LDAP_SEARCH_FAILED, /* 39 */
361 CURLE_LIBRARY_NOT_FOUND, /* 40 */
362 CURLE_FUNCTION_NOT_FOUND, /* 41 */
363 CURLE_ABORTED_BY_CALLBACK, /* 42 */
364 CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
365 CURLE_BAD_CALLING_ORDER, /* 44 - NOT USED */
366 CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
367 CURLE_BAD_PASSWORD_ENTERED, /* 46 - NOT USED */
368 CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
369 CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */
370 CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
371 CURLE_OBSOLETE, /* 50 - NOT USED */
372 CURLE_SSL_PEER_CERTIFICATE, /* 51 - peer's certificate wasn't ok */
373 CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
374 CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
375 CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
376 default */
377 CURLE_SEND_ERROR, /* 55 - failed sending network data */
378 CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
379 CURLE_SHARE_IN_USE, /* 57 - share is in use */
380 CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
381 CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
382 CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
383 CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */
384 CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
385 CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
386 CURLE_FTP_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
387 CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
388 that failed */
389 CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
390 CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
391 accepted and we failed to login */
392 CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */
393 CURLE_TFTP_PERM, /* 69 - permission problem on server */
394 CURLE_TFTP_DISKFULL, /* 70 - out of disk space on server */
395 CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */
396 CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */
397 CURLE_TFTP_EXISTS, /* 73 - File already exists */
398 CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */
399 CURLE_CONV_FAILED, /* 75 - conversion failed */
400 CURLE_CONV_REQD, /* 76 - caller must register conversion
401 callbacks using curl_easy_setopt options
402 CURLOPT_CONV_FROM_NETWORK_FUNCTION,
403 CURLOPT_CONV_TO_NETWORK_FUNCTION, and
404 CURLOPT_CONV_FROM_UTF8_FUNCTION */
405 CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing
406 or wrong format */
407 CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */
408 CURLE_SSH, /* 79 - error from the SSH layer, somewhat
409 generic so the error message will be of
410 interest when this has happened */
412 CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL
413 connection */
414 CURL_LAST /* never use! */
415 } CURLcode;
417 /* This prototype applies to all conversion callbacks */
418 typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
420 typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
421 void *ssl_ctx, /* actually an
422 OpenSSL SSL_CTX */
423 void *userptr);
425 /* Make a spelling correction for the operation timed-out define */
426 #define CURLE_OPERATION_TIMEDOUT CURLE_OPERATION_TIMEOUTED
428 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
429 the obsolete stuff removed! */
430 /* backwards compatibility with older names */
431 #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
432 #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
433 #endif
435 typedef enum {
436 CURLPROXY_HTTP = 0,
437 CURLPROXY_SOCKS4 = 4,
438 CURLPROXY_SOCKS5 = 5
439 } curl_proxytype;
441 #define CURLAUTH_NONE 0 /* nothing */
442 #define CURLAUTH_BASIC (1<<0) /* Basic (default) */
443 #define CURLAUTH_DIGEST (1<<1) /* Digest */
444 #define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */
445 #define CURLAUTH_NTLM (1<<3) /* NTLM */
446 #define CURLAUTH_ANY ~0 /* all types set */
447 #define CURLAUTH_ANYSAFE (~CURLAUTH_BASIC)
449 #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */
450 #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */
451 #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
452 #define CURLSSH_AUTH_PASSWORD (1<<1) /* password */
453 #define CURLSSH_AUTH_HOST (1<<2) /* host key files */
454 #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */
455 #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
457 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
458 the obsolete stuff removed! */
459 /* this was the error code 50 in 7.7.3 and a few earlier versions, this
460 is no longer used by libcurl but is instead #defined here only to not
461 make programs break */
462 #define CURLE_ALREADY_COMPLETE 99999
464 /* These are just to make older programs not break: */
465 #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
466 #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
467 #endif
469 #define CURL_ERROR_SIZE 256
471 /* parameter for the CURLOPT_FTP_SSL option */
472 typedef enum {
473 CURLFTPSSL_NONE, /* do not attempt to use SSL */
474 CURLFTPSSL_TRY, /* try using SSL, proceed anyway otherwise */
475 CURLFTPSSL_CONTROL, /* SSL for the control connection or fail */
476 CURLFTPSSL_ALL, /* SSL for all communication or fail */
477 CURLFTPSSL_LAST /* not an option, never use */
478 } curl_ftpssl;
480 /* parameter for the CURLOPT_FTPSSLAUTH option */
481 typedef enum {
482 CURLFTPAUTH_DEFAULT, /* let libcurl decide */
483 CURLFTPAUTH_SSL, /* use "AUTH SSL" */
484 CURLFTPAUTH_TLS, /* use "AUTH TLS" */
485 CURLFTPAUTH_LAST /* not an option, never use */
486 } curl_ftpauth;
488 /* parameter for the CURLOPT_FTP_FILEMETHOD option */
489 typedef enum {
490 CURLFTPMETHOD_DEFAULT, /* let libcurl pick */
491 CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */
492 CURLFTPMETHOD_NOCWD, /* no CWD at all */
493 CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
494 CURLFTPMETHOD_LAST /* not an option, never use */
495 } curl_ftpmethod;
497 /* long may be 32 or 64 bits, but we should never depend on anything else
498 but 32 */
499 #define CURLOPTTYPE_LONG 0
500 #define CURLOPTTYPE_OBJECTPOINT 10000
501 #define CURLOPTTYPE_FUNCTIONPOINT 20000
502 #define CURLOPTTYPE_OFF_T 30000
504 /* name is uppercase CURLOPT_<name>,
505 type is one of the defined CURLOPTTYPE_<type>
506 number is unique identifier */
507 #ifdef CINIT
508 #undef CINIT
509 #endif
511 * Figure out if we can use the ## operator, which is supported by ISO/ANSI C
512 * and C++. Some compilers support it without setting __STDC__ or __cplusplus
513 * so we need to carefully check for them too. We don't use configure-checks
514 * for these since we want these headers to remain generic and working for all
515 * platforms.
517 #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
518 defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
519 defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__)
520 /* This compiler is believed to have an ISO compatible preprocessor */
521 #define CURL_ISOCPP
522 #else
523 /* This compiler is believed NOT to have an ISO compatible preprocessor */
524 #undef CURL_ISOCPP
525 #endif
527 #ifdef CURL_ISOCPP
528 #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
529 #else
530 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
531 #define LONG CURLOPTTYPE_LONG
532 #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
533 #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
534 #define OFF_T CURLOPTTYPE_OFF_T
535 #define CINIT(name,type,number) CURLOPT_/**/name = type + number
536 #endif
539 * This macro-mania below setups the CURLOPT_[what] enum, to be used with
540 * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
541 * word.
544 typedef enum {
545 /* This is the FILE * or void * the regular output should be written to. */
546 CINIT(FILE, OBJECTPOINT, 1),
548 /* The full URL to get/put */
549 CINIT(URL, OBJECTPOINT, 2),
551 /* Port number to connect to, if other than default. */
552 CINIT(PORT, LONG, 3),
554 /* Name of proxy to use. */
555 CINIT(PROXY, OBJECTPOINT, 4),
557 /* "name:password" to use when fetching. */
558 CINIT(USERPWD, OBJECTPOINT, 5),
560 /* "name:password" to use with proxy. */
561 CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
563 /* Range to get, specified as an ASCII string. */
564 CINIT(RANGE, OBJECTPOINT, 7),
566 /* not used */
568 /* Specified file stream to upload from (use as input): */
569 CINIT(INFILE, OBJECTPOINT, 9),
571 /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
572 * bytes big. If this is not used, error messages go to stderr instead: */
573 CINIT(ERRORBUFFER, OBJECTPOINT, 10),
575 /* Function that will be called to store the output (instead of fwrite). The
576 * parameters will use fwrite() syntax, make sure to follow them. */
577 CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
579 /* Function that will be called to read the input (instead of fread). The
580 * parameters will use fread() syntax, make sure to follow them. */
581 CINIT(READFUNCTION, FUNCTIONPOINT, 12),
583 /* Time-out the read operation after this amount of seconds */
584 CINIT(TIMEOUT, LONG, 13),
586 /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
587 * how large the file being sent really is. That allows better error
588 * checking and better verifies that the upload was succcessful. -1 means
589 * unknown size.
591 * For large file support, there is also a _LARGE version of the key
592 * which takes an off_t type, allowing platforms with larger off_t
593 * sizes to handle larger files. See below for INFILESIZE_LARGE.
595 CINIT(INFILESIZE, LONG, 14),
597 /* POST input fields. */
598 CINIT(POSTFIELDS, OBJECTPOINT, 15),
600 /* Set the referer page (needed by some CGIs) */
601 CINIT(REFERER, OBJECTPOINT, 16),
603 /* Set the FTP PORT string (interface name, named or numerical IP address)
604 Use i.e '-' to use default address. */
605 CINIT(FTPPORT, OBJECTPOINT, 17),
607 /* Set the User-Agent string (examined by some CGIs) */
608 CINIT(USERAGENT, OBJECTPOINT, 18),
610 /* If the download receives less than "low speed limit" bytes/second
611 * during "low speed time" seconds, the operations is aborted.
612 * You could i.e if you have a pretty high speed connection, abort if
613 * it is less than 2000 bytes/sec during 20 seconds.
616 /* Set the "low speed limit" */
617 CINIT(LOW_SPEED_LIMIT, LONG , 19),
619 /* Set the "low speed time" */
620 CINIT(LOW_SPEED_TIME, LONG, 20),
622 /* Set the continuation offset.
624 * Note there is also a _LARGE version of this key which uses
625 * off_t types, allowing for large file offsets on platforms which
626 * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
628 CINIT(RESUME_FROM, LONG, 21),
630 /* Set cookie in request: */
631 CINIT(COOKIE, OBJECTPOINT, 22),
633 /* This points to a linked list of headers, struct curl_slist kind */
634 CINIT(HTTPHEADER, OBJECTPOINT, 23),
636 /* This points to a linked list of post entries, struct HttpPost */
637 CINIT(HTTPPOST, OBJECTPOINT, 24),
639 /* name of the file keeping your private SSL-certificate */
640 CINIT(SSLCERT, OBJECTPOINT, 25),
642 /* password for the SSL-private key, keep this for compatibility */
643 CINIT(SSLCERTPASSWD, OBJECTPOINT, 26),
644 /* password for the SSL private key */
645 CINIT(SSLKEYPASSWD, OBJECTPOINT, 26),
647 /* send TYPE parameter? */
648 CINIT(CRLF, LONG, 27),
650 /* send linked-list of QUOTE commands */
651 CINIT(QUOTE, OBJECTPOINT, 28),
653 /* send FILE * or void * to store headers to, if you use a callback it
654 is simply passed to the callback unmodified */
655 CINIT(WRITEHEADER, OBJECTPOINT, 29),
657 /* point to a file to read the initial cookies from, also enables
658 "cookie awareness" */
659 CINIT(COOKIEFILE, OBJECTPOINT, 31),
661 /* What version to specifly try to use.
662 See CURL_SSLVERSION defines below. */
663 CINIT(SSLVERSION, LONG, 32),
665 /* What kind of HTTP time condition to use, see defines */
666 CINIT(TIMECONDITION, LONG, 33),
668 /* Time to use with the above condition. Specified in number of seconds
669 since 1 Jan 1970 */
670 CINIT(TIMEVALUE, LONG, 34),
672 /* 35 = OBSOLETE */
674 /* Custom request, for customizing the get command like
675 HTTP: DELETE, TRACE and others
676 FTP: to use a different list command
678 CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
680 /* HTTP request, for odd commands like DELETE, TRACE and others */
681 CINIT(STDERR, OBJECTPOINT, 37),
683 /* 38 is not used */
685 /* send linked-list of post-transfer QUOTE commands */
686 CINIT(POSTQUOTE, OBJECTPOINT, 39),
688 /* Pass a pointer to string of the output using full variable-replacement
689 as described elsewhere. */
690 CINIT(WRITEINFO, OBJECTPOINT, 40),
692 CINIT(VERBOSE, LONG, 41), /* talk a lot */
693 CINIT(HEADER, LONG, 42), /* throw the header out too */
694 CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */
695 CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */
696 CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */
697 CINIT(UPLOAD, LONG, 46), /* this is an upload */
698 CINIT(POST, LONG, 47), /* HTTP POST method */
699 CINIT(FTPLISTONLY, LONG, 48), /* Use NLST when listing ftp dir */
701 CINIT(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
703 /* Specify whether to read the user+password from the .netrc or the URL.
704 * This must be one of the CURL_NETRC_* enums below. */
705 CINIT(NETRC, LONG, 51),
707 CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
709 CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
710 CINIT(PUT, LONG, 54), /* HTTP PUT */
712 /* 55 = OBSOLETE */
714 /* Function that will be called instead of the internal progress display
715 * function. This function should be defined as the curl_progress_callback
716 * prototype defines. */
717 CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
719 /* Data passed to the progress callback */
720 CINIT(PROGRESSDATA, OBJECTPOINT, 57),
722 /* We want the referer field set automatically when following locations */
723 CINIT(AUTOREFERER, LONG, 58),
725 /* Port of the proxy, can be set in the proxy string as well with:
726 "[host]:[port]" */
727 CINIT(PROXYPORT, LONG, 59),
729 /* size of the POST input data, if strlen() is not good to use */
730 CINIT(POSTFIELDSIZE, LONG, 60),
732 /* tunnel non-http operations through a HTTP proxy */
733 CINIT(HTTPPROXYTUNNEL, LONG, 61),
735 /* Set the interface string to use as outgoing network interface */
736 CINIT(INTERFACE, OBJECTPOINT, 62),
738 /* Set the krb4 security level, this also enables krb4 awareness. This is a
739 * string, 'clear', 'safe', 'confidential' or 'private'. If the string is
740 * set but doesn't match one of these, 'private' will be used. */
741 CINIT(KRB4LEVEL, OBJECTPOINT, 63),
743 /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
744 CINIT(SSL_VERIFYPEER, LONG, 64),
746 /* The CApath or CAfile used to validate the peer certificate
747 this option is used only if SSL_VERIFYPEER is true */
748 CINIT(CAINFO, OBJECTPOINT, 65),
750 /* 66 = OBSOLETE */
751 /* 67 = OBSOLETE */
753 /* Maximum number of http redirects to follow */
754 CINIT(MAXREDIRS, LONG, 68),
756 /* Pass a long set to 1 to get the date of the requested document (if
757 possible)! Pass a zero to shut it off. */
758 CINIT(FILETIME, LONG, 69),
760 /* This points to a linked list of telnet options */
761 CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
763 /* Max amount of cached alive connections */
764 CINIT(MAXCONNECTS, LONG, 71),
766 /* What policy to use when closing connections when the cache is filled
767 up */
768 CINIT(CLOSEPOLICY, LONG, 72),
770 /* 73 = OBSOLETE */
772 /* Set to explicitly use a new connection for the upcoming transfer.
773 Do not use this unless you're absolutely sure of this, as it makes the
774 operation slower and is less friendly for the network. */
775 CINIT(FRESH_CONNECT, LONG, 74),
777 /* Set to explicitly forbid the upcoming transfer's connection to be re-used
778 when done. Do not use this unless you're absolutely sure of this, as it
779 makes the operation slower and is less friendly for the network. */
780 CINIT(FORBID_REUSE, LONG, 75),
782 /* Set to a file name that contains random data for libcurl to use to
783 seed the random engine when doing SSL connects. */
784 CINIT(RANDOM_FILE, OBJECTPOINT, 76),
786 /* Set to the Entropy Gathering Daemon socket pathname */
787 CINIT(EGDSOCKET, OBJECTPOINT, 77),
789 /* Time-out connect operations after this amount of seconds, if connects
790 are OK within this time, then fine... This only aborts the connect
791 phase. [Only works on unix-style/SIGALRM operating systems] */
792 CINIT(CONNECTTIMEOUT, LONG, 78),
794 /* Function that will be called to store headers (instead of fwrite). The
795 * parameters will use fwrite() syntax, make sure to follow them. */
796 CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
798 /* Set this to force the HTTP request to get back to GET. Only really usable
799 if POST, PUT or a custom request have been used first.
801 CINIT(HTTPGET, LONG, 80),
803 /* Set if we should verify the Common name from the peer certificate in ssl
804 * handshake, set 1 to check existence, 2 to ensure that it matches the
805 * provided hostname. */
806 CINIT(SSL_VERIFYHOST, LONG, 81),
808 /* Specify which file name to write all known cookies in after completed
809 operation. Set file name to "-" (dash) to make it go to stdout. */
810 CINIT(COOKIEJAR, OBJECTPOINT, 82),
812 /* Specify which SSL ciphers to use */
813 CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),
815 /* Specify which HTTP version to use! This must be set to one of the
816 CURL_HTTP_VERSION* enums set below. */
817 CINIT(HTTP_VERSION, LONG, 84),
819 /* Specificly switch on or off the FTP engine's use of the EPSV command. By
820 default, that one will always be attempted before the more traditional
821 PASV command. */
822 CINIT(FTP_USE_EPSV, LONG, 85),
824 /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
825 CINIT(SSLCERTTYPE, OBJECTPOINT, 86),
827 /* name of the file keeping your private SSL-key */
828 CINIT(SSLKEY, OBJECTPOINT, 87),
830 /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
831 CINIT(SSLKEYTYPE, OBJECTPOINT, 88),
833 /* crypto engine for the SSL-sub system */
834 CINIT(SSLENGINE, OBJECTPOINT, 89),
836 /* set the crypto engine for the SSL-sub system as default
837 the param has no meaning...
839 CINIT(SSLENGINE_DEFAULT, LONG, 90),
841 /* Non-zero value means to use the global dns cache */
842 CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To becomeO BSOLETE soon */
844 /* DNS cache timeout */
845 CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
847 /* send linked-list of pre-transfer QUOTE commands (Wesley Laxton)*/
848 CINIT(PREQUOTE, OBJECTPOINT, 93),
850 /* set the debug function */
851 CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
853 /* set the data for the debug function */
854 CINIT(DEBUGDATA, OBJECTPOINT, 95),
856 /* mark this as start of a cookie session */
857 CINIT(COOKIESESSION, LONG, 96),
859 /* The CApath directory used to validate the peer certificate
860 this option is used only if SSL_VERIFYPEER is true */
861 CINIT(CAPATH, OBJECTPOINT, 97),
863 /* Instruct libcurl to use a smaller receive buffer */
864 CINIT(BUFFERSIZE, LONG, 98),
866 /* Instruct libcurl to not use any signal/alarm handlers, even when using
867 timeouts. This option is useful for multi-threaded applications.
868 See libcurl-the-guide for more background information. */
869 CINIT(NOSIGNAL, LONG, 99),
871 /* Provide a CURLShare for mutexing non-ts data */
872 CINIT(SHARE, OBJECTPOINT, 100),
874 /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
875 CURLPROXY_SOCKS4 and CURLPROXY_SOCKS5. */
876 CINIT(PROXYTYPE, LONG, 101),
878 /* Set the Accept-Encoding string. Use this to tell a server you would like
879 the response to be compressed. */
880 CINIT(ENCODING, OBJECTPOINT, 102),
882 /* Set pointer to private data */
883 CINIT(PRIVATE, OBJECTPOINT, 103),
885 /* Set aliases for HTTP 200 in the HTTP Response header */
886 CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
888 /* Continue to send authentication (user+password) when following locations,
889 even when hostname changed. This can potentionally send off the name
890 and password to whatever host the server decides. */
891 CINIT(UNRESTRICTED_AUTH, LONG, 105),
893 /* Specificly switch on or off the FTP engine's use of the EPRT command ( it
894 also disables the LPRT attempt). By default, those ones will always be
895 attempted before the good old traditional PORT command. */
896 CINIT(FTP_USE_EPRT, LONG, 106),
898 /* Set this to a bitmask value to enable the particular authentications
899 methods you like. Use this in combination with CURLOPT_USERPWD.
900 Note that setting multiple bits may cause extra network round-trips. */
901 CINIT(HTTPAUTH, LONG, 107),
903 /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
904 in second argument. The function must be matching the
905 curl_ssl_ctx_callback proto. */
906 CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
908 /* Set the userdata for the ssl context callback function's third
909 argument */
910 CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
912 /* FTP Option that causes missing dirs to be created on the remote server */
913 CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
915 /* Set this to a bitmask value to enable the particular authentications
916 methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
917 Note that setting multiple bits may cause extra network round-trips. */
918 CINIT(PROXYAUTH, LONG, 111),
920 /* FTP option that changes the timeout, in seconds, associated with
921 getting a response. This is different from transfer timeout time and
922 essentially places a demand on the FTP server to acknowledge commands
923 in a timely manner. */
924 CINIT(FTP_RESPONSE_TIMEOUT, LONG , 112),
926 /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
927 tell libcurl to resolve names to those IP versions only. This only has
928 affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
929 CINIT(IPRESOLVE, LONG, 113),
931 /* Set this option to limit the size of a file that will be downloaded from
932 an HTTP or FTP server.
934 Note there is also _LARGE version which adds large file support for
935 platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
936 CINIT(MAXFILESIZE, LONG, 114),
938 /* See the comment for INFILESIZE above, but in short, specifies
939 * the size of the file being uploaded. -1 means unknown.
941 CINIT(INFILESIZE_LARGE, OFF_T, 115),
943 /* Sets the continuation offset. There is also a LONG version of this;
944 * look above for RESUME_FROM.
946 CINIT(RESUME_FROM_LARGE, OFF_T, 116),
948 /* Sets the maximum size of data that will be downloaded from
949 * an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
951 CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
953 /* Set this option to the file name of your .netrc file you want libcurl
954 to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
955 a poor attempt to find the user's home directory and check for a .netrc
956 file in there. */
957 CINIT(NETRC_FILE, OBJECTPOINT, 118),
959 /* Enable SSL/TLS for FTP, pick one of:
960 CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise
961 CURLFTPSSL_CONTROL - SSL for the control connection or fail
962 CURLFTPSSL_ALL - SSL for all communication or fail
964 CINIT(FTP_SSL, LONG, 119),
966 /* The _LARGE version of the standard POSTFIELDSIZE option */
967 CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
969 /* Enable/disable the TCP Nagle algorithm */
970 CINIT(TCP_NODELAY, LONG, 121),
972 /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
973 /* 123 OBSOLETE. Gone in 7.16.0 */
974 /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
975 /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
976 /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
977 /* 127 OBSOLETE. Gone in 7.16.0 */
978 /* 128 OBSOLETE. Gone in 7.16.0 */
980 /* When FTP over SSL/TLS is selected (with CURLOPT_FTP_SSL), this option
981 can be used to change libcurl's default action which is to first try
982 "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
983 response has been received.
985 Available parameters are:
986 CURLFTPAUTH_DEFAULT - let libcurl decide
987 CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
988 CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
990 CINIT(FTPSSLAUTH, LONG, 129),
992 CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
993 CINIT(IOCTLDATA, OBJECTPOINT, 131),
995 /* 132 OBSOLETE. Gone in 7.16.0 */
996 /* 133 OBSOLETE. Gone in 7.16.0 */
998 /* zero terminated string for pass on to the FTP server when asked for
999 "account" info */
1000 CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
1002 /* feed cookies into cookie engine */
1003 CINIT(COOKIELIST, OBJECTPOINT, 135),
1005 /* ignore Content-Length */
1006 CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
1008 /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
1009 response. Typically used for FTP-SSL purposes but is not restricted to
1010 that. libcurl will then instead use the same IP address it used for the
1011 control connection. */
1012 CINIT(FTP_SKIP_PASV_IP, LONG, 137),
1014 /* Select "file method" to use when doing FTP, see the curl_ftpmethod
1015 above. */
1016 CINIT(FTP_FILEMETHOD, LONG, 138),
1018 /* Local port number to bind the socket to */
1019 CINIT(LOCALPORT, LONG, 139),
1021 /* Number of ports to try, including the first one set with LOCALPORT.
1022 Thus, setting it to 1 will make no additional attempts but the first.
1024 CINIT(LOCALPORTRANGE, LONG, 140),
1026 /* no transfer, set up connection and let application use the socket by
1027 extracting it with CURLINFO_LASTSOCKET */
1028 CINIT(CONNECT_ONLY, LONG, 141),
1030 /* Function that will be called to convert from the
1031 network encoding (instead of using the iconv calls in libcurl) */
1032 CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),
1034 /* Function that will be called to convert to the
1035 network encoding (instead of using the iconv calls in libcurl) */
1036 CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),
1038 /* Function that will be called to convert from UTF8
1039 (instead of using the iconv calls in libcurl)
1040 Note that this is used only for SSL certificate processing */
1041 CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
1043 /* if the connection proceeds too quickly then need to slow it down */
1044 /* limit-rate: maximum number of bytes per second to send or receive */
1045 CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
1046 CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
1048 /* Pointer to command string to send if USER/PASS fails. */
1049 CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),
1051 /* callback function for setting socket options */
1052 CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
1053 CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
1055 /* set to 0 to disable session ID re-use for this transfer, default is
1056 enabled (== 1) */
1057 CINIT(SSL_SESSIONID_CACHE, LONG, 150),
1059 /* allowed SSH authentication methods */
1060 CINIT(SSH_AUTH_TYPES, LONG, 151),
1062 /* Used by scp/sftp to do public/private key authentication */
1063 CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),
1064 CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),
1066 /* Send CCC (Clear Command Channel) after authentication */
1067 CINIT(FTP_SSL_CCC, LONG, 154),
1069 CURLOPT_LASTENTRY /* the last unused */
1070 } CURLoption;
1072 /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
1073 name resolves addresses using more than one IP protocol version, this
1074 option might be handy to force libcurl to use a specific IP version. */
1075 #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
1076 versions that your system allows */
1077 #define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */
1078 #define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */
1080 /* three convenient "aliases" that follow the name scheme better */
1081 #define CURLOPT_WRITEDATA CURLOPT_FILE
1082 #define CURLOPT_READDATA CURLOPT_INFILE
1083 #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
1085 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
1086 the obsolete stuff removed! */
1087 #else
1088 /* This is set if CURL_NO_OLDIES is defined at compile-time */
1089 #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
1090 #endif
1093 /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
1094 enum {
1095 CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
1096 like the library to choose the best possible
1097 for us! */
1098 CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */
1099 CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */
1101 CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
1104 /* These enums are for use with the CURLOPT_NETRC option. */
1105 enum CURL_NETRC_OPTION {
1106 CURL_NETRC_IGNORED, /* The .netrc will never be read.
1107 * This is the default. */
1108 CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred
1109 * to one in the .netrc. */
1110 CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored.
1111 * Unless one is set programmatically, the .netrc
1112 * will be queried. */
1113 CURL_NETRC_LAST
1116 enum {
1117 CURL_SSLVERSION_DEFAULT,
1118 CURL_SSLVERSION_TLSv1,
1119 CURL_SSLVERSION_SSLv2,
1120 CURL_SSLVERSION_SSLv3,
1122 CURL_SSLVERSION_LAST /* never use, keep last */
1126 typedef enum {
1127 CURL_TIMECOND_NONE,
1129 CURL_TIMECOND_IFMODSINCE,
1130 CURL_TIMECOND_IFUNMODSINCE,
1131 CURL_TIMECOND_LASTMOD,
1133 CURL_TIMECOND_LAST
1134 } curl_TimeCond;
1136 #ifdef __cplusplus
1138 #endif
1140 #if defined __BEOS__ || defined __HAIKU__
1141 #include <support/SupportDefs.h>
1142 #endif
1144 #ifdef __cplusplus
1145 extern "C" {
1146 #endif
1148 /* curl_strequal() and curl_strnequal() are subject for removal in a future
1149 libcurl, see lib/README.curlx for details */
1150 CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
1151 CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
1153 /* name is uppercase CURLFORM_<name> */
1154 #ifdef CFINIT
1155 #undef CFINIT
1156 #endif
1158 #ifdef CURL_ISOCPP
1159 #define CFINIT(name) CURLFORM_ ## name
1160 #else
1161 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
1162 #define CFINIT(name) CURLFORM_/**/name
1163 #endif
1165 typedef enum {
1166 CFINIT(NOTHING), /********* the first one is unused ************/
1168 /* */
1169 CFINIT(COPYNAME),
1170 CFINIT(PTRNAME),
1171 CFINIT(NAMELENGTH),
1172 CFINIT(COPYCONTENTS),
1173 CFINIT(PTRCONTENTS),
1174 CFINIT(CONTENTSLENGTH),
1175 CFINIT(FILECONTENT),
1176 CFINIT(ARRAY),
1177 CFINIT(OBSOLETE),
1178 CFINIT(FILE),
1180 CFINIT(BUFFER),
1181 CFINIT(BUFFERPTR),
1182 CFINIT(BUFFERLENGTH),
1184 CFINIT(CONTENTTYPE),
1185 CFINIT(CONTENTHEADER),
1186 CFINIT(FILENAME),
1187 CFINIT(END),
1188 CFINIT(OBSOLETE2),
1190 CURLFORM_LASTENTRY /* the last unusued */
1191 } CURLformoption;
1193 #undef CFINIT /* done */
1195 /* structure to be used as parameter for CURLFORM_ARRAY */
1196 struct curl_forms {
1197 CURLformoption option;
1198 const char *value;
1201 /* use this for multipart formpost building */
1202 /* Returns code for curl_formadd()
1204 * Returns:
1205 * CURL_FORMADD_OK on success
1206 * CURL_FORMADD_MEMORY if the FormInfo allocation fails
1207 * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
1208 * CURL_FORMADD_NULL if a null pointer was given for a char
1209 * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
1210 * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
1211 * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
1212 * CURL_FORMADD_MEMORY if a HttpPost struct cannot be allocated
1213 * CURL_FORMADD_MEMORY if some allocation for string copying failed.
1214 * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
1216 ***************************************************************************/
1217 typedef enum {
1218 CURL_FORMADD_OK, /* first, no error */
1220 CURL_FORMADD_MEMORY,
1221 CURL_FORMADD_OPTION_TWICE,
1222 CURL_FORMADD_NULL,
1223 CURL_FORMADD_UNKNOWN_OPTION,
1224 CURL_FORMADD_INCOMPLETE,
1225 CURL_FORMADD_ILLEGAL_ARRAY,
1226 CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
1228 CURL_FORMADD_LAST /* last */
1229 } CURLFORMcode;
1232 * NAME curl_formadd()
1234 * DESCRIPTION
1236 * Pretty advanved function for building multi-part formposts. Each invoke
1237 * adds one part that together construct a full post. Then use
1238 * CURLOPT_HTTPPOST to send it off to libcurl.
1240 CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
1241 struct curl_httppost **last_post,
1242 ...);
1245 * callback function for curl_formget()
1246 * The void *arg pointer will be the one passed as second argument to curl_formget().
1247 * The character buffer passed to it must not be freed.
1248 * Should return the buffer length passed to it as the argument "len" on success.
1250 typedef size_t (*curl_formget_callback)(void *arg, const char *buf, size_t len);
1253 * NAME curl_formget()
1255 * DESCRIPTION
1257 * Serialize a curl_httppost struct built with curl_formadd().
1258 * Accepts a void pointer as second argument which will be passed to
1259 * the curl_formget_callback function.
1260 * Returns 0 on success.
1262 CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
1263 curl_formget_callback append);
1265 * NAME curl_formfree()
1267 * DESCRIPTION
1269 * Free a multipart formpost previously built with curl_formadd().
1271 CURL_EXTERN void curl_formfree(struct curl_httppost *form);
1274 * NAME curl_getenv()
1276 * DESCRIPTION
1278 * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
1279 * complete. DEPRECATED - see lib/README.curlx
1281 CURL_EXTERN char *curl_getenv(const char *variable);
1284 * NAME curl_version()
1286 * DESCRIPTION
1288 * Returns a static ascii string of the libcurl version.
1290 CURL_EXTERN char *curl_version(void);
1293 * NAME curl_easy_escape()
1295 * DESCRIPTION
1297 * Escapes URL strings (converts all letters consider illegal in URLs to their
1298 * %XX versions). This function returns a new allocated string or NULL if an
1299 * error occurred.
1301 CURL_EXTERN char *curl_easy_escape(CURL *handle,
1302 const char *string,
1303 int length);
1305 /* the previous version: */
1306 CURL_EXTERN char *curl_escape(const char *string,
1307 int length);
1311 * NAME curl_easy_unescape()
1313 * DESCRIPTION
1315 * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
1316 * versions). This function returns a new allocated string or NULL if an error
1317 * occurred.
1318 * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
1319 * converted into the host encoding.
1321 CURL_EXTERN char *curl_easy_unescape(CURL *handle,
1322 const char *string,
1323 int length,
1324 int *outlength);
1326 /* the previous version */
1327 CURL_EXTERN char *curl_unescape(const char *string,
1328 int length);
1331 * NAME curl_free()
1333 * DESCRIPTION
1335 * Provided for de-allocation in the same translation unit that did the
1336 * allocation. Added in libcurl 7.10
1338 CURL_EXTERN void curl_free(void *p);
1341 * NAME curl_global_init()
1343 * DESCRIPTION
1345 * curl_global_init() should be invoked exactly once for each application that
1346 * uses libcurl
1348 CURL_EXTERN CURLcode curl_global_init(long flags);
1351 * NAME curl_global_init_mem()
1353 * DESCRIPTION
1355 * curl_global_init() or curl_global_init_mem() should be invoked exactly once
1356 * for each application that uses libcurl. This function can be used to
1357 * initialize libcurl and set user defined memory management callback
1358 * functions. Users can implement memory management routines to check for
1359 * memory leaks, check for mis-use of the curl library etc. User registered
1360 * callback routines with be invoked by this library instead of the system
1361 * memory management routines like malloc, free etc.
1363 CURL_EXTERN CURLcode curl_global_init_mem(long flags,
1364 curl_malloc_callback m,
1365 curl_free_callback f,
1366 curl_realloc_callback r,
1367 curl_strdup_callback s,
1368 curl_calloc_callback c);
1371 * NAME curl_global_cleanup()
1373 * DESCRIPTION
1375 * curl_global_cleanup() should be invoked exactly once for each application
1376 * that uses libcurl
1378 CURL_EXTERN void curl_global_cleanup(void);
1380 /* linked-list structure for the CURLOPT_QUOTE option (and other) */
1381 struct curl_slist {
1382 char *data;
1383 struct curl_slist *next;
1387 * NAME curl_slist_append()
1389 * DESCRIPTION
1391 * Appends a string to a linked list. If no list exists, it will be created
1392 * first. Returns the new list, after appending.
1394 CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
1395 const char *);
1398 * NAME curl_slist_free_all()
1400 * DESCRIPTION
1402 * free a previously built curl_slist.
1404 CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
1407 * NAME curl_getdate()
1409 * DESCRIPTION
1411 * Returns the time, in seconds since 1 Jan 1970 of the time string given in
1412 * the first argument. The time argument in the second parameter is unused
1413 * and should be set to NULL.
1415 CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
1417 #define CURLINFO_STRING 0x100000
1418 #define CURLINFO_LONG 0x200000
1419 #define CURLINFO_DOUBLE 0x300000
1420 #define CURLINFO_SLIST 0x400000
1421 #define CURLINFO_MASK 0x0fffff
1422 #define CURLINFO_TYPEMASK 0xf00000
1424 typedef enum {
1425 CURLINFO_NONE, /* first, never use this */
1426 CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1,
1427 CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2,
1428 CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3,
1429 CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4,
1430 CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5,
1431 CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
1432 CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7,
1433 CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8,
1434 CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9,
1435 CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10,
1436 CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11,
1437 CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12,
1438 CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13,
1439 CURLINFO_FILETIME = CURLINFO_LONG + 14,
1440 CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15,
1441 CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16,
1442 CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
1443 CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18,
1444 CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19,
1445 CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20,
1446 CURLINFO_PRIVATE = CURLINFO_STRING + 21,
1447 CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22,
1448 CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23,
1449 CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24,
1450 CURLINFO_OS_ERRNO = CURLINFO_LONG + 25,
1451 CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26,
1452 CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27,
1453 CURLINFO_COOKIELIST = CURLINFO_SLIST + 28,
1454 CURLINFO_LASTSOCKET = CURLINFO_LONG + 29,
1455 CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30,
1456 /* Fill in new entries below here! */
1458 CURLINFO_LASTONE = 30
1459 } CURLINFO;
1461 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
1462 CURLINFO_HTTP_CODE */
1463 #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
1465 typedef enum {
1466 CURLCLOSEPOLICY_NONE, /* first, never use this */
1468 CURLCLOSEPOLICY_OLDEST,
1469 CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
1470 CURLCLOSEPOLICY_LEAST_TRAFFIC,
1471 CURLCLOSEPOLICY_SLOWEST,
1472 CURLCLOSEPOLICY_CALLBACK,
1474 CURLCLOSEPOLICY_LAST /* last, never use this */
1475 } curl_closepolicy;
1477 #define CURL_GLOBAL_SSL (1<<0)
1478 #define CURL_GLOBAL_WIN32 (1<<1)
1479 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
1480 #define CURL_GLOBAL_NOTHING 0
1481 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
1484 /*****************************************************************************
1485 * Setup defines, protos etc for the sharing stuff.
1488 /* Different data locks for a single share */
1489 typedef enum {
1490 CURL_LOCK_DATA_NONE = 0,
1491 /* CURL_LOCK_DATA_SHARE is used internaly to say that
1492 * the locking is just made to change the internal state of the share
1493 * itself.
1495 CURL_LOCK_DATA_SHARE,
1496 CURL_LOCK_DATA_COOKIE,
1497 CURL_LOCK_DATA_DNS,
1498 CURL_LOCK_DATA_SSL_SESSION,
1499 CURL_LOCK_DATA_CONNECT,
1500 CURL_LOCK_DATA_LAST
1501 } curl_lock_data;
1503 /* Different lock access types */
1504 typedef enum {
1505 CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */
1506 CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
1507 CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
1508 CURL_LOCK_ACCESS_LAST /* never use */
1509 } curl_lock_access;
1511 typedef void (*curl_lock_function)(CURL *handle,
1512 curl_lock_data data,
1513 curl_lock_access locktype,
1514 void *userptr);
1515 typedef void (*curl_unlock_function)(CURL *handle,
1516 curl_lock_data data,
1517 void *userptr);
1519 typedef void CURLSH;
1521 typedef enum {
1522 CURLSHE_OK, /* all is fine */
1523 CURLSHE_BAD_OPTION, /* 1 */
1524 CURLSHE_IN_USE, /* 2 */
1525 CURLSHE_INVALID, /* 3 */
1526 CURLSHE_NOMEM, /* out of memory */
1527 CURLSHE_LAST /* never use */
1528 } CURLSHcode;
1530 typedef enum {
1531 CURLSHOPT_NONE, /* don't use */
1532 CURLSHOPT_SHARE, /* specify a data type to share */
1533 CURLSHOPT_UNSHARE, /* specify shich data type to stop sharing */
1534 CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */
1535 CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
1536 CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock
1537 callback functions */
1538 CURLSHOPT_LAST /* never use */
1539 } CURLSHoption;
1541 CURL_EXTERN CURLSH *curl_share_init(void);
1542 CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
1543 CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
1545 /****************************************************************************
1546 * Structures for querying information about the curl library at runtime.
1549 typedef enum {
1550 CURLVERSION_FIRST,
1551 CURLVERSION_SECOND,
1552 CURLVERSION_THIRD,
1553 CURLVERSION_FOURTH,
1554 CURLVERSION_LAST /* never actually use this */
1555 } CURLversion;
1557 /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
1558 basicly all programs ever, that want to get version information. It is
1559 meant to be a built-in version number for what kind of struct the caller
1560 expects. If the struct ever changes, we redefine the NOW to another enum
1561 from above. */
1562 #define CURLVERSION_NOW CURLVERSION_FOURTH
1564 typedef struct {
1565 CURLversion age; /* age of the returned struct */
1566 const char *version; /* LIBCURL_VERSION */
1567 unsigned int version_num; /* LIBCURL_VERSION_NUM */
1568 const char *host; /* OS/host/cpu/machine when configured */
1569 int features; /* bitmask, see defines below */
1570 const char *ssl_version; /* human readable string */
1571 long ssl_version_num; /* not used anymore, always 0 */
1572 const char *libz_version; /* human readable string */
1573 /* protocols is terminated by an entry with a NULL protoname */
1574 const char * const *protocols;
1576 /* The fields below this were added in CURLVERSION_SECOND */
1577 const char *ares;
1578 int ares_num;
1580 /* This field was added in CURLVERSION_THIRD */
1581 const char *libidn;
1583 /* These field were added in CURLVERSION_FOURTH */
1585 /* Same as '_libiconv_version' if built with HAVE_ICONV */
1586 int iconv_ver_num;
1588 const char *libssh_version; /* human readable string */
1590 } curl_version_info_data;
1592 #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */
1593 #define CURL_VERSION_KERBEROS4 (1<<1) /* kerberos auth is supported */
1594 #define CURL_VERSION_SSL (1<<2) /* SSL options are present */
1595 #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */
1596 #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */
1597 #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */
1598 #define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */
1599 #define CURL_VERSION_ASYNCHDNS (1<<7) /* asynchronous dns resolves */
1600 #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */
1601 #define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */
1602 #define CURL_VERSION_IDN (1<<10) /* International Domain Names support */
1603 #define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */
1604 #define CURL_VERSION_CONV (1<<12) /* character conversions are
1605 supported */
1608 * NAME curl_version_info()
1610 * DESCRIPTION
1612 * This function returns a pointer to a static copy of the version info
1613 * struct. See above.
1615 CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
1618 * NAME curl_easy_strerror()
1620 * DESCRIPTION
1622 * The curl_easy_strerror function may be used to turn a CURLcode value
1623 * into the equivalent human readable error string. This is useful
1624 * for printing meaningful error messages.
1626 CURL_EXTERN const char *curl_easy_strerror(CURLcode);
1629 * NAME curl_share_strerror()
1631 * DESCRIPTION
1633 * The curl_share_strerror function may be used to turn a CURLSHcode value
1634 * into the equivalent human readable error string. This is useful
1635 * for printing meaningful error messages.
1637 CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
1639 #ifdef __cplusplus
1641 #endif
1643 /* unfortunately, the easy.h and multi.h include files need options and info
1644 stuff before they can be included! */
1645 #include "easy.h" /* nothing in curl is fun without the easy stuff */
1646 #include "multi.h"
1648 #endif /* __CURL_CURL_H */