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