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