Home | History | Annotate | Download | only in curl
      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 (at) 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 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
    729                           the obsolete stuff removed! */
    730 
    731 /* Backwards compatibility with older names */
    732 /* These are scheduled to disappear by 2009 */
    733 
    734 #define CURLFTPSSL_NONE CURLUSESSL_NONE
    735 #define CURLFTPSSL_TRY CURLUSESSL_TRY
    736 #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
    737 #define CURLFTPSSL_ALL CURLUSESSL_ALL
    738 #define CURLFTPSSL_LAST CURLUSESSL_LAST
    739 #define curl_ftpssl curl_usessl
    740 #endif /*!CURL_NO_OLDIES*/
    741 
    742 /* parameter for the CURLOPT_FTP_SSL_CCC option */
    743 typedef enum {
    744   CURLFTPSSL_CCC_NONE,    /* do not send CCC */
    745   CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
    746   CURLFTPSSL_CCC_ACTIVE,  /* Initiate the shutdown */
    747   CURLFTPSSL_CCC_LAST     /* not an option, never use */
    748 } curl_ftpccc;
    749 
    750 /* parameter for the CURLOPT_FTPSSLAUTH option */
    751 typedef enum {
    752   CURLFTPAUTH_DEFAULT, /* let libcurl decide */
    753   CURLFTPAUTH_SSL,     /* use "AUTH SSL" */
    754   CURLFTPAUTH_TLS,     /* use "AUTH TLS" */
    755   CURLFTPAUTH_LAST /* not an option, never use */
    756 } curl_ftpauth;
    757 
    758 /* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
    759 typedef enum {
    760   CURLFTP_CREATE_DIR_NONE,  /* do NOT create missing dirs! */
    761   CURLFTP_CREATE_DIR,       /* (FTP/SFTP) if CWD fails, try MKD and then CWD
    762                                again if MKD succeeded, for SFTP this does
    763                                similar magic */
    764   CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
    765                                again even if MKD failed! */
    766   CURLFTP_CREATE_DIR_LAST   /* not an option, never use */
    767 } curl_ftpcreatedir;
    768 
    769 /* parameter for the CURLOPT_FTP_FILEMETHOD option */
    770 typedef enum {
    771   CURLFTPMETHOD_DEFAULT,   /* let libcurl pick */
    772   CURLFTPMETHOD_MULTICWD,  /* single CWD operation for each path part */
    773   CURLFTPMETHOD_NOCWD,     /* no CWD at all */
    774   CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
    775   CURLFTPMETHOD_LAST       /* not an option, never use */
    776 } curl_ftpmethod;
    777 
    778 /* bitmask defines for CURLOPT_HEADEROPT */
    779 #define CURLHEADER_UNIFIED  0
    780 #define CURLHEADER_SEPARATE (1<<0)
    781 
    782 /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
    783 #define CURLPROTO_HTTP   (1<<0)
    784 #define CURLPROTO_HTTPS  (1<<1)
    785 #define CURLPROTO_FTP    (1<<2)
    786 #define CURLPROTO_FTPS   (1<<3)
    787 #define CURLPROTO_SCP    (1<<4)
    788 #define CURLPROTO_SFTP   (1<<5)
    789 #define CURLPROTO_TELNET (1<<6)
    790 #define CURLPROTO_LDAP   (1<<7)
    791 #define CURLPROTO_LDAPS  (1<<8)
    792 #define CURLPROTO_DICT   (1<<9)
    793 #define CURLPROTO_FILE   (1<<10)
    794 #define CURLPROTO_TFTP   (1<<11)
    795 #define CURLPROTO_IMAP   (1<<12)
    796 #define CURLPROTO_IMAPS  (1<<13)
    797 #define CURLPROTO_POP3   (1<<14)
    798 #define CURLPROTO_POP3S  (1<<15)
    799 #define CURLPROTO_SMTP   (1<<16)
    800 #define CURLPROTO_SMTPS  (1<<17)
    801 #define CURLPROTO_RTSP   (1<<18)
    802 #define CURLPROTO_RTMP   (1<<19)
    803 #define CURLPROTO_RTMPT  (1<<20)
    804 #define CURLPROTO_RTMPE  (1<<21)
    805 #define CURLPROTO_RTMPTE (1<<22)
    806 #define CURLPROTO_RTMPS  (1<<23)
    807 #define CURLPROTO_RTMPTS (1<<24)
    808 #define CURLPROTO_GOPHER (1<<25)
    809 #define CURLPROTO_SMB    (1<<26)
    810 #define CURLPROTO_SMBS   (1<<27)
    811 #define CURLPROTO_ALL    (~0) /* enable everything */
    812 
    813 /* long may be 32 or 64 bits, but we should never depend on anything else
    814    but 32 */
    815 #define CURLOPTTYPE_LONG          0
    816 #define CURLOPTTYPE_OBJECTPOINT   10000
    817 #define CURLOPTTYPE_FUNCTIONPOINT 20000
    818 #define CURLOPTTYPE_OFF_T         30000
    819 
    820 /* name is uppercase CURLOPT_<name>,
    821    type is one of the defined CURLOPTTYPE_<type>
    822    number is unique identifier */
    823 #ifdef CINIT
    824 #undef CINIT
    825 #endif
    826 
    827 #ifdef CURL_ISOCPP
    828 #define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu
    829 #else
    830 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
    831 #define LONG          CURLOPTTYPE_LONG
    832 #define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT
    833 #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
    834 #define OFF_T         CURLOPTTYPE_OFF_T
    835 #define CINIT(name,type,number) CURLOPT_/**/name = type + number
    836 #endif
    837 
    838 /*
    839  * This macro-mania below setups the CURLOPT_[what] enum, to be used with
    840  * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
    841  * word.
    842  */
    843 
    844 typedef enum {
    845   /* This is the FILE * or void * the regular output should be written to. */
    846   CINIT(WRITEDATA, OBJECTPOINT, 1),
    847 
    848   /* The full URL to get/put */
    849   CINIT(URL, OBJECTPOINT, 2),
    850 
    851   /* Port number to connect to, if other than default. */
    852   CINIT(PORT, LONG, 3),
    853 
    854   /* Name of proxy to use. */
    855   CINIT(PROXY, OBJECTPOINT, 4),
    856 
    857   /* "user:password;options" to use when fetching. */
    858   CINIT(USERPWD, OBJECTPOINT, 5),
    859 
    860   /* "user:password" to use with proxy. */
    861   CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
    862 
    863   /* Range to get, specified as an ASCII string. */
    864   CINIT(RANGE, OBJECTPOINT, 7),
    865 
    866   /* not used */
    867 
    868   /* Specified file stream to upload from (use as input): */
    869   CINIT(READDATA, OBJECTPOINT, 9),
    870 
    871   /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
    872    * bytes big. If this is not used, error messages go to stderr instead: */
    873   CINIT(ERRORBUFFER, OBJECTPOINT, 10),
    874 
    875   /* Function that will be called to store the output (instead of fwrite). The
    876    * parameters will use fwrite() syntax, make sure to follow them. */
    877   CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
    878 
    879   /* Function that will be called to read the input (instead of fread). The
    880    * parameters will use fread() syntax, make sure to follow them. */
    881   CINIT(READFUNCTION, FUNCTIONPOINT, 12),
    882 
    883   /* Time-out the read operation after this amount of seconds */
    884   CINIT(TIMEOUT, LONG, 13),
    885 
    886   /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
    887    * how large the file being sent really is. That allows better error
    888    * checking and better verifies that the upload was successful. -1 means
    889    * unknown size.
    890    *
    891    * For large file support, there is also a _LARGE version of the key
    892    * which takes an off_t type, allowing platforms with larger off_t
    893    * sizes to handle larger files.  See below for INFILESIZE_LARGE.
    894    */
    895   CINIT(INFILESIZE, LONG, 14),
    896 
    897   /* POST static input fields. */
    898   CINIT(POSTFIELDS, OBJECTPOINT, 15),
    899 
    900   /* Set the referrer page (needed by some CGIs) */
    901   CINIT(REFERER, OBJECTPOINT, 16),
    902 
    903   /* Set the FTP PORT string (interface name, named or numerical IP address)
    904      Use i.e '-' to use default address. */
    905   CINIT(FTPPORT, OBJECTPOINT, 17),
    906 
    907   /* Set the User-Agent string (examined by some CGIs) */
    908   CINIT(USERAGENT, OBJECTPOINT, 18),
    909 
    910   /* If the download receives less than "low speed limit" bytes/second
    911    * during "low speed time" seconds, the operations is aborted.
    912    * You could i.e if you have a pretty high speed connection, abort if
    913    * it is less than 2000 bytes/sec during 20 seconds.
    914    */
    915 
    916   /* Set the "low speed limit" */
    917   CINIT(LOW_SPEED_LIMIT, LONG, 19),
    918 
    919   /* Set the "low speed time" */
    920   CINIT(LOW_SPEED_TIME, LONG, 20),
    921 
    922   /* Set the continuation offset.
    923    *
    924    * Note there is also a _LARGE version of this key which uses
    925    * off_t types, allowing for large file offsets on platforms which
    926    * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.
    927    */
    928   CINIT(RESUME_FROM, LONG, 21),
    929 
    930   /* Set cookie in request: */
    931   CINIT(COOKIE, OBJECTPOINT, 22),
    932 
    933   /* This points to a linked list of headers, struct curl_slist kind. This
    934      list is also used for RTSP (in spite of its name) */
    935   CINIT(HTTPHEADER, OBJECTPOINT, 23),
    936 
    937   /* This points to a linked list of post entries, struct curl_httppost */
    938   CINIT(HTTPPOST, OBJECTPOINT, 24),
    939 
    940   /* name of the file keeping your private SSL-certificate */
    941   CINIT(SSLCERT, OBJECTPOINT, 25),
    942 
    943   /* password for the SSL or SSH private key */
    944   CINIT(KEYPASSWD, OBJECTPOINT, 26),
    945 
    946   /* send TYPE parameter? */
    947   CINIT(CRLF, LONG, 27),
    948 
    949   /* send linked-list of QUOTE commands */
    950   CINIT(QUOTE, OBJECTPOINT, 28),
    951 
    952   /* send FILE * or void * to store headers to, if you use a callback it
    953      is simply passed to the callback unmodified */
    954   CINIT(HEADERDATA, OBJECTPOINT, 29),
    955 
    956   /* point to a file to read the initial cookies from, also enables
    957      "cookie awareness" */
    958   CINIT(COOKIEFILE, OBJECTPOINT, 31),
    959 
    960   /* What version to specifically try to use.
    961      See CURL_SSLVERSION defines below. */
    962   CINIT(SSLVERSION, LONG, 32),
    963 
    964   /* What kind of HTTP time condition to use, see defines */
    965   CINIT(TIMECONDITION, LONG, 33),
    966 
    967   /* Time to use with the above condition. Specified in number of seconds
    968      since 1 Jan 1970 */
    969   CINIT(TIMEVALUE, LONG, 34),
    970 
    971   /* 35 = OBSOLETE */
    972 
    973   /* Custom request, for customizing the get command like
    974      HTTP: DELETE, TRACE and others
    975      FTP: to use a different list command
    976      */
    977   CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
    978 
    979   /* HTTP request, for odd commands like DELETE, TRACE and others */
    980   CINIT(STDERR, OBJECTPOINT, 37),
    981 
    982   /* 38 is not used */
    983 
    984   /* send linked-list of post-transfer QUOTE commands */
    985   CINIT(POSTQUOTE, OBJECTPOINT, 39),
    986 
    987   CINIT(OBSOLETE40, OBJECTPOINT, 40), /* OBSOLETE, do not use! */
    988 
    989   CINIT(VERBOSE, LONG, 41),      /* talk a lot */
    990   CINIT(HEADER, LONG, 42),       /* throw the header out too */
    991   CINIT(NOPROGRESS, LONG, 43),   /* shut off the progress meter */
    992   CINIT(NOBODY, LONG, 44),       /* use HEAD to get http document */
    993   CINIT(FAILONERROR, LONG, 45),  /* no output on http error codes >= 400 */
    994   CINIT(UPLOAD, LONG, 46),       /* this is an upload */
    995   CINIT(POST, LONG, 47),         /* HTTP POST method */
    996   CINIT(DIRLISTONLY, LONG, 48),  /* bare names when listing directories */
    997 
    998   CINIT(APPEND, LONG, 50),       /* Append instead of overwrite on upload! */
    999 
   1000   /* Specify whether to read the user+password from the .netrc or the URL.
   1001    * This must be one of the CURL_NETRC_* enums below. */
   1002   CINIT(NETRC, LONG, 51),
   1003 
   1004   CINIT(FOLLOWLOCATION, LONG, 52),  /* use Location: Luke! */
   1005 
   1006   CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
   1007   CINIT(PUT, LONG, 54),          /* HTTP PUT */
   1008 
   1009   /* 55 = OBSOLETE */
   1010 
   1011   /* DEPRECATED
   1012    * Function that will be called instead of the internal progress display
   1013    * function. This function should be defined as the curl_progress_callback
   1014    * prototype defines. */
   1015   CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
   1016 
   1017   /* Data passed to the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION
   1018      callbacks */
   1019   CINIT(PROGRESSDATA, OBJECTPOINT, 57),
   1020 #define CURLOPT_XFERINFODATA CURLOPT_PROGRESSDATA
   1021 
   1022   /* We want the referrer field set automatically when following locations */
   1023   CINIT(AUTOREFERER, LONG, 58),
   1024 
   1025   /* Port of the proxy, can be set in the proxy string as well with:
   1026      "[host]:[port]" */
   1027   CINIT(PROXYPORT, LONG, 59),
   1028 
   1029   /* size of the POST input data, if strlen() is not good to use */
   1030   CINIT(POSTFIELDSIZE, LONG, 60),
   1031 
   1032   /* tunnel non-http operations through a HTTP proxy */
   1033   CINIT(HTTPPROXYTUNNEL, LONG, 61),
   1034 
   1035   /* Set the interface string to use as outgoing network interface */
   1036   CINIT(INTERFACE, OBJECTPOINT, 62),
   1037 
   1038   /* Set the krb4/5 security level, this also enables krb4/5 awareness.  This
   1039    * is a string, 'clear', 'safe', 'confidential' or 'private'.  If the string
   1040    * is set but doesn't match one of these, 'private' will be used.  */
   1041   CINIT(KRBLEVEL, OBJECTPOINT, 63),
   1042 
   1043   /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
   1044   CINIT(SSL_VERIFYPEER, LONG, 64),
   1045 
   1046   /* The CApath or CAfile used to validate the peer certificate
   1047      this option is used only if SSL_VERIFYPEER is true */
   1048   CINIT(CAINFO, OBJECTPOINT, 65),
   1049 
   1050   /* 66 = OBSOLETE */
   1051   /* 67 = OBSOLETE */
   1052 
   1053   /* Maximum number of http redirects to follow */
   1054   CINIT(MAXREDIRS, LONG, 68),
   1055 
   1056   /* Pass a long set to 1 to get the date of the requested document (if
   1057      possible)! Pass a zero to shut it off. */
   1058   CINIT(FILETIME, LONG, 69),
   1059 
   1060   /* This points to a linked list of telnet options */
   1061   CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
   1062 
   1063   /* Max amount of cached alive connections */
   1064   CINIT(MAXCONNECTS, LONG, 71),
   1065 
   1066   CINIT(OBSOLETE72, LONG, 72), /* OBSOLETE, do not use! */
   1067 
   1068   /* 73 = OBSOLETE */
   1069 
   1070   /* Set to explicitly use a new connection for the upcoming transfer.
   1071      Do not use this unless you're absolutely sure of this, as it makes the
   1072      operation slower and is less friendly for the network. */
   1073   CINIT(FRESH_CONNECT, LONG, 74),
   1074 
   1075   /* Set to explicitly forbid the upcoming transfer's connection to be re-used
   1076      when done. Do not use this unless you're absolutely sure of this, as it
   1077      makes the operation slower and is less friendly for the network. */
   1078   CINIT(FORBID_REUSE, LONG, 75),
   1079 
   1080   /* Set to a file name that contains random data for libcurl to use to
   1081      seed the random engine when doing SSL connects. */
   1082   CINIT(RANDOM_FILE, OBJECTPOINT, 76),
   1083 
   1084   /* Set to the Entropy Gathering Daemon socket pathname */
   1085   CINIT(EGDSOCKET, OBJECTPOINT, 77),
   1086 
   1087   /* Time-out connect operations after this amount of seconds, if connects are
   1088      OK within this time, then fine... This only aborts the connect phase. */
   1089   CINIT(CONNECTTIMEOUT, LONG, 78),
   1090 
   1091   /* Function that will be called to store headers (instead of fwrite). The
   1092    * parameters will use fwrite() syntax, make sure to follow them. */
   1093   CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
   1094 
   1095   /* Set this to force the HTTP request to get back to GET. Only really usable
   1096      if POST, PUT or a custom request have been used first.
   1097    */
   1098   CINIT(HTTPGET, LONG, 80),
   1099 
   1100   /* Set if we should verify the Common name from the peer certificate in ssl
   1101    * handshake, set 1 to check existence, 2 to ensure that it matches the
   1102    * provided hostname. */
   1103   CINIT(SSL_VERIFYHOST, LONG, 81),
   1104 
   1105   /* Specify which file name to write all known cookies in after completed
   1106      operation. Set file name to "-" (dash) to make it go to stdout. */
   1107   CINIT(COOKIEJAR, OBJECTPOINT, 82),
   1108 
   1109   /* Specify which SSL ciphers to use */
   1110   CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),
   1111 
   1112   /* Specify which HTTP version to use! This must be set to one of the
   1113      CURL_HTTP_VERSION* enums set below. */
   1114   CINIT(HTTP_VERSION, LONG, 84),
   1115 
   1116   /* Specifically switch on or off the FTP engine's use of the EPSV command. By
   1117      default, that one will always be attempted before the more traditional
   1118      PASV command. */
   1119   CINIT(FTP_USE_EPSV, LONG, 85),
   1120 
   1121   /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
   1122   CINIT(SSLCERTTYPE, OBJECTPOINT, 86),
   1123 
   1124   /* name of the file keeping your private SSL-key */
   1125   CINIT(SSLKEY, OBJECTPOINT, 87),
   1126 
   1127   /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
   1128   CINIT(SSLKEYTYPE, OBJECTPOINT, 88),
   1129 
   1130   /* crypto engine for the SSL-sub system */
   1131   CINIT(SSLENGINE, OBJECTPOINT, 89),
   1132 
   1133   /* set the crypto engine for the SSL-sub system as default
   1134      the param has no meaning...
   1135    */
   1136   CINIT(SSLENGINE_DEFAULT, LONG, 90),
   1137 
   1138   /* Non-zero value means to use the global dns cache */
   1139   CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */
   1140 
   1141   /* DNS cache timeout */
   1142   CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
   1143 
   1144   /* send linked-list of pre-transfer QUOTE commands */
   1145   CINIT(PREQUOTE, OBJECTPOINT, 93),
   1146 
   1147   /* set the debug function */
   1148   CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
   1149 
   1150   /* set the data for the debug function */
   1151   CINIT(DEBUGDATA, OBJECTPOINT, 95),
   1152 
   1153   /* mark this as start of a cookie session */
   1154   CINIT(COOKIESESSION, LONG, 96),
   1155 
   1156   /* The CApath directory used to validate the peer certificate
   1157      this option is used only if SSL_VERIFYPEER is true */
   1158   CINIT(CAPATH, OBJECTPOINT, 97),
   1159 
   1160   /* Instruct libcurl to use a smaller receive buffer */
   1161   CINIT(BUFFERSIZE, LONG, 98),
   1162 
   1163   /* Instruct libcurl to not use any signal/alarm handlers, even when using
   1164      timeouts. This option is useful for multi-threaded applications.
   1165      See libcurl-the-guide for more background information. */
   1166   CINIT(NOSIGNAL, LONG, 99),
   1167 
   1168   /* Provide a CURLShare for mutexing non-ts data */
   1169   CINIT(SHARE, OBJECTPOINT, 100),
   1170 
   1171   /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
   1172      CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
   1173   CINIT(PROXYTYPE, LONG, 101),
   1174 
   1175   /* Set the Accept-Encoding string. Use this to tell a server you would like
   1176      the response to be compressed. Before 7.21.6, this was known as
   1177      CURLOPT_ENCODING */
   1178   CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),
   1179 
   1180   /* Set pointer to private data */
   1181   CINIT(PRIVATE, OBJECTPOINT, 103),
   1182 
   1183   /* Set aliases for HTTP 200 in the HTTP Response header */
   1184   CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
   1185 
   1186   /* Continue to send authentication (user+password) when following locations,
   1187      even when hostname changed. This can potentially send off the name
   1188      and password to whatever host the server decides. */
   1189   CINIT(UNRESTRICTED_AUTH, LONG, 105),
   1190 
   1191   /* Specifically switch on or off the FTP engine's use of the EPRT command (
   1192      it also disables the LPRT attempt). By default, those ones will always be
   1193      attempted before the good old traditional PORT command. */
   1194   CINIT(FTP_USE_EPRT, LONG, 106),
   1195 
   1196   /* Set this to a bitmask value to enable the particular authentications
   1197      methods you like. Use this in combination with CURLOPT_USERPWD.
   1198      Note that setting multiple bits may cause extra network round-trips. */
   1199   CINIT(HTTPAUTH, LONG, 107),
   1200 
   1201   /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
   1202      in second argument. The function must be matching the
   1203      curl_ssl_ctx_callback proto. */
   1204   CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
   1205 
   1206   /* Set the userdata for the ssl context callback function's third
   1207      argument */
   1208   CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
   1209 
   1210   /* FTP Option that causes missing dirs to be created on the remote server.
   1211      In 7.19.4 we introduced the convenience enums for this option using the
   1212      CURLFTP_CREATE_DIR prefix.
   1213   */
   1214   CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
   1215 
   1216   /* Set this to a bitmask value to enable the particular authentications
   1217      methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
   1218      Note that setting multiple bits may cause extra network round-trips. */
   1219   CINIT(PROXYAUTH, LONG, 111),
   1220 
   1221   /* FTP option that changes the timeout, in seconds, associated with
   1222      getting a response.  This is different from transfer timeout time and
   1223      essentially places a demand on the FTP server to acknowledge commands
   1224      in a timely manner. */
   1225   CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
   1226 #define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT
   1227 
   1228   /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
   1229      tell libcurl to resolve names to those IP versions only. This only has
   1230      affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
   1231   CINIT(IPRESOLVE, LONG, 113),
   1232 
   1233   /* Set this option to limit the size of a file that will be downloaded from
   1234      an HTTP or FTP server.
   1235 
   1236      Note there is also _LARGE version which adds large file support for
   1237      platforms which have larger off_t sizes.  See MAXFILESIZE_LARGE below. */
   1238   CINIT(MAXFILESIZE, LONG, 114),
   1239 
   1240   /* See the comment for INFILESIZE above, but in short, specifies
   1241    * the size of the file being uploaded.  -1 means unknown.
   1242    */
   1243   CINIT(INFILESIZE_LARGE, OFF_T, 115),
   1244 
   1245   /* Sets the continuation offset.  There is also a LONG version of this;
   1246    * look above for RESUME_FROM.
   1247    */
   1248   CINIT(RESUME_FROM_LARGE, OFF_T, 116),
   1249 
   1250   /* Sets the maximum size of data that will be downloaded from
   1251    * an HTTP or FTP server.  See MAXFILESIZE above for the LONG version.
   1252    */
   1253   CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
   1254 
   1255   /* Set this option to the file name of your .netrc file you want libcurl
   1256      to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
   1257      a poor attempt to find the user's home directory and check for a .netrc
   1258      file in there. */
   1259   CINIT(NETRC_FILE, OBJECTPOINT, 118),
   1260 
   1261   /* Enable SSL/TLS for FTP, pick one of:
   1262      CURLUSESSL_TRY     - try using SSL, proceed anyway otherwise
   1263      CURLUSESSL_CONTROL - SSL for the control connection or fail
   1264      CURLUSESSL_ALL     - SSL for all communication or fail
   1265   */
   1266   CINIT(USE_SSL, LONG, 119),
   1267 
   1268   /* The _LARGE version of the standard POSTFIELDSIZE option */
   1269   CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
   1270 
   1271   /* Enable/disable the TCP Nagle algorithm */
   1272   CINIT(TCP_NODELAY, LONG, 121),
   1273 
   1274   /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
   1275   /* 123 OBSOLETE. Gone in 7.16.0 */
   1276   /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
   1277   /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
   1278   /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
   1279   /* 127 OBSOLETE. Gone in 7.16.0 */
   1280   /* 128 OBSOLETE. Gone in 7.16.0 */
   1281 
   1282   /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
   1283      can be used to change libcurl's default action which is to first try
   1284      "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
   1285      response has been received.
   1286 
   1287      Available parameters are:
   1288      CURLFTPAUTH_DEFAULT - let libcurl decide
   1289      CURLFTPAUTH_SSL     - try "AUTH SSL" first, then TLS
   1290      CURLFTPAUTH_TLS     - try "AUTH TLS" first, then SSL
   1291   */
   1292   CINIT(FTPSSLAUTH, LONG, 129),
   1293 
   1294   CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
   1295   CINIT(IOCTLDATA, OBJECTPOINT, 131),
   1296 
   1297   /* 132 OBSOLETE. Gone in 7.16.0 */
   1298   /* 133 OBSOLETE. Gone in 7.16.0 */
   1299 
   1300   /* zero terminated string for pass on to the FTP server when asked for
   1301      "account" info */
   1302   CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
   1303 
   1304   /* feed cookies into cookie engine */
   1305   CINIT(COOKIELIST, OBJECTPOINT, 135),
   1306 
   1307   /* ignore Content-Length */
   1308   CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
   1309 
   1310   /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
   1311      response. Typically used for FTP-SSL purposes but is not restricted to
   1312      that. libcurl will then instead use the same IP address it used for the
   1313      control connection. */
   1314   CINIT(FTP_SKIP_PASV_IP, LONG, 137),
   1315 
   1316   /* Select "file method" to use when doing FTP, see the curl_ftpmethod
   1317      above. */
   1318   CINIT(FTP_FILEMETHOD, LONG, 138),
   1319 
   1320   /* Local port number to bind the socket to */
   1321   CINIT(LOCALPORT, LONG, 139),
   1322 
   1323   /* Number of ports to try, including the first one set with LOCALPORT.
   1324      Thus, setting it to 1 will make no additional attempts but the first.
   1325   */
   1326   CINIT(LOCALPORTRANGE, LONG, 140),
   1327 
   1328   /* no transfer, set up connection and let application use the socket by
   1329      extracting it with CURLINFO_LASTSOCKET */
   1330   CINIT(CONNECT_ONLY, LONG, 141),
   1331 
   1332   /* Function that will be called to convert from the
   1333      network encoding (instead of using the iconv calls in libcurl) */
   1334   CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),
   1335 
   1336   /* Function that will be called to convert to the
   1337      network encoding (instead of using the iconv calls in libcurl) */
   1338   CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),
   1339 
   1340   /* Function that will be called to convert from UTF8
   1341      (instead of using the iconv calls in libcurl)
   1342      Note that this is used only for SSL certificate processing */
   1343   CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
   1344 
   1345   /* if the connection proceeds too quickly then need to slow it down */
   1346   /* limit-rate: maximum number of bytes per second to send or receive */
   1347   CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
   1348   CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
   1349 
   1350   /* Pointer to command string to send if USER/PASS fails. */
   1351   CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),
   1352 
   1353   /* callback function for setting socket options */
   1354   CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
   1355   CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
   1356 
   1357   /* set to 0 to disable session ID re-use for this transfer, default is
   1358      enabled (== 1) */
   1359   CINIT(SSL_SESSIONID_CACHE, LONG, 150),
   1360 
   1361   /* allowed SSH authentication methods */
   1362   CINIT(SSH_AUTH_TYPES, LONG, 151),
   1363 
   1364   /* Used by scp/sftp to do public/private key authentication */
   1365   CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),
   1366   CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),
   1367 
   1368   /* Send CCC (Clear Command Channel) after authentication */
   1369   CINIT(FTP_SSL_CCC, LONG, 154),
   1370 
   1371   /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
   1372   CINIT(TIMEOUT_MS, LONG, 155),
   1373   CINIT(CONNECTTIMEOUT_MS, LONG, 156),
   1374 
   1375   /* set to zero to disable the libcurl's decoding and thus pass the raw body
   1376      data to the application even when it is encoded/compressed */
   1377   CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
   1378   CINIT(HTTP_CONTENT_DECODING, LONG, 158),
   1379 
   1380   /* Permission used when creating new files and directories on the remote
   1381      server for protocols that support it, SFTP/SCP/FILE */
   1382   CINIT(NEW_FILE_PERMS, LONG, 159),
   1383   CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
   1384 
   1385   /* Set the behaviour of POST when redirecting. Values must be set to one
   1386      of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
   1387   CINIT(POSTREDIR, LONG, 161),
   1388 
   1389   /* used by scp/sftp to verify the host's public key */
   1390   CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),
   1391 
   1392   /* Callback function for opening socket (instead of socket(2)). Optionally,
   1393      callback is able change the address or refuse to connect returning
   1394      CURL_SOCKET_BAD.  The callback should have type
   1395      curl_opensocket_callback */
   1396   CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
   1397   CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
   1398 
   1399   /* POST volatile input fields. */
   1400   CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),
   1401 
   1402   /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
   1403   CINIT(PROXY_TRANSFER_MODE, LONG, 166),
   1404 
   1405   /* Callback function for seeking in the input stream */
   1406   CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
   1407   CINIT(SEEKDATA, OBJECTPOINT, 168),
   1408 
   1409   /* CRL file */
   1410   CINIT(CRLFILE, OBJECTPOINT, 169),
   1411 
   1412   /* Issuer certificate */
   1413   CINIT(ISSUERCERT, OBJECTPOINT, 170),
   1414 
   1415   /* (IPv6) Address scope */
   1416   CINIT(ADDRESS_SCOPE, LONG, 171),
   1417 
   1418   /* Collect certificate chain info and allow it to get retrievable with
   1419      CURLINFO_CERTINFO after the transfer is complete. */
   1420   CINIT(CERTINFO, LONG, 172),
   1421 
   1422   /* "name" and "pwd" to use when fetching. */
   1423   CINIT(USERNAME, OBJECTPOINT, 173),
   1424   CINIT(PASSWORD, OBJECTPOINT, 174),
   1425 
   1426     /* "name" and "pwd" to use with Proxy when fetching. */
   1427   CINIT(PROXYUSERNAME, OBJECTPOINT, 175),
   1428   CINIT(PROXYPASSWORD, OBJECTPOINT, 176),
   1429 
   1430   /* Comma separated list of hostnames defining no-proxy zones. These should
   1431      match both hostnames directly, and hostnames within a domain. For
   1432      example, local.com will match local.com and www.local.com, but NOT
   1433      notlocal.com or www.notlocal.com. For compatibility with other
   1434      implementations of this, .local.com will be considered to be the same as
   1435      local.com. A single * is the only valid wildcard, and effectively
   1436      disables the use of proxy. */
   1437   CINIT(NOPROXY, OBJECTPOINT, 177),
   1438 
   1439   /* block size for TFTP transfers */
   1440   CINIT(TFTP_BLKSIZE, LONG, 178),
   1441 
   1442   /* Socks Service */
   1443   CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),
   1444 
   1445   /* Socks Service */
   1446   CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
   1447 
   1448   /* set the bitmask for the protocols that are allowed to be used for the
   1449      transfer, which thus helps the app which takes URLs from users or other
   1450      external inputs and want to restrict what protocol(s) to deal
   1451      with. Defaults to CURLPROTO_ALL. */
   1452   CINIT(PROTOCOLS, LONG, 181),
   1453 
   1454   /* set the bitmask for the protocols that libcurl is allowed to follow to,
   1455      as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
   1456      to be set in both bitmasks to be allowed to get redirected to. Defaults
   1457      to all protocols except FILE and SCP. */
   1458   CINIT(REDIR_PROTOCOLS, LONG, 182),
   1459 
   1460   /* set the SSH knownhost file name to use */
   1461   CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),
   1462 
   1463   /* set the SSH host key callback, must point to a curl_sshkeycallback
   1464      function */
   1465   CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),
   1466 
   1467   /* set the SSH host key callback custom pointer */
   1468   CINIT(SSH_KEYDATA, OBJECTPOINT, 185),
   1469 
   1470   /* set the SMTP mail originator */
   1471   CINIT(MAIL_FROM, OBJECTPOINT, 186),
   1472 
   1473   /* set the SMTP mail receiver(s) */
   1474   CINIT(MAIL_RCPT, OBJECTPOINT, 187),
   1475 
   1476   /* FTP: send PRET before PASV */
   1477   CINIT(FTP_USE_PRET, LONG, 188),
   1478 
   1479   /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */
   1480   CINIT(RTSP_REQUEST, LONG, 189),
   1481 
   1482   /* The RTSP session identifier */
   1483   CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190),
   1484 
   1485   /* The RTSP stream URI */
   1486   CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191),
   1487 
   1488   /* The Transport: header to use in RTSP requests */
   1489   CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192),
   1490 
   1491   /* Manually initialize the client RTSP CSeq for this handle */
   1492   CINIT(RTSP_CLIENT_CSEQ, LONG, 193),
   1493 
   1494   /* Manually initialize the server RTSP CSeq for this handle */
   1495   CINIT(RTSP_SERVER_CSEQ, LONG, 194),
   1496 
   1497   /* The stream to pass to INTERLEAVEFUNCTION. */
   1498   CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),
   1499 
   1500   /* Let the application define a custom write method for RTP data */
   1501   CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),
   1502 
   1503   /* Turn on wildcard matching */
   1504   CINIT(WILDCARDMATCH, LONG, 197),
   1505 
   1506   /* Directory matching callback called before downloading of an
   1507      individual file (chunk) started */
   1508   CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),
   1509 
   1510   /* Directory matching callback called after the file (chunk)
   1511      was downloaded, or skipped */
   1512   CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),
   1513 
   1514   /* Change match (fnmatch-like) callback for wildcard matching */
   1515   CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),
   1516 
   1517   /* Let the application define custom chunk data pointer */
   1518   CINIT(CHUNK_DATA, OBJECTPOINT, 201),
   1519 
   1520   /* FNMATCH_FUNCTION user pointer */
   1521   CINIT(FNMATCH_DATA, OBJECTPOINT, 202),
   1522 
   1523   /* send linked-list of name:port:address sets */
   1524   CINIT(RESOLVE, OBJECTPOINT, 203),
   1525 
   1526   /* Set a username for authenticated TLS */
   1527   CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204),
   1528 
   1529   /* Set a password for authenticated TLS */
   1530   CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205),
   1531 
   1532   /* Set authentication type for authenticated TLS */
   1533   CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),
   1534 
   1535   /* Set to 1 to enable the "TE:" header in HTTP requests to ask for
   1536      compressed transfer-encoded responses. Set to 0 to disable the use of TE:
   1537      in outgoing requests. The current default is 0, but it might change in a
   1538      future libcurl release.
   1539 
   1540      libcurl will ask for the compressed methods it knows of, and if that
   1541      isn't any, it will not ask for transfer-encoding at all even if this
   1542      option is set to 1.
   1543 
   1544   */
   1545   CINIT(TRANSFER_ENCODING, LONG, 207),
   1546 
   1547   /* Callback function for closing socket (instead of close(2)). The callback
   1548      should have type curl_closesocket_callback */
   1549   CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),
   1550   CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),
   1551 
   1552   /* allow GSSAPI credential delegation */
   1553   CINIT(GSSAPI_DELEGATION, LONG, 210),
   1554 
   1555   /* Set the name servers to use for DNS resolution */
   1556   CINIT(DNS_SERVERS, OBJECTPOINT, 211),
   1557 
   1558   /* Time-out accept operations (currently for FTP only) after this amount
   1559      of miliseconds. */
   1560   CINIT(ACCEPTTIMEOUT_MS, LONG, 212),
   1561 
   1562   /* Set TCP keepalive */
   1563   CINIT(TCP_KEEPALIVE, LONG, 213),
   1564 
   1565   /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */
   1566   CINIT(TCP_KEEPIDLE, LONG, 214),
   1567   CINIT(TCP_KEEPINTVL, LONG, 215),
   1568 
   1569   /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */
   1570   CINIT(SSL_OPTIONS, LONG, 216),
   1571 
   1572   /* Set the SMTP auth originator */
   1573   CINIT(MAIL_AUTH, OBJECTPOINT, 217),
   1574 
   1575   /* Enable/disable SASL initial response */
   1576   CINIT(SASL_IR, LONG, 218),
   1577 
   1578   /* Function that will be called instead of the internal progress display
   1579    * function. This function should be defined as the curl_xferinfo_callback
   1580    * prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */
   1581   CINIT(XFERINFOFUNCTION, FUNCTIONPOINT, 219),
   1582 
   1583   /* The XOAUTH2 bearer token */
   1584   CINIT(XOAUTH2_BEARER, OBJECTPOINT, 220),
   1585 
   1586   /* Set the interface string to use as outgoing network
   1587    * interface for DNS requests.
   1588    * Only supported by the c-ares DNS backend */
   1589   CINIT(DNS_INTERFACE, OBJECTPOINT, 221),
   1590 
   1591   /* Set the local IPv4 address to use for outgoing DNS requests.
   1592    * Only supported by the c-ares DNS backend */
   1593   CINIT(DNS_LOCAL_IP4, OBJECTPOINT, 222),
   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_IP6, OBJECTPOINT, 223),
   1598 
   1599   /* Set authentication options directly */
   1600   CINIT(LOGIN_OPTIONS, OBJECTPOINT, 224),
   1601 
   1602   /* Enable/disable TLS NPN extension (http2 over ssl might fail without) */
   1603   CINIT(SSL_ENABLE_NPN, LONG, 225),
   1604 
   1605   /* Enable/disable TLS ALPN extension (http2 over ssl might fail without) */
   1606   CINIT(SSL_ENABLE_ALPN, LONG, 226),
   1607 
   1608   /* Time to wait for a response to a HTTP request containing an
   1609    * Expect: 100-continue header before sending the data anyway. */
   1610   CINIT(EXPECT_100_TIMEOUT_MS, LONG, 227),
   1611 
   1612   /* This points to a linked list of headers used for proxy requests only,
   1613      struct curl_slist kind */
   1614   CINIT(PROXYHEADER, OBJECTPOINT, 228),
   1615 
   1616   /* Pass in a bitmask of "header options" */
   1617   CINIT(HEADEROPT, LONG, 229),
   1618 
   1619   /* The public key in DER form used to validate the peer public key
   1620      this option is used only if SSL_VERIFYPEER is true */
   1621   CINIT(PINNEDPUBLICKEY, OBJECTPOINT, 230),
   1622 
   1623   /* Path to Unix domain socket */
   1624   CINIT(UNIX_SOCKET_PATH, OBJECTPOINT, 231),
   1625 
   1626   /* Set if we should verify the certificate status. */
   1627   CINIT(SSL_VERIFYSTATUS, LONG, 232),
   1628 
   1629   /* Set if we should enable TLS false start. */
   1630   CINIT(SSL_FALSESTART, LONG, 233),
   1631 
   1632   /* Do not squash dot-dot sequences */
   1633   CINIT(PATH_AS_IS, LONG, 234),
   1634 
   1635   /* Proxy Service Name */
   1636   CINIT(PROXY_SERVICE_NAME, OBJECTPOINT, 235),
   1637 
   1638   /* Service Name */
   1639   CINIT(SERVICE_NAME, OBJECTPOINT, 236),
   1640 
   1641   /* Wait/don't wait for pipe/mutex to clarify */
   1642   CINIT(PIPEWAIT, LONG, 237),
   1643 
   1644   CURLOPT_LASTENTRY /* the last unused */
   1645 } CURLoption;
   1646 
   1647 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
   1648                           the obsolete stuff removed! */
   1649 
   1650 /* Backwards compatibility with older names */
   1651 /* These are scheduled to disappear by 2011 */
   1652 
   1653 /* This was added in version 7.19.1 */
   1654 #define CURLOPT_POST301 CURLOPT_POSTREDIR
   1655 
   1656 /* These are scheduled to disappear by 2009 */
   1657 
   1658 /* The following were added in 7.17.0 */
   1659 #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
   1660 #define CURLOPT_FTPAPPEND CURLOPT_APPEND
   1661 #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
   1662 #define CURLOPT_FTP_SSL CURLOPT_USE_SSL
   1663 
   1664 /* The following were added earlier */
   1665 
   1666 #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
   1667 #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
   1668 
   1669 #else
   1670 /* This is set if CURL_NO_OLDIES is defined at compile-time */
   1671 #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
   1672 #endif
   1673 
   1674 
   1675   /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
   1676      name resolves addresses using more than one IP protocol version, this
   1677      option might be handy to force libcurl to use a specific IP version. */
   1678 #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
   1679                                      versions that your system allows */
   1680 #define CURL_IPRESOLVE_V4       1 /* resolve to IPv4 addresses */
   1681 #define CURL_IPRESOLVE_V6       2 /* resolve to IPv6 addresses */
   1682 
   1683   /* three convenient "aliases" that follow the name scheme better */
   1684 #define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER
   1685 
   1686   /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
   1687 enum {
   1688   CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
   1689                              like the library to choose the best possible
   1690                              for us! */
   1691   CURL_HTTP_VERSION_1_0,  /* please use HTTP 1.0 in the request */
   1692   CURL_HTTP_VERSION_1_1,  /* please use HTTP 1.1 in the request */
   1693   CURL_HTTP_VERSION_2_0,  /* please use HTTP 2.0 in the request */
   1694 
   1695   CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
   1696 };
   1697 
   1698 /* Convenience definition simple because the name of the version is HTTP/2 and
   1699    not 2.0. The 2_0 version of the enum name was set while the version was
   1700    still planned to be 2.0 and we stick to it for compatibility. */
   1701 #define CURL_HTTP_VERSION_2 CURL_HTTP_VERSION_2_0
   1702 
   1703 /*
   1704  * Public API enums for RTSP requests
   1705  */
   1706 enum {
   1707     CURL_RTSPREQ_NONE, /* first in list */
   1708     CURL_RTSPREQ_OPTIONS,
   1709     CURL_RTSPREQ_DESCRIBE,
   1710     CURL_RTSPREQ_ANNOUNCE,
   1711     CURL_RTSPREQ_SETUP,
   1712     CURL_RTSPREQ_PLAY,
   1713     CURL_RTSPREQ_PAUSE,
   1714     CURL_RTSPREQ_TEARDOWN,
   1715     CURL_RTSPREQ_GET_PARAMETER,
   1716     CURL_RTSPREQ_SET_PARAMETER,
   1717     CURL_RTSPREQ_RECORD,
   1718     CURL_RTSPREQ_RECEIVE,
   1719     CURL_RTSPREQ_LAST /* last in list */
   1720 };
   1721 
   1722   /* These enums are for use with the CURLOPT_NETRC option. */
   1723 enum CURL_NETRC_OPTION {
   1724   CURL_NETRC_IGNORED,     /* The .netrc will never be read.
   1725                            * This is the default. */
   1726   CURL_NETRC_OPTIONAL,    /* A user:password in the URL will be preferred
   1727                            * to one in the .netrc. */
   1728   CURL_NETRC_REQUIRED,    /* A user:password in the URL will be ignored.
   1729                            * Unless one is set programmatically, the .netrc
   1730                            * will be queried. */
   1731   CURL_NETRC_LAST
   1732 };
   1733 
   1734 enum {
   1735   CURL_SSLVERSION_DEFAULT,
   1736   CURL_SSLVERSION_TLSv1, /* TLS 1.x */
   1737   CURL_SSLVERSION_SSLv2,
   1738   CURL_SSLVERSION_SSLv3,
   1739   CURL_SSLVERSION_TLSv1_0,
   1740   CURL_SSLVERSION_TLSv1_1,
   1741   CURL_SSLVERSION_TLSv1_2,
   1742 
   1743   CURL_SSLVERSION_LAST /* never use, keep last */
   1744 };
   1745 
   1746 enum CURL_TLSAUTH {
   1747   CURL_TLSAUTH_NONE,
   1748   CURL_TLSAUTH_SRP,
   1749   CURL_TLSAUTH_LAST /* never use, keep last */
   1750 };
   1751 
   1752 /* symbols to use with CURLOPT_POSTREDIR.
   1753    CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303
   1754    can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302
   1755    | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */
   1756 
   1757 #define CURL_REDIR_GET_ALL  0
   1758 #define CURL_REDIR_POST_301 1
   1759 #define CURL_REDIR_POST_302 2
   1760 #define CURL_REDIR_POST_303 4
   1761 #define CURL_REDIR_POST_ALL \
   1762     (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)
   1763 
   1764 typedef enum {
   1765   CURL_TIMECOND_NONE,
   1766 
   1767   CURL_TIMECOND_IFMODSINCE,
   1768   CURL_TIMECOND_IFUNMODSINCE,
   1769   CURL_TIMECOND_LASTMOD,
   1770 
   1771   CURL_TIMECOND_LAST
   1772 } curl_TimeCond;
   1773 
   1774 
   1775 /* curl_strequal() and curl_strnequal() are subject for removal in a future
   1776    libcurl, see lib/README.curlx for details */
   1777 CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
   1778 CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
   1779 
   1780 /* name is uppercase CURLFORM_<name> */
   1781 #ifdef CFINIT
   1782 #undef CFINIT
   1783 #endif
   1784 
   1785 #ifdef CURL_ISOCPP
   1786 #define CFINIT(name) CURLFORM_ ## name
   1787 #else
   1788 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
   1789 #define CFINIT(name) CURLFORM_/**/name
   1790 #endif
   1791 
   1792 typedef enum {
   1793   CFINIT(NOTHING),        /********* the first one is unused ************/
   1794 
   1795   /*  */
   1796   CFINIT(COPYNAME),
   1797   CFINIT(PTRNAME),
   1798   CFINIT(NAMELENGTH),
   1799   CFINIT(COPYCONTENTS),
   1800   CFINIT(PTRCONTENTS),
   1801   CFINIT(CONTENTSLENGTH),
   1802   CFINIT(FILECONTENT),
   1803   CFINIT(ARRAY),
   1804   CFINIT(OBSOLETE),
   1805   CFINIT(FILE),
   1806 
   1807   CFINIT(BUFFER),
   1808   CFINIT(BUFFERPTR),
   1809   CFINIT(BUFFERLENGTH),
   1810 
   1811   CFINIT(CONTENTTYPE),
   1812   CFINIT(CONTENTHEADER),
   1813   CFINIT(FILENAME),
   1814   CFINIT(END),
   1815   CFINIT(OBSOLETE2),
   1816 
   1817   CFINIT(STREAM),
   1818 
   1819   CURLFORM_LASTENTRY /* the last unused */
   1820 } CURLformoption;
   1821 
   1822 #undef CFINIT /* done */
   1823 
   1824 /* structure to be used as parameter for CURLFORM_ARRAY */
   1825 struct curl_forms {
   1826   CURLformoption option;
   1827   const char     *value;
   1828 };
   1829 
   1830 /* use this for multipart formpost building */
   1831 /* Returns code for curl_formadd()
   1832  *
   1833  * Returns:
   1834  * CURL_FORMADD_OK             on success
   1835  * CURL_FORMADD_MEMORY         if the FormInfo allocation fails
   1836  * CURL_FORMADD_OPTION_TWICE   if one option is given twice for one Form
   1837  * CURL_FORMADD_NULL           if a null pointer was given for a char
   1838  * CURL_FORMADD_MEMORY         if the allocation of a FormInfo struct failed
   1839  * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
   1840  * CURL_FORMADD_INCOMPLETE     if the some FormInfo is not complete (or error)
   1841  * CURL_FORMADD_MEMORY         if a curl_httppost struct cannot be allocated
   1842  * CURL_FORMADD_MEMORY         if some allocation for string copying failed.
   1843  * CURL_FORMADD_ILLEGAL_ARRAY  if an illegal option is used in an array
   1844  *
   1845  ***************************************************************************/
   1846 typedef enum {
   1847   CURL_FORMADD_OK, /* first, no error */
   1848 
   1849   CURL_FORMADD_MEMORY,
   1850   CURL_FORMADD_OPTION_TWICE,
   1851   CURL_FORMADD_NULL,
   1852   CURL_FORMADD_UNKNOWN_OPTION,
   1853   CURL_FORMADD_INCOMPLETE,
   1854   CURL_FORMADD_ILLEGAL_ARRAY,
   1855   CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
   1856 
   1857   CURL_FORMADD_LAST /* last */
   1858 } CURLFORMcode;
   1859 
   1860 /*
   1861  * NAME curl_formadd()
   1862  *
   1863  * DESCRIPTION
   1864  *
   1865  * Pretty advanced function for building multi-part formposts. Each invoke
   1866  * adds one part that together construct a full post. Then use
   1867  * CURLOPT_HTTPPOST to send it off to libcurl.
   1868  */
   1869 CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
   1870                                       struct curl_httppost **last_post,
   1871                                       ...);
   1872 
   1873 /*
   1874  * callback function for curl_formget()
   1875  * The void *arg pointer will be the one passed as second argument to
   1876  *   curl_formget().
   1877  * The character buffer passed to it must not be freed.
   1878  * Should return the buffer length passed to it as the argument "len" on
   1879  *   success.
   1880  */
   1881 typedef size_t (*curl_formget_callback)(void *arg, const char *buf,
   1882                                         size_t len);
   1883 
   1884 /*
   1885  * NAME curl_formget()
   1886  *
   1887  * DESCRIPTION
   1888  *
   1889  * Serialize a curl_httppost struct built with curl_formadd().
   1890  * Accepts a void pointer as second argument which will be passed to
   1891  * the curl_formget_callback function.
   1892  * Returns 0 on success.
   1893  */
   1894 CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
   1895                              curl_formget_callback append);
   1896 /*
   1897  * NAME curl_formfree()
   1898  *
   1899  * DESCRIPTION
   1900  *
   1901  * Free a multipart formpost previously built with curl_formadd().
   1902  */
   1903 CURL_EXTERN void curl_formfree(struct curl_httppost *form);
   1904 
   1905 /*
   1906  * NAME curl_getenv()
   1907  *
   1908  * DESCRIPTION
   1909  *
   1910  * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
   1911  * complete. DEPRECATED - see lib/README.curlx
   1912  */
   1913 CURL_EXTERN char *curl_getenv(const char *variable);
   1914 
   1915 /*
   1916  * NAME curl_version()
   1917  *
   1918  * DESCRIPTION
   1919  *
   1920  * Returns a static ascii string of the libcurl version.
   1921  */
   1922 CURL_EXTERN char *curl_version(void);
   1923 
   1924 /*
   1925  * NAME curl_easy_escape()
   1926  *
   1927  * DESCRIPTION
   1928  *
   1929  * Escapes URL strings (converts all letters consider illegal in URLs to their
   1930  * %XX versions). This function returns a new allocated string or NULL if an
   1931  * error occurred.
   1932  */
   1933 CURL_EXTERN char *curl_easy_escape(CURL *handle,
   1934                                    const char *string,
   1935                                    int length);
   1936 
   1937 /* the previous version: */
   1938 CURL_EXTERN char *curl_escape(const char *string,
   1939                               int length);
   1940 
   1941 
   1942 /*
   1943  * NAME curl_easy_unescape()
   1944  *
   1945  * DESCRIPTION
   1946  *
   1947  * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
   1948  * versions). This function returns a new allocated string or NULL if an error
   1949  * occurred.
   1950  * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
   1951  * converted into the host encoding.
   1952  */
   1953 CURL_EXTERN char *curl_easy_unescape(CURL *handle,
   1954                                      const char *string,
   1955                                      int length,
   1956                                      int *outlength);
   1957 
   1958 /* the previous version */
   1959 CURL_EXTERN char *curl_unescape(const char *string,
   1960                                 int length);
   1961 
   1962 /*
   1963  * NAME curl_free()
   1964  *
   1965  * DESCRIPTION
   1966  *
   1967  * Provided for de-allocation in the same translation unit that did the
   1968  * allocation. Added in libcurl 7.10
   1969  */
   1970 CURL_EXTERN void curl_free(void *p);
   1971 
   1972 /*
   1973  * NAME curl_global_init()
   1974  *
   1975  * DESCRIPTION
   1976  *
   1977  * curl_global_init() should be invoked exactly once for each application that
   1978  * uses libcurl and before any call of other libcurl functions.
   1979  *
   1980  * This function is not thread-safe!
   1981  */
   1982 CURL_EXTERN CURLcode curl_global_init(long flags);
   1983 
   1984 /*
   1985  * NAME curl_global_init_mem()
   1986  *
   1987  * DESCRIPTION
   1988  *
   1989  * curl_global_init() or curl_global_init_mem() should be invoked exactly once
   1990  * for each application that uses libcurl.  This function can be used to
   1991  * initialize libcurl and set user defined memory management callback
   1992  * functions.  Users can implement memory management routines to check for
   1993  * memory leaks, check for mis-use of the curl library etc.  User registered
   1994  * callback routines with be invoked by this library instead of the system
   1995  * memory management routines like malloc, free etc.
   1996  */
   1997 CURL_EXTERN CURLcode curl_global_init_mem(long flags,
   1998                                           curl_malloc_callback m,
   1999                                           curl_free_callback f,
   2000                                           curl_realloc_callback r,
   2001                                           curl_strdup_callback s,
   2002                                           curl_calloc_callback c);
   2003 
   2004 /*
   2005  * NAME curl_global_cleanup()
   2006  *
   2007  * DESCRIPTION
   2008  *
   2009  * curl_global_cleanup() should be invoked exactly once for each application
   2010  * that uses libcurl
   2011  */
   2012 CURL_EXTERN void curl_global_cleanup(void);
   2013 
   2014 /* linked-list structure for the CURLOPT_QUOTE option (and other) */
   2015 struct curl_slist {
   2016   char *data;
   2017   struct curl_slist *next;
   2018 };
   2019 
   2020 /*
   2021  * NAME curl_slist_append()
   2022  *
   2023  * DESCRIPTION
   2024  *
   2025  * Appends a string to a linked list. If no list exists, it will be created
   2026  * first. Returns the new list, after appending.
   2027  */
   2028 CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
   2029                                                  const char *);
   2030 
   2031 /*
   2032  * NAME curl_slist_free_all()
   2033  *
   2034  * DESCRIPTION
   2035  *
   2036  * free a previously built curl_slist.
   2037  */
   2038 CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
   2039 
   2040 /*
   2041  * NAME curl_getdate()
   2042  *
   2043  * DESCRIPTION
   2044  *
   2045  * Returns the time, in seconds since 1 Jan 1970 of the time string given in
   2046  * the first argument. The time argument in the second parameter is unused
   2047  * and should be set to NULL.
   2048  */
   2049 CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
   2050 
   2051 /* info about the certificate chain, only for OpenSSL builds. Asked
   2052    for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
   2053 struct curl_certinfo {
   2054   int num_of_certs;             /* number of certificates with information */
   2055   struct curl_slist **certinfo; /* for each index in this array, there's a
   2056                                    linked list with textual information in the
   2057                                    format "name: value" */
   2058 };
   2059 
   2060 /* enum for the different supported SSL backends */
   2061 typedef enum {
   2062   CURLSSLBACKEND_NONE = 0,
   2063   CURLSSLBACKEND_OPENSSL = 1,
   2064   CURLSSLBACKEND_GNUTLS = 2,
   2065   CURLSSLBACKEND_NSS = 3,
   2066   CURLSSLBACKEND_OBSOLETE4 = 4,  /* Was QSOSSL. */
   2067   CURLSSLBACKEND_GSKIT = 5,
   2068   CURLSSLBACKEND_POLARSSL = 6,
   2069   CURLSSLBACKEND_CYASSL = 7,
   2070   CURLSSLBACKEND_SCHANNEL = 8,
   2071   CURLSSLBACKEND_DARWINSSL = 9,
   2072   CURLSSLBACKEND_AXTLS = 10
   2073 } curl_sslbackend;
   2074 
   2075 /* Information about the SSL library used and the respective internal SSL
   2076    handle, which can be used to obtain further information regarding the
   2077    connection. Asked for with CURLINFO_TLS_SESSION. */
   2078 struct curl_tlssessioninfo {
   2079   curl_sslbackend backend;
   2080   void *internals;
   2081 };
   2082 
   2083 #define CURLINFO_STRING   0x100000
   2084 #define CURLINFO_LONG     0x200000
   2085 #define CURLINFO_DOUBLE   0x300000
   2086 #define CURLINFO_SLIST    0x400000
   2087 #define CURLINFO_MASK     0x0fffff
   2088 #define CURLINFO_TYPEMASK 0xf00000
   2089 
   2090 typedef enum {
   2091   CURLINFO_NONE, /* first, never use this */
   2092   CURLINFO_EFFECTIVE_URL    = CURLINFO_STRING + 1,
   2093   CURLINFO_RESPONSE_CODE    = CURLINFO_LONG   + 2,
   2094   CURLINFO_TOTAL_TIME       = CURLINFO_DOUBLE + 3,
   2095   CURLINFO_NAMELOOKUP_TIME  = CURLINFO_DOUBLE + 4,
   2096   CURLINFO_CONNECT_TIME     = CURLINFO_DOUBLE + 5,
   2097   CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
   2098   CURLINFO_SIZE_UPLOAD      = CURLINFO_DOUBLE + 7,
   2099   CURLINFO_SIZE_DOWNLOAD    = CURLINFO_DOUBLE + 8,
   2100   CURLINFO_SPEED_DOWNLOAD   = CURLINFO_DOUBLE + 9,
   2101   CURLINFO_SPEED_UPLOAD     = CURLINFO_DOUBLE + 10,
   2102   CURLINFO_HEADER_SIZE      = CURLINFO_LONG   + 11,
   2103   CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,
   2104   CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,
   2105   CURLINFO_FILETIME         = CURLINFO_LONG   + 14,
   2106   CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,
   2107   CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,
   2108   CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
   2109   CURLINFO_CONTENT_TYPE     = CURLINFO_STRING + 18,
   2110   CURLINFO_REDIRECT_TIME    = CURLINFO_DOUBLE + 19,
   2111   CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG   + 20,
   2112   CURLINFO_PRIVATE          = CURLINFO_STRING + 21,
   2113   CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,
   2114   CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,
   2115   CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,
   2116   CURLINFO_OS_ERRNO         = CURLINFO_LONG   + 25,
   2117   CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,
   2118   CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,
   2119   CURLINFO_COOKIELIST       = CURLINFO_SLIST  + 28,
   2120   CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,
   2121   CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,
   2122   CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,
   2123   CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,
   2124   CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,
   2125   CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,
   2126   CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,
   2127   CURLINFO_RTSP_SESSION_ID  = CURLINFO_STRING + 36,
   2128   CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG   + 37,
   2129   CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG   + 38,
   2130   CURLINFO_RTSP_CSEQ_RECV   = CURLINFO_LONG   + 39,
   2131   CURLINFO_PRIMARY_PORT     = CURLINFO_LONG   + 40,
   2132   CURLINFO_LOCAL_IP         = CURLINFO_STRING + 41,
   2133   CURLINFO_LOCAL_PORT       = CURLINFO_LONG   + 42,
   2134   CURLINFO_TLS_SESSION      = CURLINFO_SLIST  + 43,
   2135   /* Fill in new entries below here! */
   2136 
   2137   CURLINFO_LASTONE          = 43
   2138 } CURLINFO;
   2139 
   2140 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
   2141    CURLINFO_HTTP_CODE */
   2142 #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
   2143 
   2144 typedef enum {
   2145   CURLCLOSEPOLICY_NONE, /* first, never use this */
   2146 
   2147   CURLCLOSEPOLICY_OLDEST,
   2148   CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
   2149   CURLCLOSEPOLICY_LEAST_TRAFFIC,
   2150   CURLCLOSEPOLICY_SLOWEST,
   2151   CURLCLOSEPOLICY_CALLBACK,
   2152 
   2153   CURLCLOSEPOLICY_LAST /* last, never use this */
   2154 } curl_closepolicy;
   2155 
   2156 #define CURL_GLOBAL_SSL (1<<0)
   2157 #define CURL_GLOBAL_WIN32 (1<<1)
   2158 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
   2159 #define CURL_GLOBAL_NOTHING 0
   2160 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
   2161 #define CURL_GLOBAL_ACK_EINTR (1<<2)
   2162 
   2163 
   2164 /*****************************************************************************
   2165  * Setup defines, protos etc for the sharing stuff.
   2166  */
   2167 
   2168 /* Different data locks for a single share */
   2169 typedef enum {
   2170   CURL_LOCK_DATA_NONE = 0,
   2171   /*  CURL_LOCK_DATA_SHARE is used internally to say that
   2172    *  the locking is just made to change the internal state of the share
   2173    *  itself.
   2174    */
   2175   CURL_LOCK_DATA_SHARE,
   2176   CURL_LOCK_DATA_COOKIE,
   2177   CURL_LOCK_DATA_DNS,
   2178   CURL_LOCK_DATA_SSL_SESSION,
   2179   CURL_LOCK_DATA_CONNECT,
   2180   CURL_LOCK_DATA_LAST
   2181 } curl_lock_data;
   2182 
   2183 /* Different lock access types */
   2184 typedef enum {
   2185   CURL_LOCK_ACCESS_NONE = 0,   /* unspecified action */
   2186   CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
   2187   CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
   2188   CURL_LOCK_ACCESS_LAST        /* never use */
   2189 } curl_lock_access;
   2190 
   2191 typedef void (*curl_lock_function)(CURL *handle,
   2192                                    curl_lock_data data,
   2193                                    curl_lock_access locktype,
   2194                                    void *userptr);
   2195 typedef void (*curl_unlock_function)(CURL *handle,
   2196                                      curl_lock_data data,
   2197                                      void *userptr);
   2198 
   2199 typedef void CURLSH;
   2200 
   2201 typedef enum {
   2202   CURLSHE_OK,  /* all is fine */
   2203   CURLSHE_BAD_OPTION, /* 1 */
   2204   CURLSHE_IN_USE,     /* 2 */
   2205   CURLSHE_INVALID,    /* 3 */
   2206   CURLSHE_NOMEM,      /* 4 out of memory */
   2207   CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */
   2208   CURLSHE_LAST        /* never use */
   2209 } CURLSHcode;
   2210 
   2211 typedef enum {
   2212   CURLSHOPT_NONE,  /* don't use */
   2213   CURLSHOPT_SHARE,   /* specify a data type to share */
   2214   CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */
   2215   CURLSHOPT_LOCKFUNC,   /* pass in a 'curl_lock_function' pointer */
   2216   CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
   2217   CURLSHOPT_USERDATA,   /* pass in a user data pointer used in the lock/unlock
   2218                            callback functions */
   2219   CURLSHOPT_LAST  /* never use */
   2220 } CURLSHoption;
   2221 
   2222 CURL_EXTERN CURLSH *curl_share_init(void);
   2223 CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
   2224 CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
   2225 
   2226 /****************************************************************************
   2227  * Structures for querying information about the curl library at runtime.
   2228  */
   2229 
   2230 typedef enum {
   2231   CURLVERSION_FIRST,
   2232   CURLVERSION_SECOND,
   2233   CURLVERSION_THIRD,
   2234   CURLVERSION_FOURTH,
   2235   CURLVERSION_LAST /* never actually use this */
   2236 } CURLversion;
   2237 
   2238 /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
   2239    basically all programs ever that want to get version information. It is
   2240    meant to be a built-in version number for what kind of struct the caller
   2241    expects. If the struct ever changes, we redefine the NOW to another enum
   2242    from above. */
   2243 #define CURLVERSION_NOW CURLVERSION_FOURTH
   2244 
   2245 typedef struct {
   2246   CURLversion age;          /* age of the returned struct */
   2247   const char *version;      /* LIBCURL_VERSION */
   2248   unsigned int version_num; /* LIBCURL_VERSION_NUM */
   2249   const char *host;         /* OS/host/cpu/machine when configured */
   2250   int features;             /* bitmask, see defines below */
   2251   const char *ssl_version;  /* human readable string */
   2252   long ssl_version_num;     /* not used anymore, always 0 */
   2253   const char *libz_version; /* human readable string */
   2254   /* protocols is terminated by an entry with a NULL protoname */
   2255   const char * const *protocols;
   2256 
   2257   /* The fields below this were added in CURLVERSION_SECOND */
   2258   const char *ares;
   2259   int ares_num;
   2260 
   2261   /* This field was added in CURLVERSION_THIRD */
   2262   const char *libidn;
   2263 
   2264   /* These field were added in CURLVERSION_FOURTH */
   2265 
   2266   /* Same as '_libiconv_version' if built with HAVE_ICONV */
   2267   int iconv_ver_num;
   2268 
   2269   const char *libssh_version; /* human readable string */
   2270 
   2271 } curl_version_info_data;
   2272 
   2273 #define CURL_VERSION_IPV6         (1<<0)  /* IPv6-enabled */
   2274 #define CURL_VERSION_KERBEROS4    (1<<1)  /* Kerberos V4 auth is supported
   2275                                              (deprecated) */
   2276 #define CURL_VERSION_SSL          (1<<2)  /* SSL options are present */
   2277 #define CURL_VERSION_LIBZ         (1<<3)  /* libz features are present */
   2278 #define CURL_VERSION_NTLM         (1<<4)  /* NTLM auth is supported */
   2279 #define CURL_VERSION_GSSNEGOTIATE (1<<5)  /* Negotiate auth is supported
   2280                                              (deprecated) */
   2281 #define CURL_VERSION_DEBUG        (1<<6)  /* Built with debug capabilities */
   2282 #define CURL_VERSION_ASYNCHDNS    (1<<7)  /* Asynchronous DNS resolves */
   2283 #define CURL_VERSION_SPNEGO       (1<<8)  /* SPNEGO auth is supported */
   2284 #define CURL_VERSION_LARGEFILE    (1<<9)  /* Supports files larger than 2GB */
   2285 #define CURL_VERSION_IDN          (1<<10) /* Internationized Domain Names are
   2286                                              supported */
   2287 #define CURL_VERSION_SSPI         (1<<11) /* Built against Windows SSPI */
   2288 #define CURL_VERSION_CONV         (1<<12) /* Character conversions supported */
   2289 #define CURL_VERSION_CURLDEBUG    (1<<13) /* Debug memory tracking supported */
   2290 #define CURL_VERSION_TLSAUTH_SRP  (1<<14) /* TLS-SRP auth is supported */
   2291 #define CURL_VERSION_NTLM_WB      (1<<15) /* NTLM delegation to winbind helper
   2292                                              is suported */
   2293 #define CURL_VERSION_HTTP2        (1<<16) /* HTTP2 support built-in */
   2294 #define CURL_VERSION_GSSAPI       (1<<17) /* Built against a GSS-API library */
   2295 #define CURL_VERSION_KERBEROS5    (1<<18) /* Kerberos V5 auth is supported */
   2296 #define CURL_VERSION_UNIX_SOCKETS (1<<19) /* Unix domain sockets support */
   2297 
   2298  /*
   2299  * NAME curl_version_info()
   2300  *
   2301  * DESCRIPTION
   2302  *
   2303  * This function returns a pointer to a static copy of the version info
   2304  * struct. See above.
   2305  */
   2306 CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
   2307 
   2308 /*
   2309  * NAME curl_easy_strerror()
   2310  *
   2311  * DESCRIPTION
   2312  *
   2313  * The curl_easy_strerror function may be used to turn a CURLcode value
   2314  * into the equivalent human readable error string.  This is useful
   2315  * for printing meaningful error messages.
   2316  */
   2317 CURL_EXTERN const char *curl_easy_strerror(CURLcode);
   2318 
   2319 /*
   2320  * NAME curl_share_strerror()
   2321  *
   2322  * DESCRIPTION
   2323  *
   2324  * The curl_share_strerror function may be used to turn a CURLSHcode value
   2325  * into the equivalent human readable error string.  This is useful
   2326  * for printing meaningful error messages.
   2327  */
   2328 CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
   2329 
   2330 /*
   2331  * NAME curl_easy_pause()
   2332  *
   2333  * DESCRIPTION
   2334  *
   2335  * The curl_easy_pause function pauses or unpauses transfers. Select the new
   2336  * state by setting the bitmask, use the convenience defines below.
   2337  *
   2338  */
   2339 CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
   2340 
   2341 #define CURLPAUSE_RECV      (1<<0)
   2342 #define CURLPAUSE_RECV_CONT (0)
   2343 
   2344 #define CURLPAUSE_SEND      (1<<2)
   2345 #define CURLPAUSE_SEND_CONT (0)
   2346 
   2347 #define CURLPAUSE_ALL       (CURLPAUSE_RECV|CURLPAUSE_SEND)
   2348 #define CURLPAUSE_CONT      (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)
   2349 
   2350 #ifdef  __cplusplus
   2351 }
   2352 #endif
   2353 
   2354 /* unfortunately, the easy.h and multi.h include files need options and info
   2355   stuff before they can be included! */
   2356 #include "easy.h" /* nothing in curl is fun without the easy stuff */
   2357 #include "multi.h"
   2358 
   2359 /* the typechecker doesn't work in C++ (yet) */
   2360 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
   2361     ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
   2362     !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
   2363 #include "typecheck-gcc.h"
   2364 #else
   2365 #if defined(__STDC__) && (__STDC__ >= 1)
   2366 /* This preprocessor magic that replaces a call with the exact same call is
   2367    only done to make sure application authors pass exactly three arguments
   2368    to these functions. */
   2369 #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
   2370 #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
   2371 #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
   2372 #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
   2373 #endif /* __STDC__ >= 1 */
   2374 #endif /* gcc >= 4.3 && !__cplusplus */
   2375 
   2376 #endif /* __CURL_CURL_H */
   2377