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