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