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