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