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