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