1 #ifndef __CURL_CURL_H
2 #define __CURL_CURL_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2009, 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.379 2009-03-02 23:05:31 bagder Exp $
24  ***************************************************************************/
25 
26 /*
27  * If you have libcurl problems, all docs and details are found here:
28  *   http://curl.haxx.se/libcurl/
29  *
30  * curl-library mailing list subscription and unsubscription web interface:
31  *   http://cool.haxx.se/mailman/listinfo/curl-library/
32  */
33 
34 #include "curlver.h"         /* libcurl version defines   */
35 #include "curl/curlbuild.h"  /* libcurl build definitions */
36 #include "curlrules.h"       /* libcurl rules enforcement */
37 
38 /*
39  * Define WIN32 when build target is Win32 API
40  */
41 
42 #if (defined(_WIN32) || defined(__WIN32__)) && \
43      !defined(WIN32) && !defined(__SYMBIAN32__)
44 #define WIN32
45 #endif
46 
47 #include <stdio.h>
48 #include <limits.h>
49 
50 /* The include stuff here below is mainly for time_t! */
51 #ifdef vms
52 # include <types.h>
53 # include <time.h>
54 #else
55 # include <sys/types.h>
56 # include <time.h>
57 #endif /* defined (vms) */
58 
59 #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
60   !defined(__CYGWIN__) || defined(__MINGW32__)
61 #if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
62 /* The check above prevents the winsock2 inclusion if winsock.h already was
63    included, since they can't co-exist without problems */
64 #include <winsock2.h>
65 #include <ws2tcpip.h>
66 #endif
67 #else
68 
69 /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
70    libc5-based Linux systems. Only include it on system that are known to
71    require it! */
72 #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
73     defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY)
74 #include <sys/select.h>
75 #endif
76 
77 #ifndef _WIN32_WCE
78 #include <sys/socket.h>
79 #endif
80 #if !defined(WIN32) && !defined(__WATCOMC__)
81 #include <sys/time.h>
82 #endif
83 #include <sys/types.h>
84 #endif
85 
86 #ifdef __BEOS__
87 #include <support/SupportDefs.h>
88 #endif
89 
90 #ifdef  __cplusplus
91 extern "C" {
92 #endif
93 
94 typedef void CURL;
95 
96 /*
97  * Decorate exportable functions for Win32 and Symbian OS DLL linking.
98  * This avoids using a .def file for building libcurl.dll.
99  */
100 #if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \
101      !defined(CURL_STATICLIB)
102 #if defined(BUILDING_LIBCURL)
103 #define CURL_EXTERN  __declspec(dllexport)
104 #else
105 #define CURL_EXTERN  __declspec(dllimport)
106 #endif
107 #else
108 
109 #ifdef CURL_HIDDEN_SYMBOLS
110 /*
111  * This definition is used to make external definitions visible in the
112  * shared library when symbols are hidden by default.  It makes no
113  * difference when compiling applications whether this is set or not,
114  * only when compiling the library.
115  */
116 #define CURL_EXTERN CURL_EXTERN_SYMBOL
117 #else
118 #define CURL_EXTERN
119 #endif
120 #endif
121 
122 #ifndef curl_socket_typedef
123 /* socket typedef */
124 #ifdef WIN32
125 typedef SOCKET curl_socket_t;
126 #define CURL_SOCKET_BAD INVALID_SOCKET
127 #else
128 typedef int curl_socket_t;
129 #define CURL_SOCKET_BAD -1
130 #endif
131 #define curl_socket_typedef
132 #endif /* curl_socket_typedef */
133 
134 struct curl_httppost {
135   struct curl_httppost *next;       /* next entry in the list */
136   char *name;                       /* pointer to allocated name */
137   long namelength;                  /* length of name length */
138   char *contents;                   /* pointer to allocated data contents */
139   long contentslength;              /* length of contents field */
140   char *buffer;                     /* pointer to allocated buffer contents */
141   long bufferlength;                /* length of buffer field */
142   char *contenttype;                /* Content-Type */
143   struct curl_slist* contentheader; /* list of extra headers for this form */
144   struct curl_httppost *more;       /* if one field name has more than one
145                                        file, this link should link to following
146                                        files */
147   long flags;                       /* as defined below */
148 #define HTTPPOST_FILENAME (1<<0)    /* specified content is a file name */
149 #define HTTPPOST_READFILE (1<<1)    /* specified content is a file name */
150 #define HTTPPOST_PTRNAME (1<<2)     /* name is only stored pointer
151                                        do not free in formfree */
152 #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
153                                        do not free in formfree */
154 #define HTTPPOST_BUFFER (1<<4)      /* upload file from buffer */
155 #define HTTPPOST_PTRBUFFER (1<<5)   /* upload file from pointer contents */
156 #define HTTPPOST_CALLBACK (1<<6)    /* upload file contents by using the
157                                        regular read callback to get the data
158                                        and pass the given pointer as custom
159                                        pointer */
160 
161   char *showfilename;               /* The file name to show. If not set, the
162                                        actual file name will be used (if this
163                                        is a file part) */
164   void *userp;                      /* custom pointer used for
165                                        HTTPPOST_CALLBACK posts */
166 };
167 
168 typedef int (*curl_progress_callback)(void *clientp,
169                                       double dltotal,
170                                       double dlnow,
171                                       double ultotal,
172                                       double ulnow);
173 
174 #ifndef CURL_MAX_WRITE_SIZE
175   /* Tests have proven that 20K is a very bad buffer size for uploads on
176      Windows, while 16K for some odd reason performed a lot better.
177      We do the ifndef check to allow this value to easier be changed at build
178      time for those who feel adventurous. */
179 #define CURL_MAX_WRITE_SIZE 16384
180 #endif
181 /* This is a magic return code for the write callback that, when returned,
182    will signal libcurl to pause receiving on the current transfer. */
183 #define CURL_WRITEFUNC_PAUSE 0x10000001
184 typedef size_t (*curl_write_callback)(char *buffer,
185                                       size_t size,
186                                       size_t nitems,
187                                       void *outstream);
188 
189 /* This is a return code for the read callback that, when returned, will
190    signal libcurl to immediately abort the current transfer. */
191 #define CURL_READFUNC_ABORT 0x10000000
192 /* This is a return code for the read callback that, when returned, will
193    signal libcurl to pause sending data on the current transfer. */
194 #define CURL_READFUNC_PAUSE 0x10000001
195 typedef int (*curl_seek_callback)(void *instream,
196                                   curl_off_t offset,
197                                   int origin); /* 'whence' */
198 
199 typedef size_t (*curl_read_callback)(char *buffer,
200                                       size_t size,
201                                       size_t nitems,
202                                       void *instream);
203 
204 typedef enum  {
205   CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
206   CURLSOCKTYPE_LAST   /* never use */
207 } curlsocktype;
208 
209 typedef int (*curl_sockopt_callback)(void *clientp,
210                                      curl_socket_t curlfd,
211                                      curlsocktype purpose);
212 
213 struct curl_sockaddr {
214   int family;
215   int socktype;
216   int protocol;
217   unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it
218                            turned really ugly and painful on the systems that
219                            lack this type */
220   struct sockaddr addr;
221 };
222 
223 typedef curl_socket_t
224 (*curl_opensocket_callback)(void *clientp,
225                             curlsocktype purpose,
226                             struct curl_sockaddr *address);
227 
228 #ifndef CURL_NO_OLDIES
229   /* not used since 7.10.8, will be removed in a future release */
230 typedef int (*curl_passwd_callback)(void *clientp,
231                                     const char *prompt,
232                                     char *buffer,
233                                     int buflen);
234 #endif
235 
236 typedef enum {
237   CURLIOE_OK,            /* I/O operation successful */
238   CURLIOE_UNKNOWNCMD,    /* command was unknown to callback */
239   CURLIOE_FAILRESTART,   /* failed to restart the read */
240   CURLIOE_LAST           /* never use */
241 } curlioerr;
242 
243 typedef enum  {
244   CURLIOCMD_NOP,         /* no operation */
245   CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
246   CURLIOCMD_LAST         /* never use */
247 } curliocmd;
248 
249 typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
250                                          int cmd,
251                                          void *clientp);
252 
253 /*
254  * The following typedef's are signatures of malloc, free, realloc, strdup and
255  * calloc respectively.  Function pointers of these types can be passed to the
256  * curl_global_init_mem() function to set user defined memory management
257  * callback routines.
258  */
259 typedef void *(*curl_malloc_callback)(size_t size);
260 typedef void (*curl_free_callback)(void *ptr);
261 typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
262 typedef char *(*curl_strdup_callback)(const char *str);
263 typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
264 
265 /* the kind of data that is passed to information_callback*/
266 typedef enum {
267   CURLINFO_TEXT = 0,
268   CURLINFO_HEADER_IN,    /* 1 */
269   CURLINFO_HEADER_OUT,   /* 2 */
270   CURLINFO_DATA_IN,      /* 3 */
271   CURLINFO_DATA_OUT,     /* 4 */
272   CURLINFO_SSL_DATA_IN,  /* 5 */
273   CURLINFO_SSL_DATA_OUT, /* 6 */
274   CURLINFO_END
275 } curl_infotype;
276 
277 typedef int (*curl_debug_callback)
278        (CURL *handle,      /* the handle/transfer this concerns */
279         curl_infotype type, /* what kind of data */
280         char *data,        /* points to the data */
281         size_t size,       /* size of the data pointed to */
282         void *userptr);    /* whatever the user please */
283 
284 /* All possible error codes from all sorts of curl functions. Future versions
285    may return other values, stay prepared.
286 
287    Always add new return codes last. Never *EVER* remove any. The return
288    codes must remain the same!
289  */
290 
291 typedef enum {
292   CURLE_OK = 0,
293   CURLE_UNSUPPORTED_PROTOCOL,    /* 1 */
294   CURLE_FAILED_INIT,             /* 2 */
295   CURLE_URL_MALFORMAT,           /* 3 */
296   CURLE_OBSOLETE4,               /* 4 - NOT USED */
297   CURLE_COULDNT_RESOLVE_PROXY,   /* 5 */
298   CURLE_COULDNT_RESOLVE_HOST,    /* 6 */
299   CURLE_COULDNT_CONNECT,         /* 7 */
300   CURLE_FTP_WEIRD_SERVER_REPLY,  /* 8 */
301   CURLE_REMOTE_ACCESS_DENIED,    /* 9 a service was denied by the server
302                                     due to lack of access - when login fails
303                                     this is not returned. */
304   CURLE_OBSOLETE10,              /* 10 - NOT USED */
305   CURLE_FTP_WEIRD_PASS_REPLY,    /* 11 */
306   CURLE_OBSOLETE12,              /* 12 - NOT USED */
307   CURLE_FTP_WEIRD_PASV_REPLY,    /* 13 */
308   CURLE_FTP_WEIRD_227_FORMAT,    /* 14 */
309   CURLE_FTP_CANT_GET_HOST,       /* 15 */
310   CURLE_OBSOLETE16,              /* 16 - NOT USED */
311   CURLE_FTP_COULDNT_SET_TYPE,    /* 17 */
312   CURLE_PARTIAL_FILE,            /* 18 */
313   CURLE_FTP_COULDNT_RETR_FILE,   /* 19 */
314   CURLE_OBSOLETE20,              /* 20 - NOT USED */
315   CURLE_QUOTE_ERROR,             /* 21 - quote command failure */
316   CURLE_HTTP_RETURNED_ERROR,     /* 22 */
317   CURLE_WRITE_ERROR,             /* 23 */
318   CURLE_OBSOLETE24,              /* 24 - NOT USED */
319   CURLE_UPLOAD_FAILED,           /* 25 - failed upload "command" */
320   CURLE_READ_ERROR,              /* 26 - couldn't open/read from file */
321   CURLE_OUT_OF_MEMORY,           /* 27 */
322   /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
323            instead of a memory allocation error if CURL_DOES_CONVERSIONS
324            is defined
325   */
326   CURLE_OPERATION_TIMEDOUT,      /* 28 - the timeout time was reached */
327   CURLE_OBSOLETE29,              /* 29 - NOT USED */
328   CURLE_FTP_PORT_FAILED,         /* 30 - FTP PORT operation failed */
329   CURLE_FTP_COULDNT_USE_REST,    /* 31 - the REST command failed */
330   CURLE_OBSOLETE32,              /* 32 - NOT USED */
331   CURLE_RANGE_ERROR,             /* 33 - RANGE "command" didn't work */
332   CURLE_HTTP_POST_ERROR,         /* 34 */
333   CURLE_SSL_CONNECT_ERROR,       /* 35 - wrong when connecting with SSL */
334   CURLE_BAD_DOWNLOAD_RESUME,     /* 36 - couldn't resume download */
335   CURLE_FILE_COULDNT_READ_FILE,  /* 37 */
336   CURLE_LDAP_CANNOT_BIND,        /* 38 */
337   CURLE_LDAP_SEARCH_FAILED,      /* 39 */
338   CURLE_OBSOLETE40,              /* 40 - NOT USED */
339   CURLE_FUNCTION_NOT_FOUND,      /* 41 */
340   CURLE_ABORTED_BY_CALLBACK,     /* 42 */
341   CURLE_BAD_FUNCTION_ARGUMENT,   /* 43 */
342   CURLE_OBSOLETE44,              /* 44 - NOT USED */
343   CURLE_INTERFACE_FAILED,        /* 45 - CURLOPT_INTERFACE failed */
344   CURLE_OBSOLETE46,              /* 46 - NOT USED */
345   CURLE_TOO_MANY_REDIRECTS ,     /* 47 - catch endless re-direct loops */
346   CURLE_UNKNOWN_TELNET_OPTION,   /* 48 - User specified an unknown option */
347   CURLE_TELNET_OPTION_SYNTAX ,   /* 49 - Malformed telnet option */
348   CURLE_OBSOLETE50,              /* 50 - NOT USED */
349   CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
350                                      wasn't verified fine */
351   CURLE_GOT_NOTHING,             /* 52 - when this is a specific error */
352   CURLE_SSL_ENGINE_NOTFOUND,     /* 53 - SSL crypto engine not found */
353   CURLE_SSL_ENGINE_SETFAILED,    /* 54 - can not set SSL crypto engine as
354                                     default */
355   CURLE_SEND_ERROR,              /* 55 - failed sending network data */
356   CURLE_RECV_ERROR,              /* 56 - failure in receiving network data */
357   CURLE_OBSOLETE57,              /* 57 - NOT IN USE */
358   CURLE_SSL_CERTPROBLEM,         /* 58 - problem with the local certificate */
359   CURLE_SSL_CIPHER,              /* 59 - couldn't use specified cipher */
360   CURLE_SSL_CACERT,              /* 60 - problem with the CA cert (path?) */
361   CURLE_BAD_CONTENT_ENCODING,    /* 61 - Unrecognized transfer encoding */
362   CURLE_LDAP_INVALID_URL,        /* 62 - Invalid LDAP URL */
363   CURLE_FILESIZE_EXCEEDED,       /* 63 - Maximum file size exceeded */
364   CURLE_USE_SSL_FAILED,          /* 64 - Requested FTP SSL level failed */
365   CURLE_SEND_FAIL_REWIND,        /* 65 - Sending the data requires a rewind
366                                     that failed */
367   CURLE_SSL_ENGINE_INITFAILED,   /* 66 - failed to initialise ENGINE */
368   CURLE_LOGIN_DENIED,            /* 67 - user, password or similar was not
369                                     accepted and we failed to login */
370   CURLE_TFTP_NOTFOUND,           /* 68 - file not found on server */
371   CURLE_TFTP_PERM,               /* 69 - permission problem on server */
372   CURLE_REMOTE_DISK_FULL,        /* 70 - out of disk space on server */
373   CURLE_TFTP_ILLEGAL,            /* 71 - Illegal TFTP operation */
374   CURLE_TFTP_UNKNOWNID,          /* 72 - Unknown transfer ID */
375   CURLE_REMOTE_FILE_EXISTS,      /* 73 - File already exists */
376   CURLE_TFTP_NOSUCHUSER,         /* 74 - No such user */
377   CURLE_CONV_FAILED,             /* 75 - conversion failed */
378   CURLE_CONV_REQD,               /* 76 - caller must register conversion
379                                     callbacks using curl_easy_setopt options
380                                     CURLOPT_CONV_FROM_NETWORK_FUNCTION,
381                                     CURLOPT_CONV_TO_NETWORK_FUNCTION, and
382                                     CURLOPT_CONV_FROM_UTF8_FUNCTION */
383   CURLE_SSL_CACERT_BADFILE,      /* 77 - could not load CACERT file, missing
384                                     or wrong format */
385   CURLE_REMOTE_FILE_NOT_FOUND,   /* 78 - remote file not found */
386   CURLE_SSH,                     /* 79 - error from the SSH layer, somewhat
387                                     generic so the error message will be of
388                                     interest when this has happened */
389 
390   CURLE_SSL_SHUTDOWN_FAILED,     /* 80 - Failed to shut down the SSL
391                                     connection */
392   CURLE_AGAIN,                   /* 81 - socket is not ready for send/recv,
393                                     wait till it's ready and try again (Added
394                                     in 7.18.2) */
395   CURLE_SSL_CRL_BADFILE,         /* 82 - could not load CRL file, missing or
396                                     wrong format (Added in 7.19.0) */
397   CURLE_SSL_ISSUER_ERROR,        /* 83 - Issuer check failed.  (Added in
398                                     7.19.0) */
399   CURL_LAST /* never use! */
400 } CURLcode;
401 
402 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
403                           the obsolete stuff removed! */
404 
405 /* Backwards compatibility with older names */
406 
407 /* The following were added in 7.17.1 */
408 /* These are scheduled to disappear by 2009 */
409 #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION
410 
411 /* The following were added in 7.17.0 */
412 /* These are scheduled to disappear by 2009 */
413 #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* noone should be using this! */
414 #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
415 #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
416 #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
417 #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
418 #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
419 #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
420 #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
421 #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
422 #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
423 #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
424 #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
425 #define CURLE_URL_MALFORMAT_USER CURLE_OBSOLETE4
426 
427 #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
428 #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
429 #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
430 #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
431 #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
432 #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
433 #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
434 
435 /* The following were added earlier */
436 
437 #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT
438 
439 #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
440 #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
441 #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
442 
443 #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
444 #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
445 
446 /* This was the error code 50 in 7.7.3 and a few earlier versions, this
447    is no longer used by libcurl but is instead #defined here only to not
448    make programs break */
449 #define CURLE_ALREADY_COMPLETE 99999
450 
451 #endif /*!CURL_NO_OLDIES*/
452 
453 /* This prototype applies to all conversion callbacks */
454 typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
455 
456 typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl,    /* easy handle */
457                                           void *ssl_ctx, /* actually an
458                                                             OpenSSL SSL_CTX */
459                                           void *userptr);
460 
461 typedef enum {
462   CURLPROXY_HTTP = 0,   /* added in 7.10, new in 7.19.4 default is to use
463                            CONNECT HTTP/1.1 */
464   CURLPROXY_HTTP_1_0 = 1,   /* added in 7.19.4, force to use CONNECT
465                                HTTP/1.0  */
466   CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already
467                            in 7.10 */
468   CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
469   CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */
470   CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the
471                                    host name rather than the IP address. added
472                                    in 7.18.0 */
473 } curl_proxytype;  /* this enum was added in 7.10 */
474 
475 #define CURLAUTH_NONE         0       /* nothing */
476 #define CURLAUTH_BASIC        (1<<0)  /* Basic (default) */
477 #define CURLAUTH_DIGEST       (1<<1)  /* Digest */
478 #define CURLAUTH_GSSNEGOTIATE (1<<2)  /* GSS-Negotiate */
479 #define CURLAUTH_NTLM         (1<<3)  /* NTLM */
480 #define CURLAUTH_DIGEST_IE    (1<<4)  /* Digest with IE flavour */
481 #define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)  /* all fine types set */
482 #define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
483 
484 #define CURLSSH_AUTH_ANY       ~0     /* all types supported by the server */
485 #define CURLSSH_AUTH_NONE      0      /* none allowed, silly but complete */
486 #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
487 #define CURLSSH_AUTH_PASSWORD  (1<<1) /* password */
488 #define CURLSSH_AUTH_HOST      (1<<2) /* host key files */
489 #define CURLSSH_AUTH_KEYBOARD  (1<<3) /* keyboard interactive */
490 #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
491 
492 #define CURL_ERROR_SIZE 256
493 
494 /* parameter for the CURLOPT_USE_SSL option */
495 typedef enum {
496   CURLUSESSL_NONE,    /* do not attempt to use SSL */
497   CURLUSESSL_TRY,     /* try using SSL, proceed anyway otherwise */
498   CURLUSESSL_CONTROL, /* SSL for the control connection or fail */
499   CURLUSESSL_ALL,     /* SSL for all communication or fail */
500   CURLUSESSL_LAST     /* not an option, never use */
501 } curl_usessl;
502 
503 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
504                           the obsolete stuff removed! */
505 
506 /* Backwards compatibility with older names */
507 /* These are scheduled to disappear by 2009 */
508 
509 #define CURLFTPSSL_NONE CURLUSESSL_NONE
510 #define CURLFTPSSL_TRY CURLUSESSL_TRY
511 #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
512 #define CURLFTPSSL_ALL CURLUSESSL_ALL
513 #define CURLFTPSSL_LAST CURLUSESSL_LAST
514 #define curl_ftpssl curl_usessl
515 #endif /*!CURL_NO_OLDIES*/
516 
517 /* parameter for the CURLOPT_FTP_SSL_CCC option */
518 typedef enum {
519   CURLFTPSSL_CCC_NONE,    /* do not send CCC */
520   CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
521   CURLFTPSSL_CCC_ACTIVE,  /* Initiate the shutdown */
522   CURLFTPSSL_CCC_LAST     /* not an option, never use */
523 } curl_ftpccc;
524 
525 /* parameter for the CURLOPT_FTPSSLAUTH option */
526 typedef enum {
527   CURLFTPAUTH_DEFAULT, /* let libcurl decide */
528   CURLFTPAUTH_SSL,     /* use "AUTH SSL" */
529   CURLFTPAUTH_TLS,     /* use "AUTH TLS" */
530   CURLFTPAUTH_LAST /* not an option, never use */
531 } curl_ftpauth;
532 
533 /* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
534 typedef enum {
535   CURLFTP_CREATE_DIR_NONE,  /* do NOT create missing dirs! */
536   CURLFTP_CREATE_DIR,       /* (FTP/SFTP) if CWD fails, try MKD and then CWD
537                                again if MKD succeeded, for SFTP this does
538                                similar magic */
539   CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
540                                again even if MKD failed! */
541   CURLFTP_CREATE_DIR_LAST   /* not an option, never use */
542 } curl_ftpcreatedir;
543 
544 /* parameter for the CURLOPT_FTP_FILEMETHOD option */
545 typedef enum {
546   CURLFTPMETHOD_DEFAULT,   /* let libcurl pick */
547   CURLFTPMETHOD_MULTICWD,  /* single CWD operation for each path part */
548   CURLFTPMETHOD_NOCWD,     /* no CWD at all */
549   CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
550   CURLFTPMETHOD_LAST       /* not an option, never use */
551 } curl_ftpmethod;
552 
553 /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
554 #define CURLPROTO_HTTP   (1<<0)
555 #define CURLPROTO_HTTPS  (1<<1)
556 #define CURLPROTO_FTP    (1<<2)
557 #define CURLPROTO_FTPS   (1<<3)
558 #define CURLPROTO_SCP    (1<<4)
559 #define CURLPROTO_SFTP   (1<<5)
560 #define CURLPROTO_TELNET (1<<6)
561 #define CURLPROTO_LDAP   (1<<7)
562 #define CURLPROTO_LDAPS  (1<<8)
563 #define CURLPROTO_DICT   (1<<9)
564 #define CURLPROTO_FILE   (1<<10)
565 #define CURLPROTO_TFTP   (1<<11)
566 #define CURLPROTO_ALL    (~0) /* enable everything */
567 
568 /* long may be 32 or 64 bits, but we should never depend on anything else
569    but 32 */
570 #define CURLOPTTYPE_LONG          0
571 #define CURLOPTTYPE_OBJECTPOINT   10000
572 #define CURLOPTTYPE_FUNCTIONPOINT 20000
573 #define CURLOPTTYPE_OFF_T         30000
574 
575 /* name is uppercase CURLOPT_<name>,
576    type is one of the defined CURLOPTTYPE_<type>
577    number is unique identifier */
578 #ifdef CINIT
579 #undef CINIT
580 #endif
581 
582 #ifdef CURL_ISOCPP
583 #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
584 #else
585 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
586 #define LONG          CURLOPTTYPE_LONG
587 #define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT
588 #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
589 #define OFF_T         CURLOPTTYPE_OFF_T
590 #define CINIT(name,type,number) CURLOPT_/**/name = type + number
591 #endif
592 
593 /*
594  * This macro-mania below setups the CURLOPT_[what] enum, to be used with
595  * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
596  * word.
597  */
598 
599 typedef enum {
600   /* This is the FILE * or void * the regular output should be written to. */
601   CINIT(FILE, OBJECTPOINT, 1),
602 
603   /* The full URL to get/put */
604   CINIT(URL,  OBJECTPOINT, 2),
605 
606   /* Port number to connect to, if other than default. */
607   CINIT(PORT, LONG, 3),
608 
609   /* Name of proxy to use. */
610   CINIT(PROXY, OBJECTPOINT, 4),
611 
612   /* "name:password" to use when fetching. */
613   CINIT(USERPWD, OBJECTPOINT, 5),
614 
615   /* "name:password" to use with proxy. */
616   CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
617 
618   /* Range to get, specified as an ASCII string. */
619   CINIT(RANGE, OBJECTPOINT, 7),
620 
621   /* not used */
622 
623   /* Specified file stream to upload from (use as input): */
624   CINIT(INFILE, OBJECTPOINT, 9),
625 
626   /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
627    * bytes big. If this is not used, error messages go to stderr instead: */
628   CINIT(ERRORBUFFER, OBJECTPOINT, 10),
629 
630   /* Function that will be called to store the output (instead of fwrite). The
631    * parameters will use fwrite() syntax, make sure to follow them. */
632   CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
633 
634   /* Function that will be called to read the input (instead of fread). The
635    * parameters will use fread() syntax, make sure to follow them. */
636   CINIT(READFUNCTION, FUNCTIONPOINT, 12),
637 
638   /* Time-out the read operation after this amount of seconds */
639   CINIT(TIMEOUT, LONG, 13),
640 
641   /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
642    * how large the file being sent really is. That allows better error
643    * checking and better verifies that the upload was successful. -1 means
644    * unknown size.
645    *
646    * For large file support, there is also a _LARGE version of the key
647    * which takes an off_t type, allowing platforms with larger off_t
648    * sizes to handle larger files.  See below for INFILESIZE_LARGE.
649    */
650   CINIT(INFILESIZE, LONG, 14),
651 
652   /* POST static input fields. */
653   CINIT(POSTFIELDS, OBJECTPOINT, 15),
654 
655   /* Set the referrer page (needed by some CGIs) */
656   CINIT(REFERER, OBJECTPOINT, 16),
657 
658   /* Set the FTP PORT string (interface name, named or numerical IP address)
659      Use i.e '-' to use default address. */
660   CINIT(FTPPORT, OBJECTPOINT, 17),
661 
662   /* Set the User-Agent string (examined by some CGIs) */
663   CINIT(USERAGENT, OBJECTPOINT, 18),
664 
665   /* If the download receives less than "low speed limit" bytes/second
666    * during "low speed time" seconds, the operations is aborted.
667    * You could i.e if you have a pretty high speed connection, abort if
668    * it is less than 2000 bytes/sec during 20 seconds.
669    */
670 
671   /* Set the "low speed limit" */
672   CINIT(LOW_SPEED_LIMIT, LONG, 19),
673 
674   /* Set the "low speed time" */
675   CINIT(LOW_SPEED_TIME, LONG, 20),
676 
677   /* Set the continuation offset.
678    *
679    * Note there is also a _LARGE version of this key which uses
680    * off_t types, allowing for large file offsets on platforms which
681    * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.
682    */
683   CINIT(RESUME_FROM, LONG, 21),
684 
685   /* Set cookie in request: */
686   CINIT(COOKIE, OBJECTPOINT, 22),
687 
688   /* This points to a linked list of headers, struct curl_slist kind */
689   CINIT(HTTPHEADER, OBJECTPOINT, 23),
690 
691   /* This points to a linked list of post entries, struct curl_httppost */
692   CINIT(HTTPPOST, OBJECTPOINT, 24),
693 
694   /* name of the file keeping your private SSL-certificate */
695   CINIT(SSLCERT, OBJECTPOINT, 25),
696 
697   /* password for the SSL or SSH private key */
698   CINIT(KEYPASSWD, OBJECTPOINT, 26),
699 
700   /* send TYPE parameter? */
701   CINIT(CRLF, LONG, 27),
702 
703   /* send linked-list of QUOTE commands */
704   CINIT(QUOTE, OBJECTPOINT, 28),
705 
706   /* send FILE * or void * to store headers to, if you use a callback it
707      is simply passed to the callback unmodified */
708   CINIT(WRITEHEADER, OBJECTPOINT, 29),
709 
710   /* point to a file to read the initial cookies from, also enables
711      "cookie awareness" */
712   CINIT(COOKIEFILE, OBJECTPOINT, 31),
713 
714   /* What version to specifically try to use.
715      See CURL_SSLVERSION defines below. */
716   CINIT(SSLVERSION, LONG, 32),
717 
718   /* What kind of HTTP time condition to use, see defines */
719   CINIT(TIMECONDITION, LONG, 33),
720 
721   /* Time to use with the above condition. Specified in number of seconds
722      since 1 Jan 1970 */
723   CINIT(TIMEVALUE, LONG, 34),
724 
725   /* 35 = OBSOLETE */
726 
727   /* Custom request, for customizing the get command like
728      HTTP: DELETE, TRACE and others
729      FTP: to use a different list command
730      */
731   CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
732 
733   /* HTTP request, for odd commands like DELETE, TRACE and others */
734   CINIT(STDERR, OBJECTPOINT, 37),
735 
736   /* 38 is not used */
737 
738   /* send linked-list of post-transfer QUOTE commands */
739   CINIT(POSTQUOTE, OBJECTPOINT, 39),
740 
741   /* Pass a pointer to string of the output using full variable-replacement
742      as described elsewhere. */
743   CINIT(WRITEINFO, OBJECTPOINT, 40),
744 
745   CINIT(VERBOSE, LONG, 41),      /* talk a lot */
746   CINIT(HEADER, LONG, 42),       /* throw the header out too */
747   CINIT(NOPROGRESS, LONG, 43),   /* shut off the progress meter */
748   CINIT(NOBODY, LONG, 44),       /* use HEAD to get http document */
749   CINIT(FAILONERROR, LONG, 45),  /* no output on http error codes >= 300 */
750   CINIT(UPLOAD, LONG, 46),       /* this is an upload */
751   CINIT(POST, LONG, 47),         /* HTTP POST method */
752   CINIT(DIRLISTONLY, LONG, 48),  /* return bare names when listing directories */
753 
754   CINIT(APPEND, LONG, 50),       /* Append instead of overwrite on upload! */
755 
756   /* Specify whether to read the user+password from the .netrc or the URL.
757    * This must be one of the CURL_NETRC_* enums below. */
758   CINIT(NETRC, LONG, 51),
759 
760   CINIT(FOLLOWLOCATION, LONG, 52),  /* use Location: Luke! */
761 
762   CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
763   CINIT(PUT, LONG, 54),          /* HTTP PUT */
764 
765   /* 55 = OBSOLETE */
766 
767   /* Function that will be called instead of the internal progress display
768    * function. This function should be defined as the curl_progress_callback
769    * prototype defines. */
770   CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
771 
772   /* Data passed to the progress callback */
773   CINIT(PROGRESSDATA, OBJECTPOINT, 57),
774 
775   /* We want the referrer field set automatically when following locations */
776   CINIT(AUTOREFERER, LONG, 58),
777 
778   /* Port of the proxy, can be set in the proxy string as well with:
779      "[host]:[port]" */
780   CINIT(PROXYPORT, LONG, 59),
781 
782   /* size of the POST input data, if strlen() is not good to use */
783   CINIT(POSTFIELDSIZE, LONG, 60),
784 
785   /* tunnel non-http operations through a HTTP proxy */
786   CINIT(HTTPPROXYTUNNEL, LONG, 61),
787 
788   /* Set the interface string to use as outgoing network interface */
789   CINIT(INTERFACE, OBJECTPOINT, 62),
790 
791   /* Set the krb4/5 security level, this also enables krb4/5 awareness.  This
792    * is a string, 'clear', 'safe', 'confidential' or 'private'.  If the string
793    * is set but doesn't match one of these, 'private' will be used.  */
794   CINIT(KRBLEVEL, OBJECTPOINT, 63),
795 
796   /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
797   CINIT(SSL_VERIFYPEER, LONG, 64),
798 
799   /* The CApath or CAfile used to validate the peer certificate
800      this option is used only if SSL_VERIFYPEER is true */
801   CINIT(CAINFO, OBJECTPOINT, 65),
802 
803   /* 66 = OBSOLETE */
804   /* 67 = OBSOLETE */
805 
806   /* Maximum number of http redirects to follow */
807   CINIT(MAXREDIRS, LONG, 68),
808 
809   /* Pass a long set to 1 to get the date of the requested document (if
810      possible)! Pass a zero to shut it off. */
811   CINIT(FILETIME, LONG, 69),
812 
813   /* This points to a linked list of telnet options */
814   CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
815 
816   /* Max amount of cached alive connections */
817   CINIT(MAXCONNECTS, LONG, 71),
818 
819   /* What policy to use when closing connections when the cache is filled
820      up */
821   CINIT(CLOSEPOLICY, LONG, 72),
822 
823   /* 73 = OBSOLETE */
824 
825   /* Set to explicitly use a new connection for the upcoming transfer.
826      Do not use this unless you're absolutely sure of this, as it makes the
827      operation slower and is less friendly for the network. */
828   CINIT(FRESH_CONNECT, LONG, 74),
829 
830   /* Set to explicitly forbid the upcoming transfer's connection to be re-used
831      when done. Do not use this unless you're absolutely sure of this, as it
832      makes the operation slower and is less friendly for the network. */
833   CINIT(FORBID_REUSE, LONG, 75),
834 
835   /* Set to a file name that contains random data for libcurl to use to
836      seed the random engine when doing SSL connects. */
837   CINIT(RANDOM_FILE, OBJECTPOINT, 76),
838 
839   /* Set to the Entropy Gathering Daemon socket pathname */
840   CINIT(EGDSOCKET, OBJECTPOINT, 77),
841 
842   /* Time-out connect operations after this amount of seconds, if connects
843      are OK within this time, then fine... This only aborts the connect
844      phase. [Only works on unix-style/SIGALRM operating systems] */
845   CINIT(CONNECTTIMEOUT, LONG, 78),
846 
847   /* Function that will be called to store headers (instead of fwrite). The
848    * parameters will use fwrite() syntax, make sure to follow them. */
849   CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
850 
851   /* Set this to force the HTTP request to get back to GET. Only really usable
852      if POST, PUT or a custom request have been used first.
853    */
854   CINIT(HTTPGET, LONG, 80),
855 
856   /* Set if we should verify the Common name from the peer certificate in ssl
857    * handshake, set 1 to check existence, 2 to ensure that it matches the
858    * provided hostname. */
859   CINIT(SSL_VERIFYHOST, LONG, 81),
860 
861   /* Specify which file name to write all known cookies in after completed
862      operation. Set file name to "-" (dash) to make it go to stdout. */
863   CINIT(COOKIEJAR, OBJECTPOINT, 82),
864 
865   /* Specify which SSL ciphers to use */
866   CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),
867 
868   /* Specify which HTTP version to use! This must be set to one of the
869      CURL_HTTP_VERSION* enums set below. */
870   CINIT(HTTP_VERSION, LONG, 84),
871 
872   /* Specifically switch on or off the FTP engine's use of the EPSV command. By
873      default, that one will always be attempted before the more traditional
874      PASV command. */
875   CINIT(FTP_USE_EPSV, LONG, 85),
876 
877   /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
878   CINIT(SSLCERTTYPE, OBJECTPOINT, 86),
879 
880   /* name of the file keeping your private SSL-key */
881   CINIT(SSLKEY, OBJECTPOINT, 87),
882 
883   /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
884   CINIT(SSLKEYTYPE, OBJECTPOINT, 88),
885 
886   /* crypto engine for the SSL-sub system */
887   CINIT(SSLENGINE, OBJECTPOINT, 89),
888 
889   /* set the crypto engine for the SSL-sub system as default
890      the param has no meaning...
891    */
892   CINIT(SSLENGINE_DEFAULT, LONG, 90),
893 
894   /* Non-zero value means to use the global dns cache */
895   CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */
896 
897   /* DNS cache timeout */
898   CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
899 
900   /* send linked-list of pre-transfer QUOTE commands */
901   CINIT(PREQUOTE, OBJECTPOINT, 93),
902 
903   /* set the debug function */
904   CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
905 
906   /* set the data for the debug function */
907   CINIT(DEBUGDATA, OBJECTPOINT, 95),
908 
909   /* mark this as start of a cookie session */
910   CINIT(COOKIESESSION, LONG, 96),
911 
912   /* The CApath directory used to validate the peer certificate
913      this option is used only if SSL_VERIFYPEER is true */
914   CINIT(CAPATH, OBJECTPOINT, 97),
915 
916   /* Instruct libcurl to use a smaller receive buffer */
917   CINIT(BUFFERSIZE, LONG, 98),
918 
919   /* Instruct libcurl to not use any signal/alarm handlers, even when using
920      timeouts. This option is useful for multi-threaded applications.
921      See libcurl-the-guide for more background information. */
922   CINIT(NOSIGNAL, LONG, 99),
923 
924   /* Provide a CURLShare for mutexing non-ts data */
925   CINIT(SHARE, OBJECTPOINT, 100),
926 
927   /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
928      CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
929   CINIT(PROXYTYPE, LONG, 101),
930 
931   /* Set the Accept-Encoding string. Use this to tell a server you would like
932      the response to be compressed. */
933   CINIT(ENCODING, OBJECTPOINT, 102),
934 
935   /* Set pointer to private data */
936   CINIT(PRIVATE, OBJECTPOINT, 103),
937 
938   /* Set aliases for HTTP 200 in the HTTP Response header */
939   CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
940 
941   /* Continue to send authentication (user+password) when following locations,
942      even when hostname changed. This can potentially send off the name
943      and password to whatever host the server decides. */
944   CINIT(UNRESTRICTED_AUTH, LONG, 105),
945 
946   /* Specifically switch on or off the FTP engine's use of the EPRT command ( it
947      also disables the LPRT attempt). By default, those ones will always be
948      attempted before the good old traditional PORT command. */
949   CINIT(FTP_USE_EPRT, LONG, 106),
950 
951   /* Set this to a bitmask value to enable the particular authentications
952      methods you like. Use this in combination with CURLOPT_USERPWD.
953      Note that setting multiple bits may cause extra network round-trips. */
954   CINIT(HTTPAUTH, LONG, 107),
955 
956   /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
957      in second argument. The function must be matching the
958      curl_ssl_ctx_callback proto. */
959   CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
960 
961   /* Set the userdata for the ssl context callback function's third
962      argument */
963   CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
964 
965   /* FTP Option that causes missing dirs to be created on the remote server.
966      In 7.19.4 we introduced the convenience enums for this option using the
967      CURLFTP_CREATE_DIR prefix.
968   */
969   CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
970 
971   /* Set this to a bitmask value to enable the particular authentications
972      methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
973      Note that setting multiple bits may cause extra network round-trips. */
974   CINIT(PROXYAUTH, LONG, 111),
975 
976   /* FTP option that changes the timeout, in seconds, associated with
977      getting a response.  This is different from transfer timeout time and
978      essentially places a demand on the FTP server to acknowledge commands
979      in a timely manner. */
980   CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
981 
982   /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
983      tell libcurl to resolve names to those IP versions only. This only has
984      affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
985   CINIT(IPRESOLVE, LONG, 113),
986 
987   /* Set this option to limit the size of a file that will be downloaded from
988      an HTTP or FTP server.
989 
990      Note there is also _LARGE version which adds large file support for
991      platforms which have larger off_t sizes.  See MAXFILESIZE_LARGE below. */
992   CINIT(MAXFILESIZE, LONG, 114),
993 
994   /* See the comment for INFILESIZE above, but in short, specifies
995    * the size of the file being uploaded.  -1 means unknown.
996    */
997   CINIT(INFILESIZE_LARGE, OFF_T, 115),
998 
999   /* Sets the continuation offset.  There is also a LONG version of this;
1000    * look above for RESUME_FROM.
1001    */
1002   CINIT(RESUME_FROM_LARGE, OFF_T, 116),
1003 
1004   /* Sets the maximum size of data that will be downloaded from
1005    * an HTTP or FTP server.  See MAXFILESIZE above for the LONG version.
1006    */
1007   CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
1008 
1009   /* Set this option to the file name of your .netrc file you want libcurl
1010      to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
1011      a poor attempt to find the user's home directory and check for a .netrc
1012      file in there. */
1013   CINIT(NETRC_FILE, OBJECTPOINT, 118),
1014 
1015   /* Enable SSL/TLS for FTP, pick one of:
1016      CURLFTPSSL_TRY     - try using SSL, proceed anyway otherwise
1017      CURLFTPSSL_CONTROL - SSL for the control connection or fail
1018      CURLFTPSSL_ALL     - SSL for all communication or fail
1019   */
1020   CINIT(USE_SSL, LONG, 119),
1021 
1022   /* The _LARGE version of the standard POSTFIELDSIZE option */
1023   CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
1024 
1025   /* Enable/disable the TCP Nagle algorithm */
1026   CINIT(TCP_NODELAY, LONG, 121),
1027 
1028   /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1029   /* 123 OBSOLETE. Gone in 7.16.0 */
1030   /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1031   /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1032   /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1033   /* 127 OBSOLETE. Gone in 7.16.0 */
1034   /* 128 OBSOLETE. Gone in 7.16.0 */
1035 
1036   /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
1037      can be used to change libcurl's default action which is to first try
1038      "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
1039      response has been received.
1040 
1041      Available parameters are:
1042      CURLFTPAUTH_DEFAULT - let libcurl decide
1043      CURLFTPAUTH_SSL     - try "AUTH SSL" first, then TLS
1044      CURLFTPAUTH_TLS     - try "AUTH TLS" first, then SSL
1045   */
1046   CINIT(FTPSSLAUTH, LONG, 129),
1047 
1048   CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
1049   CINIT(IOCTLDATA, OBJECTPOINT, 131),
1050 
1051   /* 132 OBSOLETE. Gone in 7.16.0 */
1052   /* 133 OBSOLETE. Gone in 7.16.0 */
1053 
1054   /* zero terminated string for pass on to the FTP server when asked for
1055      "account" info */
1056   CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
1057 
1058   /* feed cookies into cookie engine */
1059   CINIT(COOKIELIST, OBJECTPOINT, 135),
1060 
1061   /* ignore Content-Length */
1062   CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
1063 
1064   /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
1065      response. Typically used for FTP-SSL purposes but is not restricted to
1066      that. libcurl will then instead use the same IP address it used for the
1067      control connection. */
1068   CINIT(FTP_SKIP_PASV_IP, LONG, 137),
1069 
1070   /* Select "file method" to use when doing FTP, see the curl_ftpmethod
1071      above. */
1072   CINIT(FTP_FILEMETHOD, LONG, 138),
1073 
1074   /* Local port number to bind the socket to */
1075   CINIT(LOCALPORT, LONG, 139),
1076 
1077   /* Number of ports to try, including the first one set with LOCALPORT.
1078      Thus, setting it to 1 will make no additional attempts but the first.
1079   */
1080   CINIT(LOCALPORTRANGE, LONG, 140),
1081 
1082   /* no transfer, set up connection and let application use the socket by
1083      extracting it with CURLINFO_LASTSOCKET */
1084   CINIT(CONNECT_ONLY, LONG, 141),
1085 
1086   /* Function that will be called to convert from the
1087      network encoding (instead of using the iconv calls in libcurl) */
1088   CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),
1089 
1090   /* Function that will be called to convert to the
1091      network encoding (instead of using the iconv calls in libcurl) */
1092   CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),
1093 
1094   /* Function that will be called to convert from UTF8
1095      (instead of using the iconv calls in libcurl)
1096      Note that this is used only for SSL certificate processing */
1097   CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
1098 
1099   /* if the connection proceeds too quickly then need to slow it down */
1100   /* limit-rate: maximum number of bytes per second to send or receive */
1101   CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
1102   CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
1103 
1104   /* Pointer to command string to send if USER/PASS fails. */
1105   CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),
1106 
1107   /* callback function for setting socket options */
1108   CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
1109   CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
1110 
1111   /* set to 0 to disable session ID re-use for this transfer, default is
1112      enabled (== 1) */
1113   CINIT(SSL_SESSIONID_CACHE, LONG, 150),
1114 
1115   /* allowed SSH authentication methods */
1116   CINIT(SSH_AUTH_TYPES, LONG, 151),
1117 
1118   /* Used by scp/sftp to do public/private key authentication */
1119   CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),
1120   CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),
1121 
1122   /* Send CCC (Clear Command Channel) after authentication */
1123   CINIT(FTP_SSL_CCC, LONG, 154),
1124 
1125   /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
1126   CINIT(TIMEOUT_MS, LONG, 155),
1127   CINIT(CONNECTTIMEOUT_MS, LONG, 156),
1128 
1129   /* set to zero to disable the libcurl's decoding and thus pass the raw body
1130      data to the application even when it is encoded/compressed */
1131   CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
1132   CINIT(HTTP_CONTENT_DECODING, LONG, 158),
1133 
1134   /* Permission used when creating new files and directories on the remote
1135      server for protocols that support it, SFTP/SCP/FILE */
1136   CINIT(NEW_FILE_PERMS, LONG, 159),
1137   CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
1138 
1139   /* Set the behaviour of POST when redirecting. Values must be set to one
1140      of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
1141   CINIT(POSTREDIR, LONG, 161),
1142 
1143   /* used by scp/sftp to verify the host's public key */
1144   CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),
1145 
1146   /* Callback function for opening socket (instead of socket(2)). Optionally,
1147      callback is able change the address or refuse to connect returning
1148      CURL_SOCKET_BAD.  The callback should have type
1149      curl_opensocket_callback */
1150   CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
1151   CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
1152 
1153   /* POST volatile input fields. */
1154   CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),
1155 
1156   /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
1157   CINIT(PROXY_TRANSFER_MODE, LONG, 166),
1158 
1159   /* Callback function for seeking in the input stream */
1160   CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
1161   CINIT(SEEKDATA, OBJECTPOINT, 168),
1162 
1163   /* CRL file */
1164   CINIT(CRLFILE, OBJECTPOINT, 169),
1165 
1166   /* Issuer certificate */
1167   CINIT(ISSUERCERT, OBJECTPOINT, 170),
1168 
1169   /* (IPv6) Address scope */
1170   CINIT(ADDRESS_SCOPE, LONG, 171),
1171 
1172   /* Collect certificate chain info and allow it to get retrievable with
1173      CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only
1174      working with OpenSSL-powered builds. */
1175   CINIT(CERTINFO, LONG, 172),
1176 
1177   /* "name" and "pwd" to use when fetching. */
1178   CINIT(USERNAME, OBJECTPOINT, 173),
1179   CINIT(PASSWORD, OBJECTPOINT, 174),
1180 
1181     /* "name" and "pwd" to use with Proxy when fetching. */
1182   CINIT(PROXYUSERNAME, OBJECTPOINT, 175),
1183   CINIT(PROXYPASSWORD, OBJECTPOINT, 176),
1184 
1185   /* Comma separated list of hostnames defining no-proxy zones. These should
1186      match both hostnames directly, and hostnames within a domain. For
1187      example, local.com will match local.com and www.local.com, but NOT
1188      notlocal.com or www.notlocal.com. For compatibility with other
1189      implementations of this, .local.com will be considered to be the same as
1190      local.com. A single * is the only valid wildcard, and effectively
1191      disables the use of proxy. */
1192   CINIT(NOPROXY, OBJECTPOINT, 177),
1193 
1194   /* block size for TFTP transfers */
1195   CINIT(TFTP_BLKSIZE, LONG, 178),
1196 
1197   /* Socks Service */
1198   CINIT(SOCKS5_GSSAPI_SERVICE, LONG, 179),
1199 
1200   /* Socks Service */
1201   CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
1202 
1203   /* set the bitmask for the protocols that are allowed to be used for the
1204      transfer, which thus helps the app which takes URLs from users or other
1205      external inputs and want to restrict what protocol(s) to deal
1206      with. Defaults to CURLPROTO_ALL. */
1207   CINIT(PROTOCOLS, LONG, 181),
1208 
1209   /* set the bitmask for the protocols that libcurl is allowed to follow to,
1210      as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
1211      to be set in both bitmasks to be allowed to get redirected to. Defaults
1212      to all protocols except FILE and SCP. */
1213   CINIT(REDIR_PROTOCOLS, LONG, 182),
1214 
1215   CURLOPT_LASTENTRY /* the last unused */
1216 } CURLoption;
1217 
1218 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
1219                           the obsolete stuff removed! */
1220 
1221 /* Backwards compatibility with older names */
1222 /* These are scheduled to disappear by 2011 */
1223 
1224 /* This was added in version 7.19.1 */
1225 #define CURLOPT_POST301 CURLOPT_POSTREDIR
1226 
1227 /* These are scheduled to disappear by 2009 */
1228 
1229 /* The following were added in 7.17.0 */
1230 #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
1231 #define CURLOPT_FTPAPPEND CURLOPT_APPEND
1232 #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
1233 #define CURLOPT_FTP_SSL CURLOPT_USE_SSL
1234 
1235 /* The following were added earlier */
1236 
1237 #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
1238 #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
1239 
1240 #else
1241 /* This is set if CURL_NO_OLDIES is defined at compile-time */
1242 #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
1243 #endif
1244 
1245 
1246   /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
1247      name resolves addresses using more than one IP protocol version, this
1248      option might be handy to force libcurl to use a specific IP version. */
1249 #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
1250                                      versions that your system allows */
1251 #define CURL_IPRESOLVE_V4       1 /* resolve to ipv4 addresses */
1252 #define CURL_IPRESOLVE_V6       2 /* resolve to ipv6 addresses */
1253 
1254   /* three convenient "aliases" that follow the name scheme better */
1255 #define CURLOPT_WRITEDATA CURLOPT_FILE
1256 #define CURLOPT_READDATA  CURLOPT_INFILE
1257 #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
1258 
1259   /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
1260 enum {
1261   CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
1262                              like the library to choose the best possible
1263                              for us! */
1264   CURL_HTTP_VERSION_1_0,  /* please use HTTP 1.0 in the request */
1265   CURL_HTTP_VERSION_1_1,  /* please use HTTP 1.1 in the request */
1266 
1267   CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
1268 };
1269 
1270   /* These enums are for use with the CURLOPT_NETRC option. */
1271 enum CURL_NETRC_OPTION {
1272   CURL_NETRC_IGNORED,     /* The .netrc will never be read.
1273                            * This is the default. */
1274   CURL_NETRC_OPTIONAL,    /* A user:password in the URL will be preferred
1275                            * to one in the .netrc. */
1276   CURL_NETRC_REQUIRED,    /* A user:password in the URL will be ignored.
1277                            * Unless one is set programmatically, the .netrc
1278                            * will be queried. */
1279   CURL_NETRC_LAST
1280 };
1281 
1282 enum {
1283   CURL_SSLVERSION_DEFAULT,
1284   CURL_SSLVERSION_TLSv1,
1285   CURL_SSLVERSION_SSLv2,
1286   CURL_SSLVERSION_SSLv3,
1287 
1288   CURL_SSLVERSION_LAST /* never use, keep last */
1289 };
1290 
1291 /* symbols to use with CURLOPT_POSTREDIR.
1292    CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that
1293    CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */
1294 
1295 #define CURL_REDIR_GET_ALL  0
1296 #define CURL_REDIR_POST_301 1
1297 #define CURL_REDIR_POST_302 2
1298 #define CURL_REDIR_POST_ALL (CURL_REDIR_POST_301|CURL_REDIR_POST_302)
1299 
1300 typedef enum {
1301   CURL_TIMECOND_NONE,
1302 
1303   CURL_TIMECOND_IFMODSINCE,
1304   CURL_TIMECOND_IFUNMODSINCE,
1305   CURL_TIMECOND_LASTMOD,
1306 
1307   CURL_TIMECOND_LAST
1308 } curl_TimeCond;
1309 
1310 
1311 /* curl_strequal() and curl_strnequal() are subject for removal in a future
1312    libcurl, see lib/README.curlx for details */
1313 CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
1314 CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
1315 
1316 /* name is uppercase CURLFORM_<name> */
1317 #ifdef CFINIT
1318 #undef CFINIT
1319 #endif
1320 
1321 #ifdef CURL_ISOCPP
1322 #define CFINIT(name) CURLFORM_ ## name
1323 #else
1324 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
1325 #define CFINIT(name) CURLFORM_/**/name
1326 #endif
1327 
1328 typedef enum {
1329   CFINIT(NOTHING),        /********* the first one is unused ************/
1330 
1331   /*  */
1332   CFINIT(COPYNAME),
1333   CFINIT(PTRNAME),
1334   CFINIT(NAMELENGTH),
1335   CFINIT(COPYCONTENTS),
1336   CFINIT(PTRCONTENTS),
1337   CFINIT(CONTENTSLENGTH),
1338   CFINIT(FILECONTENT),
1339   CFINIT(ARRAY),
1340   CFINIT(OBSOLETE),
1341   CFINIT(FILE),
1342 
1343   CFINIT(BUFFER),
1344   CFINIT(BUFFERPTR),
1345   CFINIT(BUFFERLENGTH),
1346 
1347   CFINIT(CONTENTTYPE),
1348   CFINIT(CONTENTHEADER),
1349   CFINIT(FILENAME),
1350   CFINIT(END),
1351   CFINIT(OBSOLETE2),
1352 
1353   CFINIT(STREAM),
1354 
1355   CURLFORM_LASTENTRY /* the last unused */
1356 } CURLformoption;
1357 
1358 #undef CFINIT /* done */
1359 
1360 /* structure to be used as parameter for CURLFORM_ARRAY */
1361 struct curl_forms {
1362   CURLformoption option;
1363   const char     *value;
1364 };
1365 
1366 /* use this for multipart formpost building */
1367 /* Returns code for curl_formadd()
1368  *
1369  * Returns:
1370  * CURL_FORMADD_OK             on success
1371  * CURL_FORMADD_MEMORY         if the FormInfo allocation fails
1372  * CURL_FORMADD_OPTION_TWICE   if one option is given twice for one Form
1373  * CURL_FORMADD_NULL           if a null pointer was given for a char
1374  * CURL_FORMADD_MEMORY         if the allocation of a FormInfo struct failed
1375  * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
1376  * CURL_FORMADD_INCOMPLETE     if the some FormInfo is not complete (or error)
1377  * CURL_FORMADD_MEMORY         if a curl_httppost struct cannot be allocated
1378  * CURL_FORMADD_MEMORY         if some allocation for string copying failed.
1379  * CURL_FORMADD_ILLEGAL_ARRAY  if an illegal option is used in an array
1380  *
1381  ***************************************************************************/
1382 typedef enum {
1383   CURL_FORMADD_OK, /* first, no error */
1384 
1385   CURL_FORMADD_MEMORY,
1386   CURL_FORMADD_OPTION_TWICE,
1387   CURL_FORMADD_NULL,
1388   CURL_FORMADD_UNKNOWN_OPTION,
1389   CURL_FORMADD_INCOMPLETE,
1390   CURL_FORMADD_ILLEGAL_ARRAY,
1391   CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
1392 
1393   CURL_FORMADD_LAST /* last */
1394 } CURLFORMcode;
1395 
1396 /*
1397  * NAME curl_formadd()
1398  *
1399  * DESCRIPTION
1400  *
1401  * Pretty advanced function for building multi-part formposts. Each invoke
1402  * adds one part that together construct a full post. Then use
1403  * CURLOPT_HTTPPOST to send it off to libcurl.
1404  */
1405 CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
1406                                       struct curl_httppost **last_post,
1407                                       ...);
1408 
1409 /*
1410  * callback function for curl_formget()
1411  * The void *arg pointer will be the one passed as second argument to
1412  *   curl_formget().
1413  * The character buffer passed to it must not be freed.
1414  * Should return the buffer length passed to it as the argument "len" on
1415  *   success.
1416  */
1417 typedef size_t (*curl_formget_callback)(void *arg, const char *buf, size_t len);
1418 
1419 /*
1420  * NAME curl_formget()
1421  *
1422  * DESCRIPTION
1423  *
1424  * Serialize a curl_httppost struct built with curl_formadd().
1425  * Accepts a void pointer as second argument which will be passed to
1426  * the curl_formget_callback function.
1427  * Returns 0 on success.
1428  */
1429 CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
1430                              curl_formget_callback append);
1431 /*
1432  * NAME curl_formfree()
1433  *
1434  * DESCRIPTION
1435  *
1436  * Free a multipart formpost previously built with curl_formadd().
1437  */
1438 CURL_EXTERN void curl_formfree(struct curl_httppost *form);
1439 
1440 /*
1441  * NAME curl_getenv()
1442  *
1443  * DESCRIPTION
1444  *
1445  * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
1446  * complete. DEPRECATED - see lib/README.curlx
1447  */
1448 CURL_EXTERN char *curl_getenv(const char *variable);
1449 
1450 /*
1451  * NAME curl_version()
1452  *
1453  * DESCRIPTION
1454  *
1455  * Returns a static ascii string of the libcurl version.
1456  */
1457 CURL_EXTERN char *curl_version(void);
1458 
1459 /*
1460  * NAME curl_easy_escape()
1461  *
1462  * DESCRIPTION
1463  *
1464  * Escapes URL strings (converts all letters consider illegal in URLs to their
1465  * %XX versions). This function returns a new allocated string or NULL if an
1466  * error occurred.
1467  */
1468 CURL_EXTERN char *curl_easy_escape(CURL *handle,
1469                                    const char *string,
1470                                    int length);
1471 
1472 /* the previous version: */
1473 CURL_EXTERN char *curl_escape(const char *string,
1474                               int length);
1475 
1476 
1477 /*
1478  * NAME curl_easy_unescape()
1479  *
1480  * DESCRIPTION
1481  *
1482  * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
1483  * versions). This function returns a new allocated string or NULL if an error
1484  * occurred.
1485  * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
1486  * converted into the host encoding.
1487  */
1488 CURL_EXTERN char *curl_easy_unescape(CURL *handle,
1489                                      const char *string,
1490                                      int length,
1491                                      int *outlength);
1492 
1493 /* the previous version */
1494 CURL_EXTERN char *curl_unescape(const char *string,
1495                                 int length);
1496 
1497 /*
1498  * NAME curl_free()
1499  *
1500  * DESCRIPTION
1501  *
1502  * Provided for de-allocation in the same translation unit that did the
1503  * allocation. Added in libcurl 7.10
1504  */
1505 CURL_EXTERN void curl_free(void *p);
1506 
1507 /*
1508  * NAME curl_global_init()
1509  *
1510  * DESCRIPTION
1511  *
1512  * curl_global_init() should be invoked exactly once for each application that
1513  * uses libcurl
1514  */
1515 CURL_EXTERN CURLcode curl_global_init(long flags);
1516 
1517 /*
1518  * NAME curl_global_init_mem()
1519  *
1520  * DESCRIPTION
1521  *
1522  * curl_global_init() or curl_global_init_mem() should be invoked exactly once
1523  * for each application that uses libcurl.  This function can be used to
1524  * initialize libcurl and set user defined memory management callback
1525  * functions.  Users can implement memory management routines to check for
1526  * memory leaks, check for mis-use of the curl library etc.  User registered
1527  * callback routines with be invoked by this library instead of the system
1528  * memory management routines like malloc, free etc.
1529  */
1530 CURL_EXTERN CURLcode curl_global_init_mem(long flags,
1531                                           curl_malloc_callback m,
1532                                           curl_free_callback f,
1533                                           curl_realloc_callback r,
1534                                           curl_strdup_callback s,
1535                                           curl_calloc_callback c);
1536 
1537 /*
1538  * NAME curl_global_cleanup()
1539  *
1540  * DESCRIPTION
1541  *
1542  * curl_global_cleanup() should be invoked exactly once for each application
1543  * that uses libcurl
1544  */
1545 CURL_EXTERN void curl_global_cleanup(void);
1546 
1547 /* linked-list structure for the CURLOPT_QUOTE option (and other) */
1548 struct curl_slist {
1549   char *data;
1550   struct curl_slist *next;
1551 };
1552 
1553 /*
1554  * NAME curl_slist_append()
1555  *
1556  * DESCRIPTION
1557  *
1558  * Appends a string to a linked list. If no list exists, it will be created
1559  * first. Returns the new list, after appending.
1560  */
1561 CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
1562                                                  const char *);
1563 
1564 /*
1565  * NAME curl_slist_free_all()
1566  *
1567  * DESCRIPTION
1568  *
1569  * free a previously built curl_slist.
1570  */
1571 CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
1572 
1573 /*
1574  * NAME curl_getdate()
1575  *
1576  * DESCRIPTION
1577  *
1578  * Returns the time, in seconds since 1 Jan 1970 of the time string given in
1579  * the first argument. The time argument in the second parameter is unused
1580  * and should be set to NULL.
1581  */
1582 CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
1583 
1584 /* info about the certificate chain, only for OpenSSL builds. Asked
1585    for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
1586 struct curl_certinfo {
1587   int num_of_certs;             /* number of certificates with information */
1588   struct curl_slist **certinfo; /* for each index in this array, there's a
1589                                    linked list with textual information in the
1590                                    format "name: value" */
1591 };
1592 
1593 #define CURLINFO_STRING   0x100000
1594 #define CURLINFO_LONG     0x200000
1595 #define CURLINFO_DOUBLE   0x300000
1596 #define CURLINFO_SLIST    0x400000
1597 #define CURLINFO_MASK     0x0fffff
1598 #define CURLINFO_TYPEMASK 0xf00000
1599 
1600 typedef enum {
1601   CURLINFO_NONE, /* first, never use this */
1602   CURLINFO_EFFECTIVE_URL    = CURLINFO_STRING + 1,
1603   CURLINFO_RESPONSE_CODE    = CURLINFO_LONG   + 2,
1604   CURLINFO_TOTAL_TIME       = CURLINFO_DOUBLE + 3,
1605   CURLINFO_NAMELOOKUP_TIME  = CURLINFO_DOUBLE + 4,
1606   CURLINFO_CONNECT_TIME     = CURLINFO_DOUBLE + 5,
1607   CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
1608   CURLINFO_SIZE_UPLOAD      = CURLINFO_DOUBLE + 7,
1609   CURLINFO_SIZE_DOWNLOAD    = CURLINFO_DOUBLE + 8,
1610   CURLINFO_SPEED_DOWNLOAD   = CURLINFO_DOUBLE + 9,
1611   CURLINFO_SPEED_UPLOAD     = CURLINFO_DOUBLE + 10,
1612   CURLINFO_HEADER_SIZE      = CURLINFO_LONG   + 11,
1613   CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,
1614   CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,
1615   CURLINFO_FILETIME         = CURLINFO_LONG   + 14,
1616   CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,
1617   CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,
1618   CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
1619   CURLINFO_CONTENT_TYPE     = CURLINFO_STRING + 18,
1620   CURLINFO_REDIRECT_TIME    = CURLINFO_DOUBLE + 19,
1621   CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG   + 20,
1622   CURLINFO_PRIVATE          = CURLINFO_STRING + 21,
1623   CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,
1624   CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,
1625   CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,
1626   CURLINFO_OS_ERRNO         = CURLINFO_LONG   + 25,
1627   CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,
1628   CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,
1629   CURLINFO_COOKIELIST       = CURLINFO_SLIST  + 28,
1630   CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,
1631   CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,
1632   CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,
1633   CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,
1634   CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,
1635   CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,
1636   CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,
1637   /* Fill in new entries below here! */
1638 
1639   CURLINFO_LASTONE          = 35
1640 } CURLINFO;
1641 
1642 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
1643    CURLINFO_HTTP_CODE */
1644 #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
1645 
1646 typedef enum {
1647   CURLCLOSEPOLICY_NONE, /* first, never use this */
1648 
1649   CURLCLOSEPOLICY_OLDEST,
1650   CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
1651   CURLCLOSEPOLICY_LEAST_TRAFFIC,
1652   CURLCLOSEPOLICY_SLOWEST,
1653   CURLCLOSEPOLICY_CALLBACK,
1654 
1655   CURLCLOSEPOLICY_LAST /* last, never use this */
1656 } curl_closepolicy;
1657 
1658 #define CURL_GLOBAL_SSL (1<<0)
1659 #define CURL_GLOBAL_WIN32 (1<<1)
1660 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
1661 #define CURL_GLOBAL_NOTHING 0
1662 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
1663 
1664 
1665 /*****************************************************************************
1666  * Setup defines, protos etc for the sharing stuff.
1667  */
1668 
1669 /* Different data locks for a single share */
1670 typedef enum {
1671   CURL_LOCK_DATA_NONE = 0,
1672   /*  CURL_LOCK_DATA_SHARE is used internally to say that
1673    *  the locking is just made to change the internal state of the share
1674    *  itself.
1675    */
1676   CURL_LOCK_DATA_SHARE,
1677   CURL_LOCK_DATA_COOKIE,
1678   CURL_LOCK_DATA_DNS,
1679   CURL_LOCK_DATA_SSL_SESSION,
1680   CURL_LOCK_DATA_CONNECT,
1681   CURL_LOCK_DATA_LAST
1682 } curl_lock_data;
1683 
1684 /* Different lock access types */
1685 typedef enum {
1686   CURL_LOCK_ACCESS_NONE = 0,   /* unspecified action */
1687   CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
1688   CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
1689   CURL_LOCK_ACCESS_LAST        /* never use */
1690 } curl_lock_access;
1691 
1692 typedef void (*curl_lock_function)(CURL *handle,
1693                                    curl_lock_data data,
1694                                    curl_lock_access locktype,
1695                                    void *userptr);
1696 typedef void (*curl_unlock_function)(CURL *handle,
1697                                      curl_lock_data data,
1698                                      void *userptr);
1699 
1700 typedef void CURLSH;
1701 
1702 typedef enum {
1703   CURLSHE_OK,  /* all is fine */
1704   CURLSHE_BAD_OPTION, /* 1 */
1705   CURLSHE_IN_USE,     /* 2 */
1706   CURLSHE_INVALID,    /* 3 */
1707   CURLSHE_NOMEM,      /* out of memory */
1708   CURLSHE_LAST /* never use */
1709 } CURLSHcode;
1710 
1711 typedef enum {
1712   CURLSHOPT_NONE,  /* don't use */
1713   CURLSHOPT_SHARE,   /* specify a data type to share */
1714   CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */
1715   CURLSHOPT_LOCKFUNC,   /* pass in a 'curl_lock_function' pointer */
1716   CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
1717   CURLSHOPT_USERDATA,   /* pass in a user data pointer used in the lock/unlock
1718                            callback functions */
1719   CURLSHOPT_LAST  /* never use */
1720 } CURLSHoption;
1721 
1722 CURL_EXTERN CURLSH *curl_share_init(void);
1723 CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
1724 CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
1725 
1726 /****************************************************************************
1727  * Structures for querying information about the curl library at runtime.
1728  */
1729 
1730 typedef enum {
1731   CURLVERSION_FIRST,
1732   CURLVERSION_SECOND,
1733   CURLVERSION_THIRD,
1734   CURLVERSION_FOURTH,
1735   CURLVERSION_LAST /* never actually use this */
1736 } CURLversion;
1737 
1738 /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
1739    basically all programs ever that want to get version information. It is
1740    meant to be a built-in version number for what kind of struct the caller
1741    expects. If the struct ever changes, we redefine the NOW to another enum
1742    from above. */
1743 #define CURLVERSION_NOW CURLVERSION_FOURTH
1744 
1745 typedef struct {
1746   CURLversion age;          /* age of the returned struct */
1747   const char *version;      /* LIBCURL_VERSION */
1748   unsigned int version_num; /* LIBCURL_VERSION_NUM */
1749   const char *host;         /* OS/host/cpu/machine when configured */
1750   int features;             /* bitmask, see defines below */
1751   const char *ssl_version;  /* human readable string */
1752   long ssl_version_num;     /* not used anymore, always 0 */
1753   const char *libz_version; /* human readable string */
1754   /* protocols is terminated by an entry with a NULL protoname */
1755   const char * const *protocols;
1756 
1757   /* The fields below this were added in CURLVERSION_SECOND */
1758   const char *ares;
1759   int ares_num;
1760 
1761   /* This field was added in CURLVERSION_THIRD */
1762   const char *libidn;
1763 
1764   /* These field were added in CURLVERSION_FOURTH */
1765 
1766   /* Same as '_libiconv_version' if built with HAVE_ICONV */
1767   int iconv_ver_num;
1768 
1769   const char *libssh_version; /* human readable string */
1770 
1771 } curl_version_info_data;
1772 
1773 #define CURL_VERSION_IPV6      (1<<0)  /* IPv6-enabled */
1774 #define CURL_VERSION_KERBEROS4 (1<<1)  /* kerberos auth is supported */
1775 #define CURL_VERSION_SSL       (1<<2)  /* SSL options are present */
1776 #define CURL_VERSION_LIBZ      (1<<3)  /* libz features are present */
1777 #define CURL_VERSION_NTLM      (1<<4)  /* NTLM auth is supported */
1778 #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */
1779 #define CURL_VERSION_DEBUG     (1<<6)  /* built with debug capabilities */
1780 #define CURL_VERSION_ASYNCHDNS (1<<7)  /* asynchronous dns resolves */
1781 #define CURL_VERSION_SPNEGO    (1<<8)  /* SPNEGO auth */
1782 #define CURL_VERSION_LARGEFILE (1<<9)  /* supports files bigger than 2GB */
1783 #define CURL_VERSION_IDN       (1<<10) /* International Domain Names support */
1784 #define CURL_VERSION_SSPI      (1<<11) /* SSPI is supported */
1785 #define CURL_VERSION_CONV      (1<<12) /* character conversions are
1786                                           supported */
1787 
1788 /*
1789  * NAME curl_version_info()
1790  *
1791  * DESCRIPTION
1792  *
1793  * This function returns a pointer to a static copy of the version info
1794  * struct. See above.
1795  */
1796 CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
1797 
1798 /*
1799  * NAME curl_easy_strerror()
1800  *
1801  * DESCRIPTION
1802  *
1803  * The curl_easy_strerror function may be used to turn a CURLcode value
1804  * into the equivalent human readable error string.  This is useful
1805  * for printing meaningful error messages.
1806  */
1807 CURL_EXTERN const char *curl_easy_strerror(CURLcode);
1808 
1809 /*
1810  * NAME curl_share_strerror()
1811  *
1812  * DESCRIPTION
1813  *
1814  * The curl_share_strerror function may be used to turn a CURLSHcode value
1815  * into the equivalent human readable error string.  This is useful
1816  * for printing meaningful error messages.
1817  */
1818 CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
1819 
1820 /*
1821  * NAME curl_easy_pause()
1822  *
1823  * DESCRIPTION
1824  *
1825  * The curl_easy_pause function pauses or unpauses transfers. Select the new
1826  * state by setting the bitmask, use the convenience defines below.
1827  *
1828  */
1829 CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
1830 
1831 #define CURLPAUSE_RECV      (1<<0)
1832 #define CURLPAUSE_RECV_CONT (0)
1833 
1834 #define CURLPAUSE_SEND      (1<<2)
1835 #define CURLPAUSE_SEND_CONT (0)
1836 
1837 #define CURLPAUSE_ALL       (CURLPAUSE_RECV|CURLPAUSE_SEND)
1838 #define CURLPAUSE_CONT      (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)
1839 
1840 #ifdef  __cplusplus
1841 }
1842 #endif
1843 
1844 /* unfortunately, the easy.h and multi.h include files need options and info
1845   stuff before they can be included! */
1846 #include "easy.h" /* nothing in curl is fun without the easy stuff */
1847 #include "multi.h"
1848 
1849 /* the typechecker doesn't work in C++ (yet) */
1850 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
1851     ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
1852     !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
1853 #include "typecheck-gcc.h"
1854 #else
1855 #if defined(__STDC__) && (__STDC__ >= 1)
1856 /* This preprocessor magic that replaces a call with the exact same call is
1857    only done to make sure application authors pass exactly three arguments
1858    to these functions. */
1859 #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
1860 #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
1861 #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
1862 #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
1863 #endif /* __STDC__ >= 1 */
1864 #endif /* gcc >= 4.3 && !__cplusplus */
1865 
1866 #endif /* __CURL_CURL_H */
1867