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