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