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