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