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