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