| 1 |
/** |
| 2 |
This is an interface to the libcurl library. |
| 3 |
|
| 4 |
Converted to D from curl headers by $(LINK2 http://www.digitalmars.com/d/2.0/htod.html, htod) and |
| 5 |
cleaned up by Jonas Drewsen (jdrewsen) |
| 6 |
|
| 7 |
Windows x86 note: |
| 8 |
A DMD compatible libcurl static library can be downloaded from the dlang.org |
| 9 |
$(LINK2 http://dlang.org/download.html, download page). |
| 10 |
*/ |
| 11 |
|
| 12 |
/* ************************************************************************** |
| 13 |
* _ _ ____ _ |
| 14 |
* Project ___| | | | _ \| | |
| 15 |
* / __| | | | |_) | | |
| 16 |
* | (__| |_| | _ <| |___ |
| 17 |
* \___|\___/|_| \_\_____| |
| 18 |
*/ |
| 19 |
|
| 20 |
/** |
| 21 |
* Copyright (C) 1998 - 2010, Daniel Stenberg, <[email protected]>, et al. |
| 22 |
* |
| 23 |
* This software is licensed as described in the file COPYING, which |
| 24 |
* you should have received as part of this distribution. The terms |
| 25 |
* are also available at $(LINK http://curl.haxx.se/docs/copyright.html). |
| 26 |
* |
| 27 |
* You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 28 |
* copies of the Software, and permit persons to whom the Software is |
| 29 |
* furnished to do so, under the terms of the COPYING file. |
| 30 |
* |
| 31 |
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 32 |
* KIND, either express or implied. |
| 33 |
* |
| 34 |
***************************************************************************/ |
| 35 |
|
| 36 |
module etc.c.curl; |
| 37 |
|
| 38 |
import core.stdc.config; |
| 39 |
import core.stdc.time; |
| 40 |
import std.socket; |
| 41 |
|
| 42 |
// linux |
| 43 |
import core.sys.posix.sys.socket; |
| 44 |
|
| 45 |
// |
| 46 |
// LICENSE FROM CURL HEADERS |
| 47 |
// |
| 48 |
|
| 49 |
/** This is the global package copyright */ |
| 50 |
enum LIBCURL_COPYRIGHT = "1996 - 2010 Daniel Stenberg, <[email protected]>."; |
| 51 |
|
| 52 |
/** This is the version number of the libcurl package from which this header |
| 53 |
file origins: */ |
| 54 |
enum LIBCURL_VERSION = "7.21.4"; |
| 55 |
|
| 56 |
/** The numeric version number is also available "in parts" by using these |
| 57 |
constants */ |
| 58 |
enum LIBCURL_VERSION_MAJOR = 7; |
| 59 |
/// ditto |
| 60 |
enum LIBCURL_VERSION_MINOR = 21; |
| 61 |
/// ditto |
| 62 |
enum LIBCURL_VERSION_PATCH = 4; |
| 63 |
|
| 64 |
/** This is the numeric version of the libcurl version number, meant for easier |
| 65 |
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will |
| 66 |
always follow this syntax: |
| 67 |
|
| 68 |
0xXXYYZZ |
| 69 |
|
| 70 |
Where XX, YY and ZZ are the main version, release and patch numbers in |
| 71 |
hexadecimal (using 8 bits each). All three numbers are always represented |
| 72 |
using two digits. 1.2 would appear as "0x010200" while version 9.11.7 |
| 73 |
appears as "0x090b07". |
| 74 |
|
| 75 |
This 6-digit (24 bits) hexadecimal number does not show pre-release number, |
| 76 |
and it is always a greater number in a more recent release. It makes |
| 77 |
comparisons with greater than and less than work. |
| 78 |
*/ |
| 79 |
|
| 80 |
enum LIBCURL_VERSION_NUM = 0x071504; |
| 81 |
|
| 82 |
/** |
| 83 |
* This is the date and time when the full source package was created. The |
| 84 |
* timestamp is not stored in git, as the timestamp is properly set in the |
| 85 |
* tarballs by the maketgz script. |
| 86 |
* |
| 87 |
* The format of the date should follow this template: |
| 88 |
* |
| 89 |
* "Mon Feb 12 11:35:33 UTC 2007" |
| 90 |
*/ |
| 91 |
enum LIBCURL_TIMESTAMP = "Thu Feb 17 12:19:40 UTC 2011"; |
| 92 |
|
| 93 |
/** Data type definition of curl_off_t. |
| 94 |
* |
| 95 |
* jdrewsen - Always 64bit signed and that is what long is in D. |
| 96 |
* |
| 97 |
* Comment below is from curlbuild.h: |
| 98 |
* |
| 99 |
* NOTE 2: |
| 100 |
* |
| 101 |
* For any given platform/compiler curl_off_t must be typedef'ed to a |
| 102 |
* 64-bit wide signed integral data type. The width of this data type |
| 103 |
* must remain constant and independent of any possible large file |
| 104 |
* support settings. |
| 105 |
* |
| 106 |
* As an exception to the above, curl_off_t shall be typedef'ed to a |
| 107 |
* 32-bit wide signed integral data type if there is no 64-bit type. |
| 108 |
*/ |
| 109 |
alias curl_off_t = long; |
| 110 |
|
| 111 |
/// |
| 112 |
alias CURL = void; |
| 113 |
|
| 114 |
/// jdrewsen - Get socket alias from std.socket |
| 115 |
alias curl_socket_t = socket_t; |
| 116 |
|
| 117 |
/// jdrewsen - Would like to get socket error constant from std.socket by it is private atm. |
| 118 |
version (Windows) |
| 119 |
{ |
| 120 |
import core.sys.windows.winsock2; |
| 121 |
enum CURL_SOCKET_BAD = SOCKET_ERROR; |
| 122 |
} |
| 123 |
version (Posix) enum CURL_SOCKET_BAD = -1; |
| 124 |
|
| 125 |
/// |
| 126 |
extern (C) struct curl_httppost |
| 127 |
{ |
| 128 |
curl_httppost *next; /** next entry in the list */ |
| 129 |
char *name; /** pointer to allocated name */ |
| 130 |
c_long namelength; /** length of name length */ |
| 131 |
char *contents; /** pointer to allocated data contents */ |
| 132 |
c_long contentslength; /** length of contents field */ |
| 133 |
char *buffer; /** pointer to allocated buffer contents */ |
| 134 |
c_long bufferlength; /** length of buffer field */ |
| 135 |
char *contenttype; /** Content-Type */ |
| 136 |
curl_slist *contentheader; /** list of extra headers for this form */ |
| 137 |
curl_httppost *more; /** if one field name has more than one |
| 138 |
file, this link should link to following |
| 139 |
files */ |
| 140 |
c_long flags; /** as defined below */ |
| 141 |
char *showfilename; /** The file name to show. If not set, the |
| 142 |
actual file name will be used (if this |
| 143 |
is a file part) */ |
| 144 |
void *userp; /** custom pointer used for |
| 145 |
HTTPPOST_CALLBACK posts */ |
| 146 |
} |
| 147 |
|
| 148 |
enum HTTPPOST_FILENAME = 1; /** specified content is a file name */ |
| 149 |
enum HTTPPOST_READFILE = 2; /** specified content is a file name */ |
| 150 |
enum HTTPPOST_PTRNAME = 4; /** name is only stored pointer |
| 151 |
do not free in formfree */ |
| 152 |
enum HTTPPOST_PTRCONTENTS = 8; /** contents is only stored pointer |
| 153 |
do not free in formfree */ |
| 154 |
enum HTTPPOST_BUFFER = 16; /** upload file from buffer */ |
| 155 |
enum HTTPPOST_PTRBUFFER = 32; /** upload file from pointer contents */ |
| 156 |
enum HTTPPOST_CALLBACK = 64; /** upload file contents by using the |
| 157 |
regular read callback to get the data |
| 158 |
and pass the given pointer as custom |
| 159 |
pointer */ |
| 160 |
|
| 161 |
/// |
| 162 |
alias curl_progress_callback = int function(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); |
| 163 |
|
| 164 |
/** Tests have proven that 20K is a very bad buffer size for uploads on |
| 165 |
Windows, while 16K for some odd reason performed a lot better. |
| 166 |
We do the ifndef check to allow this value to easier be changed at build |
| 167 |
time for those who feel adventurous. The practical minimum is about |
| 168 |
400 bytes since libcurl uses a buffer of this size as a scratch area |
| 169 |
(unrelated to network send operations). */ |
| 170 |
enum CURL_MAX_WRITE_SIZE = 16_384; |
| 171 |
|
| 172 |
/** The only reason to have a max limit for this is to avoid the risk of a bad |
| 173 |
server feeding libcurl with a never-ending header that will cause reallocs |
| 174 |
infinitely */ |
| 175 |
enum CURL_MAX_HTTP_HEADER = (100*1024); |
| 176 |
|
| 177 |
|
| 178 |
/** This is a magic return code for the write callback that, when returned, |
| 179 |
will signal libcurl to pause receiving on the current transfer. */ |
| 180 |
enum CURL_WRITEFUNC_PAUSE = 0x10000001; |
| 181 |
|
| 182 |
/// |
| 183 |
alias curl_write_callback = size_t function(char *buffer, size_t size, size_t nitems, void *outstream); |
| 184 |
|
| 185 |
/** enumeration of file types */ |
| 186 |
enum CurlFileType { |
| 187 |
file, /// |
| 188 |
directory, /// |
| 189 |
symlink, /// |
| 190 |
device_block, /// |
| 191 |
device_char, /// |
| 192 |
namedpipe, /// |
| 193 |
socket, /// |
| 194 |
door, /// |
| 195 |
unknown /** is possible only on Sun Solaris now */ |
| 196 |
} |
| 197 |
|
| 198 |
/// |
| 199 |
alias curlfiletype = int; |
| 200 |
|
| 201 |
/// |
| 202 |
enum CurlFInfoFlagKnown { |
| 203 |
filename = 1, /// |
| 204 |
filetype = 2, /// |
| 205 |
time = 4, /// |
| 206 |
perm = 8, /// |
| 207 |
uid = 16, /// |
| 208 |
gid = 32, /// |
| 209 |
size = 64, /// |
| 210 |
hlinkcount = 128 /// |
| 211 |
} |
| 212 |
|
| 213 |
/** Content of this structure depends on information which is known and is |
| 214 |
achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man |
| 215 |
page for callbacks returning this structure -- some fields are mandatory, |
| 216 |
some others are optional. The FLAG field has special meaning. */ |
| 217 |
|
| 218 |
|
| 219 |
/** If some of these fields is not NULL, it is a pointer to b_data. */ |
| 220 |
extern (C) struct _N2 |
| 221 |
{ |
| 222 |
char *time; /// |
| 223 |
char *perm; /// |
| 224 |
char *user; /// |
| 225 |
char *group; /// |
| 226 |
char *target; /** pointer to the target filename of a symlink */ |
| 227 |
} |
| 228 |
|
| 229 |
/** Content of this structure depends on information which is known and is |
| 230 |
achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man |
| 231 |
page for callbacks returning this structure -- some fields are mandatory, |
| 232 |
some others are optional. The FLAG field has special meaning. */ |
| 233 |
extern (C) struct curl_fileinfo |
| 234 |
{ |
| 235 |
char *filename; /// |
| 236 |
curlfiletype filetype; /// |
| 237 |
time_t time; /// |
| 238 |
uint perm; /// |
| 239 |
int uid; /// |
| 240 |
int gid; /// |
| 241 |
curl_off_t size; /// |
| 242 |
c_long hardlinks; /// |
| 243 |
_N2 strings; /// |
| 244 |
uint flags; /// |
| 245 |
char *b_data; /// |
| 246 |
size_t b_size; /// |
| 247 |
size_t b_used; /// |
| 248 |
} |
| 249 |
|
| 250 |
/** return codes for CURLOPT_CHUNK_BGN_FUNCTION */ |
| 251 |
enum CurlChunkBgnFunc { |
| 252 |
ok = 0, /// |
| 253 |
fail = 1, /** tell the lib to end the task */ |
| 254 |
skip = 2 /** skip this chunk over */ |
| 255 |
} |
| 256 |
|
| 257 |
/** if splitting of data transfer is enabled, this callback is called before |
| 258 |
download of an individual chunk started. Note that parameter "remains" works |
| 259 |
only for FTP wildcard downloading (for now), otherwise is not used */ |
| 260 |
alias curl_chunk_bgn_callback = c_long function(const(void) *transfer_info, void *ptr, int remains); |
| 261 |
|
| 262 |
/** return codes for CURLOPT_CHUNK_END_FUNCTION */ |
| 263 |
enum CurlChunkEndFunc { |
| 264 |
ok = 0, /// |
| 265 |
fail = 1, /// |
| 266 |
} |
| 267 |
/** If splitting of data transfer is enabled this callback is called after |
| 268 |
download of an individual chunk finished. |
| 269 |
Note! After this callback was set then it have to be called FOR ALL chunks. |
| 270 |
Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC. |
| 271 |
This is the reason why we don't need "transfer_info" parameter in this |
| 272 |
callback and we are not interested in "remains" parameter too. */ |
| 273 |
alias curl_chunk_end_callback = c_long function(void *ptr); |
| 274 |
|
| 275 |
/** return codes for FNMATCHFUNCTION */ |
| 276 |
enum CurlFnMAtchFunc { |
| 277 |
match = 0, /// |
| 278 |
nomatch = 1, /// |
| 279 |
fail = 2 /// |
| 280 |
} |
| 281 |
|
| 282 |
/** callback type for wildcard downloading pattern matching. If the |
| 283 |
string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */ |
| 284 |
alias curl_fnmatch_callback = int function(void *ptr, in const(char) *pattern, in const(char) *string); |
| 285 |
|
| 286 |
/// seek whence... |
| 287 |
enum CurlSeekPos { |
| 288 |
set, /// |
| 289 |
current, /// |
| 290 |
end /// |
| 291 |
} |
| 292 |
|
| 293 |
/** These are the return codes for the seek callbacks */ |
| 294 |
enum CurlSeek { |
| 295 |
ok, /// |
| 296 |
fail, /** fail the entire transfer */ |
| 297 |
cantseek /** tell libcurl seeking can't be done, so |
| 298 |
libcurl might try other means instead */ |
| 299 |
} |
| 300 |
|
| 301 |
/// |
| 302 |
alias curl_seek_callback = int function(void *instream, curl_off_t offset, int origin); |
| 303 |
|
| 304 |
/// |
| 305 |
enum CurlReadFunc { |
| 306 |
/** This is a return code for the read callback that, when returned, will |
| 307 |
signal libcurl to immediately abort the current transfer. */ |
| 308 |
abort = 0x10000000, |
| 309 |
|
| 310 |
/** This is a return code for the read callback that, when returned, |
| 311 |
will const signal libcurl to pause sending data on the current |
| 312 |
transfer. */ |
| 313 |
pause = 0x10000001 |
| 314 |
} |
| 315 |
|
| 316 |
/// |
| 317 |
alias curl_read_callback = size_t function(char *buffer, size_t size, size_t nitems, void *instream); |
| 318 |
|
| 319 |
/// |
| 320 |
enum CurlSockType { |
| 321 |
ipcxn, /** socket created for a specific IP connection */ |
| 322 |
last /** never use */ |
| 323 |
} |
| 324 |
/// |
| 325 |
alias curlsocktype = int; |
| 326 |
|
| 327 |
/// |
| 328 |
alias curl_sockopt_callback = int function(void *clientp, curl_socket_t curlfd, curlsocktype purpose); |
| 329 |
|
| 330 |
/** addrlen was a socklen_t type before 7.18.0 but it turned really |
| 331 |
ugly and painful on the systems that lack this type */ |
| 332 |
extern (C) struct curl_sockaddr |
| 333 |
{ |
| 334 |
int family; /// |
| 335 |
int socktype; /// |
| 336 |
int protocol; /// |
| 337 |
uint addrlen; /** addrlen was a socklen_t type before 7.18.0 but it |
| 338 |
turned really ugly and painful on the systems that |
| 339 |
lack this type */ |
| 340 |
sockaddr addr; /// |
| 341 |
} |
| 342 |
|
| 343 |
/// |
| 344 |
alias curl_opensocket_callback = curl_socket_t function(void *clientp, curlsocktype purpose, curl_sockaddr *address); |
| 345 |
|
| 346 |
/// |
| 347 |
enum CurlIoError |
| 348 |
{ |
| 349 |
ok, /** I/O operation successful */ |
| 350 |
unknowncmd, /** command was unknown to callback */ |
| 351 |
failrestart, /** failed to restart the read */ |
| 352 |
last /** never use */ |
| 353 |
} |
| 354 |
/// |
| 355 |
alias curlioerr = int; |
| 356 |
|
| 357 |
/// |
| 358 |
enum CurlIoCmd { |
| 359 |
nop, /** command was unknown to callback */ |
| 360 |
restartread, /** failed to restart the read */ |
| 361 |
last, /** never use */ |
| 362 |
} |
| 363 |
/// |
| 364 |
alias curliocmd = int; |
| 365 |
|
| 366 |
/// |
| 367 |
alias curl_ioctl_callback = curlioerr function(CURL *handle, int cmd, void *clientp); |
| 368 |
|
| 369 |
/** |
| 370 |
* The following typedef's are signatures of malloc, free, realloc, strdup and |
| 371 |
* calloc respectively. Function pointers of these types can be passed to the |
| 372 |
* curl_global_init_mem() function to set user defined memory management |
| 373 |
* callback routines. |
| 374 |
*/ |
| 375 |
alias curl_malloc_callback = void* function(size_t size); |
| 376 |
/// ditto |
| 377 |
alias curl_free_callback = void function(void *ptr); |
| 378 |
/// ditto |
| 379 |
alias curl_realloc_callback = void* function(void *ptr, size_t size); |
| 380 |
/// ditto |
| 381 |
alias curl_strdup_callback = char * function(in const(char) *str); |
| 382 |
/// ditto |
| 383 |
alias curl_calloc_callback = void* function(size_t nmemb, size_t size); |
| 384 |
|
| 385 |
/** the kind of data that is passed to information_callback*/ |
| 386 |
enum CurlCallbackInfo { |
| 387 |
text, /// |
| 388 |
header_in, /// |
| 389 |
header_out, /// |
| 390 |
data_in, /// |
| 391 |
data_out, /// |
| 392 |
ssl_data_in, /// |
| 393 |
ssl_data_out, /// |
| 394 |
end /// |
| 395 |
} |
| 396 |
/// |
| 397 |
alias curl_infotype = int; |
| 398 |
|
| 399 |
/// |
| 400 |
alias curl_debug_callback = |
| 401 |
int function(CURL *handle, /** the handle/transfer this concerns */ |
| 402 |
curl_infotype type, /** what kind of data */ |
| 403 |
char *data, /** points to the data */ |
| 404 |
size_t size, /** size of the data pointed to */ |
| 405 |
void *userptr /** whatever the user please */ |
| 406 |
); |
| 407 |
|
| 408 |
/** All possible error codes from all sorts of curl functions. Future versions |
| 409 |
may return other values, stay prepared. |
| 410 |
|
| 411 |
Always add new return codes last. Never *EVER* remove any. The return |
| 412 |
codes must remain the same! |
| 413 |
*/ |
| 414 |
enum CurlError |
| 415 |
{ |
| 416 |
ok, /// |
| 417 |
unsupported_protocol, /** 1 */ |
| 418 |
failed_init, /** 2 */ |
| 419 |
url_malformat, /** 3 */ |
| 420 |
not_built_in, /** 4 - [was obsoleted in August 2007 for |
| 421 |
7.17.0, reused in April 2011 for 7.21.5] */ |
| 422 |
couldnt_resolve_proxy, /** 5 */ |
| 423 |
couldnt_resolve_host, /** 6 */ |
| 424 |
couldnt_connect, /** 7 */ |
| 425 |
ftp_weird_server_reply, /** 8 */ |
| 426 |
remote_access_denied, /** 9 a service was denied by the server |
| 427 |
due to lack of access - when login fails |
| 428 |
this is not returned. */ |
| 429 |
obsolete10, /** 10 - NOT USED */ |
| 430 |
ftp_weird_pass_reply, /** 11 */ |
| 431 |
obsolete12, /** 12 - NOT USED */ |
| 432 |
ftp_weird_pasv_reply, /** 13 */ |
| 433 |
ftp_weird_227_format, /** 14 */ |
| 434 |
ftp_cant_get_host, /** 15 */ |
| 435 |
obsolete16, /** 16 - NOT USED */ |
| 436 |
ftp_couldnt_set_type, /** 17 */ |
| 437 |
partial_file, /** 18 */ |
| 438 |
ftp_couldnt_retr_file, /** 19 */ |
| 439 |
obsolete20, /** 20 - NOT USED */ |
| 440 |
quote_error, /** 21 - quote command failure */ |
| 441 |
http_returned_error, /** 22 */ |
| 442 |
write_error, /** 23 */ |
| 443 |
obsolete24, /** 24 - NOT USED */ |
| 444 |
upload_failed, /** 25 - failed upload "command" */ |
| 445 |
read_error, /** 26 - couldn't open/read from file */ |
| 446 |
out_of_memory, /** 27 */ |
| 447 |
/** Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error |
| 448 |
instead of a memory allocation error if CURL_DOES_CONVERSIONS |
| 449 |
is defined |
| 450 |
*/ |
| 451 |
operation_timedout, /** 28 - the timeout time was reached */ |
| 452 |
obsolete29, /** 29 - NOT USED */ |
| 453 |
ftp_port_failed, /** 30 - FTP PORT operation failed */ |
| 454 |
ftp_couldnt_use_rest, /** 31 - the REST command failed */ |
| 455 |
obsolete32, /** 32 - NOT USED */ |
| 456 |
range_error, /** 33 - RANGE "command" didn't work */ |
| 457 |
http_post_error, /** 34 */ |
| 458 |
ssl_connect_error, /** 35 - wrong when connecting with SSL */ |
| 459 |
bad_download_resume, /** 36 - couldn't resume download */ |
| 460 |
file_couldnt_read_file, /** 37 */ |
| 461 |
ldap_cannot_bind, /** 38 */ |
| 462 |
ldap_search_failed, /** 39 */ |
| 463 |
obsolete40, /** 40 - NOT USED */ |
| 464 |
function_not_found, /** 41 */ |
| 465 |
aborted_by_callback, /** 42 */ |
| 466 |
bad_function_argument, /** 43 */ |
| 467 |
obsolete44, /** 44 - NOT USED */ |
| 468 |
interface_failed, /** 45 - CURLOPT_INTERFACE failed */ |
| 469 |
obsolete46, /** 46 - NOT USED */ |
| 470 |
too_many_redirects, /** 47 - catch endless re-direct loops */ |
| 471 |
unknown_option, /** 48 - User specified an unknown option */ |
| 472 |
telnet_option_syntax, /** 49 - Malformed telnet option */ |
| 473 |
obsolete50, /** 50 - NOT USED */ |
| 474 |
peer_failed_verification, /** 51 - peer's certificate or fingerprint |
| 475 |
wasn't verified fine */ |
| 476 |
got_nothing, /** 52 - when this is a specific error */ |
| 477 |
ssl_engine_notfound, /** 53 - SSL crypto engine not found */ |
| 478 |
ssl_engine_setfailed, /** 54 - can not set SSL crypto engine as default */ |
| 479 |
send_error, /** 55 - failed sending network data */ |
| 480 |
recv_error, /** 56 - failure in receiving network data */ |
| 481 |
obsolete57, /** 57 - NOT IN USE */ |
| 482 |
ssl_certproblem, /** 58 - problem with the local certificate */ |
| 483 |
ssl_cipher, /** 59 - couldn't use specified cipher */ |
| 484 |
ssl_cacert, /** 60 - problem with the CA cert (path?) */ |
| 485 |
bad_content_encoding, /** 61 - Unrecognized transfer encoding */ |
| 486 |
ldap_invalid_url, /** 62 - Invalid LDAP URL */ |
| 487 |
filesize_exceeded, /** 63 - Maximum file size exceeded */ |
| 488 |
use_ssl_failed, /** 64 - Requested FTP SSL level failed */ |
| 489 |
send_fail_rewind, /** 65 - Sending the data requires a rewind that failed */ |
| 490 |
ssl_engine_initfailed, /** 66 - failed to initialise ENGINE */ |
| 491 |
login_denied, /** 67 - user, password or similar was not accepted and we failed to login */ |
| 492 |
tftp_notfound, /** 68 - file not found on server */ |
| 493 |
tftp_perm, /** 69 - permission problem on server */ |
| 494 |
remote_disk_full, /** 70 - out of disk space on server */ |
| 495 |
tftp_illegal, /** 71 - Illegal TFTP operation */ |
| 496 |
tftp_unknownid, /** 72 - Unknown transfer ID */ |
| 497 |
remote_file_exists, /** 73 - File already exists */ |
| 498 |
tftp_nosuchuser, /** 74 - No such user */ |
| 499 |
conv_failed, /** 75 - conversion failed */ |
| 500 |
conv_reqd, /** 76 - caller must register conversion |
| 501 |
callbacks using curl_easy_setopt options |
| 502 |
CURLOPT_CONV_FROM_NETWORK_FUNCTION, |
| 503 |
CURLOPT_CONV_TO_NETWORK_FUNCTION, and |
| 504 |
CURLOPT_CONV_FROM_UTF8_FUNCTION */ |
| 505 |
ssl_cacert_badfile, /** 77 - could not load CACERT file, missing or wrong format */ |
| 506 |
remote_file_not_found, /** 78 - remote file not found */ |
| 507 |
ssh, /** 79 - error from the SSH layer, somewhat |
| 508 |
generic so the error message will be of |
| 509 |
interest when this has happened */ |
| 510 |
ssl_shutdown_failed, /** 80 - Failed to shut down the SSL connection */ |
| 511 |
again, /** 81 - socket is not ready for send/recv, |
| 512 |
wait till it's ready and try again (Added |
| 513 |
in 7.18.2) */ |
| 514 |
ssl_crl_badfile, /** 82 - could not load CRL file, missing or wrong format (Added in 7.19.0) */ |
| 515 |
ssl_issuer_error, /** 83 - Issuer check failed. (Added in 7.19.0) */ |
| 516 |
ftp_pret_failed, /** 84 - a PRET command failed */ |
| 517 |
rtsp_cseq_error, /** 85 - mismatch of RTSP CSeq numbers */ |
| 518 |
rtsp_session_error, /** 86 - mismatch of RTSP Session Identifiers */ |
| 519 |
ftp_bad_file_list, /** 87 - unable to parse FTP file list */ |
| 520 |
chunk_failed, /** 88 - chunk callback reported error */ |
| 521 |
curl_last /** never use! */ |
| 522 |
} |
| 523 |
/// |
| 524 |
alias CURLcode = int; |
| 525 |
|
| 526 |
/** This prototype applies to all conversion callbacks */ |
| 527 |
alias curl_conv_callback = CURLcode function(char *buffer, size_t length); |
| 528 |
|
| 529 |
/** actually an OpenSSL SSL_CTX */ |
| 530 |
alias curl_ssl_ctx_callback = |
| 531 |
CURLcode function(CURL *curl, /** easy handle */ |
| 532 |
void *ssl_ctx, /** actually an OpenSSL SSL_CTX */ |
| 533 |
void *userptr |
| 534 |
); |
| 535 |
|
| 536 |
/// |
| 537 |
enum CurlProxy { |
| 538 |
http, /** added in 7.10, new in 7.19.4 default is to use CONNECT HTTP/1.1 */ |
| 539 |
http_1_0, /** added in 7.19.4, force to use CONNECT HTTP/1.0 */ |
| 540 |
socks4 = 4, /** support added in 7.15.2, enum existed already in 7.10 */ |
| 541 |
socks5 = 5, /** added in 7.10 */ |
| 542 |
socks4a = 6, /** added in 7.18.0 */ |
| 543 |
socks5_hostname =7 /** Use the SOCKS5 protocol but pass along the |
| 544 |
host name rather than the IP address. added |
| 545 |
in 7.18.0 */ |
| 546 |
} |
| 547 |
/// |
| 548 |
alias curl_proxytype = int; |
| 549 |
|
| 550 |
/// |
| 551 |
enum CurlAuth : ulong { |
| 552 |
none = 0UL, /** None */ |
| 553 |
basic = 1UL << 0, /** Basic (default) */ |
| 554 |
digest = 1UL << 1, /** Digest */ |
| 555 |
negotiate = 1UL << 2, /** Negotiate (SPNEGO) */ |
| 556 |
gssnegotiate = negotiate, /** GSS-Negotiate */ |
| 557 |
gssapi = negotiate, /** GSS-Negoatiate */ |
| 558 |
ntlm = 1UL << 3, /** NTLM */ |
| 559 |
digest_ie = 1UL << 4, /** Digest with IE flavour */ |
| 560 |
ntlm_WB = 1UL << 5, /** NTML delegated to winbind helper */ |
| 561 |
bearer = 1UL << 6, /** Bearer token authentication */ |
| 562 |
only = 1UL << 31, /** used together with a single other |
| 563 |
type to force no auth or just that |
| 564 |
single type */ |
| 565 |
any = ~digest_ie, /** any allows */ |
| 566 |
anysafe = ~(basic | digest_ie) /** any except basic */ |
| 567 |
} |
| 568 |
|
| 569 |
/// |
| 570 |
enum CurlSshAuth { |
| 571 |
any = ~0, /** all types supported by the server */ |
| 572 |
none = 0, /** none allowed, silly but complete */ |
| 573 |
publickey = 1 << 0, /** public/private key files */ |
| 574 |
password = 1 << 1, /** password */ |
| 575 |
host = 1 << 2, /** host key files */ |
| 576 |
keyboard = 1 << 3, /** keyboard interactive */ |
| 577 |
agent = 1 << 4, /** agent (ssh-agent, pageant...) */ |
| 578 |
gssapi = 1 << 5, /** gssapi (kerberos, ...) */ |
| 579 |
|
| 580 |
default_ = any // CURLSSH_AUTH_ANY; |
| 581 |
} |
| 582 |
/// |
| 583 |
enum CURL_ERROR_SIZE = 256; |
| 584 |
/** points to a zero-terminated string encoded with base64 |
| 585 |
if len is zero, otherwise to the "raw" data */ |
| 586 |
enum CurlKHType |
| 587 |
{ |
| 588 |
unknown, /// |
| 589 |
rsa1, /// |
| 590 |
rsa, /// |
| 591 |
dss /// |
| 592 |
} |
| 593 |
/// |
| 594 |
extern (C) struct curl_khkey |
| 595 |
{ |
| 596 |
const(char) *key; /** points to a zero-terminated string encoded with base64 |
| 597 |
if len is zero, otherwise to the "raw" data */ |
| 598 |
size_t len; /// |
| 599 |
CurlKHType keytype; /// |
| 600 |
} |
| 601 |
|
| 602 |
/** this is the set of return values expected from the curl_sshkeycallback |
| 603 |
callback */ |
| 604 |
enum CurlKHStat { |
| 605 |
fine_add_to_file, /// |
| 606 |
fine, /// |
| 607 |
reject, /** reject the connection, return an error */ |
| 608 |
defer, /** do not accept it, but we can't answer right now so |
| 609 |
this causes a CURLE_DEFER error but otherwise the |
| 610 |
connection will be left intact etc */ |
| 611 |
last /** not for use, only a marker for last-in-list */ |
| 612 |
} |
| 613 |
|
| 614 |
/** this is the set of status codes pass in to the callback */ |
| 615 |
enum CurlKHMatch { |
| 616 |
ok, /** match */ |
| 617 |
mismatch, /** host found, key mismatch! */ |
| 618 |
missing, /** no matching host/key found */ |
| 619 |
last /** not for use, only a marker for last-in-list */ |
| 620 |
} |
| 621 |
|
| 622 |
/// |
| 623 |
alias curl_sshkeycallback = |
| 624 |
int function(CURL *easy, /** easy handle */ |
| 625 |
const(curl_khkey) *knownkey, /** known */ |
| 626 |
const(curl_khkey) *foundkey, /** found */ |
| 627 |
CurlKHMatch m, /** libcurl's view on the keys */ |
| 628 |
void *clientp /** custom pointer passed from app */ |
| 629 |
); |
| 630 |
|
| 631 |
/** parameter for the CURLOPT_USE_SSL option */ |
| 632 |
enum CurlUseSSL { |
| 633 |
none, /** do not attempt to use SSL */ |
| 634 |
tryssl, /** try using SSL, proceed anyway otherwise */ |
| 635 |
control, /** SSL for the control connection or fail */ |
| 636 |
all, /** SSL for all communication or fail */ |
| 637 |
last /** not an option, never use */ |
| 638 |
} |
| 639 |
/// |
| 640 |
alias curl_usessl = int; |
| 641 |
|
| 642 |
/** parameter for the CURLOPT_FTP_SSL_CCC option */ |
| 643 |
enum CurlFtpSSL { |
| 644 |
ccc_none, /** do not send CCC */ |
| 645 |
ccc_passive, /** Let the server initiate the shutdown */ |
| 646 |
ccc_active, /** Initiate the shutdown */ |
| 647 |
ccc_last /** not an option, never use */ |
| 648 |
} |
| 649 |
/// |
| 650 |
alias curl_ftpccc = int; |
| 651 |
|
| 652 |
/** parameter for the CURLOPT_FTPSSLAUTH option */ |
| 653 |
enum CurlFtpAuth { |
| 654 |
defaultauth, /** let libcurl decide */ |
| 655 |
ssl, /** use "AUTH SSL" */ |
| 656 |
tls, /** use "AUTH TLS" */ |
| 657 |
last /** not an option, never use */ |
| 658 |
} |
| 659 |
/// |
| 660 |
alias curl_ftpauth = int; |
| 661 |
|
| 662 |
/** parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */ |
| 663 |
enum CurlFtp { |
| 664 |
create_dir_none, /** do NOT create missing dirs! */ |
| 665 |
create_dir, /** (FTP/SFTP) if CWD fails, try MKD and then CWD again if MKD |
| 666 |
succeeded, for SFTP this does similar magic */ |
| 667 |
create_dir_retry, /** (FTP only) if CWD fails, try MKD and then CWD again even if MKD |
| 668 |
failed! */ |
| 669 |
create_dir_last /** not an option, never use */ |
| 670 |
} |
| 671 |
/// |
| 672 |
alias curl_ftpcreatedir = int; |
| 673 |
|
| 674 |
/** parameter for the CURLOPT_FTP_FILEMETHOD option */ |
| 675 |
enum CurlFtpMethod { |
| 676 |
defaultmethod, /** let libcurl pick */ |
| 677 |
multicwd, /** single CWD operation for each path part */ |
| 678 |
nocwd, /** no CWD at all */ |
| 679 |
singlecwd, /** one CWD to full dir, then work on file */ |
| 680 |
last /** not an option, never use */ |
| 681 |
} |
| 682 |
/// |
| 683 |
alias curl_ftpmethod = int; |
| 684 |
|
| 685 |
/** CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */ |
| 686 |
enum CurlProto { |
| 687 |
http = 1, /// |
| 688 |
https = 2, /// |
| 689 |
ftp = 4, /// |
| 690 |
ftps = 8, /// |
| 691 |
scp = 16, /// |
| 692 |
sftp = 32, /// |
| 693 |
telnet = 64, /// |
| 694 |
ldap = 128, /// |
| 695 |
ldaps = 256, /// |
| 696 |
dict = 512, /// |
| 697 |
file = 1024, /// |
| 698 |
tftp = 2048, /// |
| 699 |
imap = 4096, /// |
| 700 |
imaps = 8192, /// |
| 701 |
pop3 = 16_384, /// |
| 702 |
pop3s = 32_768, /// |
| 703 |
smtp = 65_536, /// |
| 704 |
smtps = 131_072, /// |
| 705 |
rtsp = 262_144, /// |
| 706 |
rtmp = 524_288, /// |
| 707 |
rtmpt = 1_048_576, /// |
| 708 |
rtmpe = 2_097_152, /// |
| 709 |
rtmpte = 4_194_304, /// |
| 710 |
rtmps = 8_388_608, /// |
| 711 |
rtmpts = 16_777_216, /// |
| 712 |
gopher = 33_554_432, /// |
| 713 |
all = -1 /** enable everything */ |
| 714 |
} |
| 715 |
|
| 716 |
/** long may be 32 or 64 bits, but we should never depend on anything else |
| 717 |
but 32 */ |
| 718 |
enum CURLOPTTYPE_LONG = 0; |
| 719 |
/// ditto |
| 720 |
enum CURLOPTTYPE_OBJECTPOINT = 10_000; |
| 721 |
/// ditto |
| 722 |
enum CURLOPTTYPE_FUNCTIONPOINT = 20_000; |
| 723 |
|
| 724 |
/// ditto |
| 725 |
enum CURLOPTTYPE_OFF_T = 30_000; |
| 726 |
/** name is uppercase CURLOPT_$(LT)name$(GT), |
| 727 |
type is one of the defined CURLOPTTYPE_$(LT)type$(GT) |
| 728 |
number is unique identifier */ |
| 729 |
|
| 730 |
/** The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ |
| 731 |
alias LONG = CURLOPTTYPE_LONG; |
| 732 |
/// ditto |
| 733 |
alias OBJECTPOINT = CURLOPTTYPE_OBJECTPOINT; |
| 734 |
/// ditto |
| 735 |
alias FUNCTIONPOINT = CURLOPTTYPE_FUNCTIONPOINT; |
| 736 |
|
| 737 |
/// ditto |
| 738 |
alias OFF_T = CURLOPTTYPE_OFF_T; |
| 739 |
|
| 740 |
/// |
| 741 |
enum CurlOption { |
| 742 |
/** This is the FILE * or void * the regular output should be written to. */ |
| 743 |
file = 10_001, |
| 744 |
/** The full URL to get/put */ |
| 745 |
url, |
| 746 |
/** Port number to connect to, if other than default. */ |
| 747 |
port = 3, |
| 748 |
/** Name of proxy to use. */ |
| 749 |
proxy = 10_004, |
| 750 |
/** "name:password" to use when fetching. */ |
| 751 |
userpwd, |
| 752 |
/** "name:password" to use with proxy. */ |
| 753 |
proxyuserpwd, |
| 754 |
/** Range to get, specified as an ASCII string. */ |
| 755 |
range, |
| 756 |
/** not used */ |
| 757 |
|
| 758 |
/** Specified file stream to upload from (use as input): */ |
| 759 |
infile = 10_009, |
| 760 |
/** Buffer to receive error messages in, must be at least CURL_ERROR_SIZE |
| 761 |
* bytes big. If this is not used, error messages go to stderr instead: */ |
| 762 |
errorbuffer, |
| 763 |
/** Function that will be called to store the output (instead of fwrite). The |
| 764 |
* parameters will use fwrite() syntax, make sure to follow them. */ |
| 765 |
writefunction = 20_011, |
| 766 |
/** Function that will be called to read the input (instead of fread). The |
| 767 |
* parameters will use fread() syntax, make sure to follow them. */ |
| 768 |
readfunction, |
| 769 |
/** Time-out the read operation after this amount of seconds */ |
| 770 |
timeout = 13, |
| 771 |
/** If the CURLOPT_INFILE is used, this can be used to inform libcurl about |
| 772 |
* how large the file being sent really is. That allows better error |
| 773 |
* checking and better verifies that the upload was successful. -1 means |
| 774 |
* unknown size. |
| 775 |
* |
| 776 |
* For large file support, there is also a _LARGE version of the key |
| 777 |
* which takes an off_t type, allowing platforms with larger off_t |
| 778 |
* sizes to handle larger files. See below for INFILESIZE_LARGE. |
| 779 |
*/ |
| 780 |
infilesize, |
| 781 |
/** POST static input fields. */ |
| 782 |
postfields = 10_015, |
| 783 |
/** Set the referrer page (needed by some CGIs) */ |
| 784 |
referer, |
| 785 |
/** Set the FTP PORT string (interface name, named or numerical IP address) |
| 786 |
Use i.e '-' to use default address. */ |
| 787 |
ftpport, |
| 788 |
/** Set the User-Agent string (examined by some CGIs) */ |
| 789 |
useragent, |
| 790 |
/** If the download receives less than "low speed limit" bytes/second |
| 791 |
* during "low speed time" seconds, the operations is aborted. |
| 792 |
* You could i.e if you have a pretty high speed connection, abort if |
| 793 |
* it is less than 2000 bytes/sec during 20 seconds. |
| 794 |
*/ |
| 795 |
|
| 796 |
/** Set the "low speed limit" */ |
| 797 |
low_speed_limit = 19, |
| 798 |
/** Set the "low speed time" */ |
| 799 |
low_speed_time, |
| 800 |
/** Set the continuation offset. |
| 801 |
* |
| 802 |
* Note there is also a _LARGE version of this key which uses |
| 803 |
* off_t types, allowing for large file offsets on platforms which |
| 804 |
* use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE. |
| 805 |
*/ |
| 806 |
resume_from, |
| 807 |
/** Set cookie in request: */ |
| 808 |
cookie = 10_022, |
| 809 |
/** This points to a linked list of headers, struct curl_slist kind */ |
| 810 |
httpheader, |
| 811 |
/** This points to a linked list of post entries, struct curl_httppost */ |
| 812 |
httppost, |
| 813 |
/** name of the file keeping your private SSL-certificate */ |
| 814 |
sslcert, |
| 815 |
/** password for the SSL or SSH private key */ |
| 816 |
keypasswd, |
| 817 |
/** send TYPE parameter? */ |
| 818 |
crlf = 27, |
| 819 |
/** send linked-list of QUOTE commands */ |
| 820 |
quote = 10_028, |
| 821 |
/** send FILE * or void * to store headers to, if you use a callback it |
| 822 |
is simply passed to the callback unmodified */ |
| 823 |
writeheader, |
| 824 |
/** point to a file to read the initial cookies from, also enables |
| 825 |
"cookie awareness" */ |
| 826 |
cookiefile = 10_031, |
| 827 |
/** What version to specifically try to use. |
| 828 |
See CURL_SSLVERSION defines below. */ |
| 829 |
sslversion = 32, |
| 830 |
/** What kind of HTTP time condition to use, see defines */ |
| 831 |
timecondition, |
| 832 |
/** Time to use with the above condition. Specified in number of seconds |
| 833 |
since 1 Jan 1970 */ |
| 834 |
timevalue, |
| 835 |
/* 35 = OBSOLETE */ |
| 836 |
|
| 837 |
/** Custom request, for customizing the get command like |
| 838 |
HTTP: DELETE, TRACE and others |
| 839 |
FTP: to use a different list command |
| 840 |
*/ |
| 841 |
customrequest = 10_036, |
| 842 |
/** HTTP request, for odd commands like DELETE, TRACE and others */ |
| 843 |
stderr, |
| 844 |
/* 38 is not used */ |
| 845 |
|
| 846 |
/** send linked-list of post-transfer QUOTE commands */ |
| 847 |
postquote = 10_039, |
| 848 |
/** Pass a pointer to string of the output using full variable-replacement |
| 849 |
as described elsewhere. */ |
| 850 |
writeinfo, |
| 851 |
verbose = 41, /** talk a lot */ |
| 852 |
header, /** throw the header out too */ |
| 853 |
noprogress, /** shut off the progress meter */ |
| 854 |
nobody, /** use HEAD to get http document */ |
| 855 |
failonerror, /** no output on http error codes >= 300 */ |
| 856 |
upload, /** this is an upload */ |
| 857 |
post, /** HTTP POST method */ |
| 858 |
dirlistonly, /** return bare names when listing directories */ |
| 859 |
append = 50, /** Append instead of overwrite on upload! */ |
| 860 |
/** Specify whether to read the user+password from the .netrc or the URL. |
| 861 |
* This must be one of the CURL_NETRC_* enums below. */ |
| 862 |
netrc, |
| 863 |
followlocation, /** use Location: Luke! */ |
| 864 |
transfertext, /** transfer data in text/ASCII format */ |
| 865 |
put, /** HTTP PUT */ |
| 866 |
/* 55 = OBSOLETE */ |
| 867 |
|
| 868 |
/** Function that will be called instead of the internal progress display |
| 869 |
* function. This function should be defined as the curl_progress_callback |
| 870 |
* prototype defines. */ |
| 871 |
progressfunction = 20_056, |
| 872 |
/** Data passed to the progress callback */ |
| 873 |
progressdata = 10_057, |
| 874 |
/** We want the referrer field set automatically when following locations */ |
| 875 |
autoreferer = 58, |
| 876 |
/** Port of the proxy, can be set in the proxy string as well with: |
| 877 |
`[host]:[port]` */ |
| 878 |
proxyport, |
| 879 |
/** size of the POST input data, if strlen() is not good to use */ |
| 880 |
postfieldsize, |
| 881 |
/** tunnel non-http operations through a HTTP proxy */ |
| 882 |
httpproxytunnel, |
| 883 |
/** Set the interface string to use as outgoing network interface */ |
| 884 |
intrface = 10_062, |
| 885 |
/** Set the krb4/5 security level, this also enables krb4/5 awareness. This |
| 886 |
* is a string, 'clear', 'safe', 'confidential' or 'private'. If the string |
| 887 |
* is set but doesn't match one of these, 'private' will be used. */ |
| 888 |
krblevel, |
| 889 |
/** Set if we should verify the peer in ssl handshake, set 1 to verify. */ |
| 890 |
ssl_verifypeer = 64, |
| 891 |
/** The CApath or CAfile used to validate the peer certificate |
| 892 |
this option is used only if SSL_VERIFYPEER is true */ |
| 893 |
cainfo = 10_065, |
| 894 |
/* 66 = OBSOLETE */ |
| 895 |
/* 67 = OBSOLETE */ |
| 896 |
|
| 897 |
/** Maximum number of http redirects to follow */ |
| 898 |
maxredirs = 68, |
| 899 |
/** Pass a long set to 1 to get the date of the requested document (if |
| 900 |
possible)! Pass a zero to shut it off. */ |
| 901 |
filetime, |
| 902 |
/** This points to a linked list of telnet options */ |
| 903 |
telnetoptions = 10_070, |
| 904 |
/** Max amount of cached alive connections */ |
| 905 |
maxconnects = 71, |
| 906 |
/** What policy to use when closing connections when the cache is filled |
| 907 |
up */ |
| 908 |
closepolicy, |
| 909 |
/* 73 = OBSOLETE */ |
| 910 |
|
| 911 |
/** Set to explicitly use a new connection for the upcoming transfer. |
| 912 |
Do not use this unless you're absolutely sure of this, as it makes the |
| 913 |
operation slower and is less friendly for the network. */ |
| 914 |
fresh_connect = 74, |
| 915 |
/** Set to explicitly forbid the upcoming transfer's connection to be re-used |
| 916 |
when done. Do not use this unless you're absolutely sure of this, as it |
| 917 |
makes the operation slower and is less friendly for the network. */ |
| 918 |
forbid_reuse, |
| 919 |
/** Set to a file name that contains random data for libcurl to use to |
| 920 |
seed the random engine when doing SSL connects. */ |
| 921 |
random_file = 10_076, |
| 922 |
/** Set to the Entropy Gathering Daemon socket pathname */ |
| 923 |
egdsocket, |
| 924 |
/** Time-out connect operations after this amount of seconds, if connects |
| 925 |
are OK within this time, then fine... This only aborts the connect |
| 926 |
phase. [Only works on unix-style/SIGALRM operating systems] */ |
| 927 |
connecttimeout = 78, |
| 928 |
/** Function that will be called to store headers (instead of fwrite). The |
| 929 |
* parameters will use fwrite() syntax, make sure to follow them. */ |
| 930 |
headerfunction = 20_079, |
| 931 |
/** Set this to force the HTTP request to get back to GET. Only really usable |
| 932 |
if POST, PUT or a custom request have been used first. |
| 933 |
*/ |
| 934 |
httpget = 80, |
| 935 |
/** Set if we should verify the Common name from the peer certificate in ssl |
| 936 |
* handshake, set 1 to check existence, 2 to ensure that it matches the |
| 937 |
* provided hostname. */ |
| 938 |
ssl_verifyhost, |
| 939 |
/** Specify which file name to write all known cookies in after completed |
| 940 |
operation. Set file name to "-" (dash) to make it go to stdout. */ |
| 941 |
cookiejar = 10_082, |
| 942 |
/** Specify which SSL ciphers to use */ |
| 943 |
ssl_cipher_list, |
| 944 |
/** Specify which HTTP version to use! This must be set to one of the |
| 945 |
CURL_HTTP_VERSION* enums set below. */ |
| 946 |
http_version = 84, |
| 947 |
/** Specifically switch on or off the FTP engine's use of the EPSV command. By |
| 948 |
default, that one will always be attempted before the more traditional |
| 949 |
PASV command. */ |
| 950 |
ftp_use_epsv, |
| 951 |
/** type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */ |
| 952 |
sslcerttype = 10_086, |
| 953 |
/** name of the file keeping your private SSL-key */ |
| 954 |
sslkey, |
| 955 |
/** type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */ |
| 956 |
sslkeytype, |
| 957 |
/** crypto engine for the SSL-sub system */ |
| 958 |
sslengine, |
| 959 |
/** set the crypto engine for the SSL-sub system as default |
| 960 |
the param has no meaning... |
| 961 |
*/ |
| 962 |
sslengine_default = 90, |
| 963 |
/** Non-zero value means to use the global dns cache */ |
| 964 |
dns_use_global_cache, |
| 965 |
/** DNS cache timeout */ |
| 966 |
dns_cache_timeout, |
| 967 |
/** send linked-list of pre-transfer QUOTE commands */ |
| 968 |
prequote = 10_093, |
| 969 |
/** set the debug function */ |
| 970 |
debugfunction = 20_094, |
| 971 |
/** set the data for the debug function */ |
| 972 |
debugdata = 10_095, |
| 973 |
/** mark this as start of a cookie session */ |
| 974 |
cookiesession = 96, |
| 975 |
/** The CApath directory used to validate the peer certificate |
| 976 |
this option is used only if SSL_VERIFYPEER is true */ |
| 977 |
capath = 10_097, |
| 978 |
/** Instruct libcurl to use a smaller receive buffer */ |
| 979 |
buffersize = 98, |
| 980 |
/** Instruct libcurl to not use any signal/alarm handlers, even when using |
| 981 |
timeouts. This option is useful for multi-threaded applications. |
| 982 |
See libcurl-the-guide for more background information. */ |
| 983 |
nosignal, |
| 984 |
/** Provide a CURLShare for mutexing non-ts data */ |
| 985 |
share = 10_100, |
| 986 |
/** indicates type of proxy. accepted values are CURLPROXY_HTTP (default), |
| 987 |
CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */ |
| 988 |
proxytype = 101, |
| 989 |
/** Set the Accept-Encoding string. Use this to tell a server you would like |
| 990 |
the response to be compressed. */ |
| 991 |
encoding = 10_102, |
| 992 |
/** Set pointer to private data */ |
| 993 |
private_opt, |
| 994 |
/** Set aliases for HTTP 200 in the HTTP Response header */ |
| 995 |
http200aliases, |
| 996 |
/** Continue to send authentication (user+password) when following locations, |
| 997 |
even when hostname changed. This can potentially send off the name |
| 998 |
and password to whatever host the server decides. */ |
| 999 |
unrestricted_auth = 105, |
| 1000 |
/** Specifically switch on or off the FTP engine's use of the EPRT command ( it |
| 1001 |
also disables the LPRT attempt). By default, those ones will always be |
| 1002 |
attempted before the good old traditional PORT command. */ |
| 1003 |
ftp_use_eprt, |
| 1004 |
/** Set this to a bitmask value to enable the particular authentications |
| 1005 |
methods you like. Use this in combination with CURLOPT_USERPWD. |
| 1006 |
Note that setting multiple bits may cause extra network round-trips. */ |
| 1007 |
httpauth, |
| 1008 |
/** Set the ssl context callback function, currently only for OpenSSL ssl_ctx |
| 1009 |
in second argument. The function must be matching the |
| 1010 |
curl_ssl_ctx_callback proto. */ |
| 1011 |
ssl_ctx_function = 20_108, |
| 1012 |
/** Set the userdata for the ssl context callback function's third |
| 1013 |
argument */ |
| 1014 |
ssl_ctx_data = 10_109, |
| 1015 |
/** FTP Option that causes missing dirs to be created on the remote server. |
| 1016 |
In 7.19.4 we introduced the convenience enums for this option using the |
| 1017 |
CURLFTP_CREATE_DIR prefix. |
| 1018 |
*/ |
| 1019 |
ftp_create_missing_dirs = 110, |
| 1020 |
/** Set this to a bitmask value to enable the particular authentications |
| 1021 |
methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. |
| 1022 |
Note that setting multiple bits may cause extra network round-trips. */ |
| 1023 |
proxyauth, |
| 1024 |
/** FTP option that changes the timeout, in seconds, associated with |
| 1025 |
getting a response. This is different from transfer timeout time and |
| 1026 |
essentially places a demand on the FTP server to acknowledge commands |
| 1027 |
in a timely manner. */ |
| 1028 |
ftp_response_timeout, |
| 1029 |
/** Set this option to one of the CURL_IPRESOLVE_* defines (see below) to |
| 1030 |
tell libcurl to resolve names to those IP versions only. This only has |
| 1031 |
affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */ |
| 1032 |
ipresolve, |
| 1033 |
/** Set this option to limit the size of a file that will be downloaded from |
| 1034 |
an HTTP or FTP server. |
| 1035 |
|
| 1036 |
Note there is also _LARGE version which adds large file support for |
| 1037 |
platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */ |
| 1038 |
maxfilesize, |
| 1039 |
/** See the comment for INFILESIZE above, but in short, specifies |
| 1040 |
* the size of the file being uploaded. -1 means unknown. |
| 1041 |
*/ |
| 1042 |
infilesize_large = 30_115, |
| 1043 |
/** Sets the continuation offset. There is also a LONG version of this; |
| 1044 |
* look above for RESUME_FROM. |
| 1045 |
*/ |
| 1046 |
resume_from_large, |
| 1047 |
/** Sets the maximum size of data that will be downloaded from |
| 1048 |
* an HTTP or FTP server. See MAXFILESIZE above for the LONG version. |
| 1049 |
*/ |
| 1050 |
maxfilesize_large, |
| 1051 |
/** Set this option to the file name of your .netrc file you want libcurl |
| 1052 |
to parse (using the CURLOPT_NETRC option). If not set, libcurl will do |
| 1053 |
a poor attempt to find the user's home directory and check for a .netrc |
| 1054 |
file in there. */ |
| 1055 |
netrc_file = 10_118, |
| 1056 |
/** Enable SSL/TLS for FTP, pick one of: |
| 1057 |
CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise |
| 1058 |
CURLFTPSSL_CONTROL - SSL for the control connection or fail |
| 1059 |
CURLFTPSSL_ALL - SSL for all communication or fail |
| 1060 |
*/ |
| 1061 |
use_ssl = 119, |
| 1062 |
/** The _LARGE version of the standard POSTFIELDSIZE option */ |
| 1063 |
postfieldsize_large = 30_120, |
| 1064 |
/** Enable/disable the TCP Nagle algorithm */ |
| 1065 |
tcp_nodelay = 121, |
| 1066 |
/* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ |
| 1067 |
/* 123 OBSOLETE. Gone in 7.16.0 */ |
| 1068 |
/* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ |
| 1069 |
/* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ |
| 1070 |
/* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ |
| 1071 |
/* 127 OBSOLETE. Gone in 7.16.0 */ |
| 1072 |
/* 128 OBSOLETE. Gone in 7.16.0 */ |
| 1073 |
|
| 1074 |
/** When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option |
| 1075 |
can be used to change libcurl's default action which is to first try |
| 1076 |
"AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK |
| 1077 |
response has been received. |
| 1078 |
|
| 1079 |
Available parameters are: |
| 1080 |
CURLFTPAUTH_DEFAULT - let libcurl decide |
| 1081 |
CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS |
| 1082 |
CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL |
| 1083 |
*/ |
| 1084 |
ftpsslauth = 129, |
| 1085 |
ioctlfunction = 20_130, /// |
| 1086 |
ioctldata = 10_131, /// |
| 1087 |
/* 132 OBSOLETE. Gone in 7.16.0 */ |
| 1088 |
/* 133 OBSOLETE. Gone in 7.16.0 */ |
| 1089 |
|
| 1090 |
/** zero terminated string for pass on to the FTP server when asked for |
| 1091 |
"account" info */ |
| 1092 |
ftp_account = 10_134, |
| 1093 |
/** feed cookies into cookie engine */ |
| 1094 |
cookielist, |
| 1095 |
/** ignore Content-Length */ |
| 1096 |
ignore_content_length = 136, |
| 1097 |
/** Set to non-zero to skip the IP address received in a 227 PASV FTP server |
| 1098 |
response. Typically used for FTP-SSL purposes but is not restricted to |
| 1099 |
that. libcurl will then instead use the same IP address it used for the |
| 1100 |
control connection. */ |
| 1101 |
ftp_skip_pasv_ip, |
| 1102 |
/** Select "file method" to use when doing FTP, see the curl_ftpmethod |
| 1103 |
above. */ |
| 1104 |
ftp_filemethod, |
| 1105 |
/** Local port number to bind the socket to */ |
| 1106 |
localport, |
| 1107 |
/** Number of ports to try, including the first one set with LOCALPORT. |
| 1108 |
Thus, setting it to 1 will make no additional attempts but the first. |
| 1109 |
*/ |
| 1110 |
localportrange, |
| 1111 |
/** no transfer, set up connection and let application use the socket by |
| 1112 |
extracting it with CURLINFO_LASTSOCKET */ |
| 1113 |
connect_only, |
| 1114 |
/** Function that will be called to convert from the |
| 1115 |
network encoding (instead of using the iconv calls in libcurl) */ |
| 1116 |
conv_from_network_function = 20_142, |
| 1117 |
/** Function that will be called to convert to the |
| 1118 |
network encoding (instead of using the iconv calls in libcurl) */ |
| 1119 |
conv_to_network_function, |
| 1120 |
/** Function that will be called to convert from UTF8 |
| 1121 |
(instead of using the iconv calls in libcurl) |
| 1122 |
Note that this is used only for SSL certificate processing */ |
| 1123 |
conv_from_utf8_function, |
| 1124 |
/** If the connection proceeds too quickly then need to slow it down */ |
| 1125 |
/** */ |
| 1126 |
/** limit-rate: maximum number of bytes per second to send or receive */ |
| 1127 |
max_send_speed_large = 30_145, |
| 1128 |
max_recv_speed_large, /// ditto |
| 1129 |
/** Pointer to command string to send if USER/PASS fails. */ |
| 1130 |
ftp_alternative_to_user = 10_147, |
| 1131 |
/** callback function for setting socket options */ |
| 1132 |
sockoptfunction = 20_148, |
| 1133 |
sockoptdata = 10_149, |
| 1134 |
/** set to 0 to disable session ID re-use for this transfer, default is |
| 1135 |
enabled (== 1) */ |
| 1136 |
ssl_sessionid_cache = 150, |
| 1137 |
/** allowed SSH authentication methods */ |
| 1138 |
ssh_auth_types, |
| 1139 |
/** Used by scp/sftp to do public/private key authentication */ |
| 1140 |
ssh_public_keyfile = 10_152, |
| 1141 |
ssh_private_keyfile, |
| 1142 |
/** Send CCC (Clear Command Channel) after authentication */ |
| 1143 |
ftp_ssl_ccc = 154, |
| 1144 |
/** Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */ |
| 1145 |
timeout_ms, |
| 1146 |
connecttimeout_ms, /// ditto |
| 1147 |
/** set to zero to disable the libcurl's decoding and thus pass the raw body |
| 1148 |
data to the application even when it is encoded/compressed */ |
| 1149 |
http_transfer_decoding, |
| 1150 |
http_content_decoding, /// ditto |
| 1151 |
/** Permission used when creating new files and directories on the remote |
| 1152 |
server for protocols that support it, SFTP/SCP/FILE */ |
| 1153 |
new_file_perms, |
| 1154 |
new_directory_perms, /// ditto |
| 1155 |
/** Set the behaviour of POST when redirecting. Values must be set to one |
| 1156 |
of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */ |
| 1157 |
postredir, |
| 1158 |
/** used by scp/sftp to verify the host's public key */ |
| 1159 |
ssh_host_public_key_md5 = 10_162, |
| 1160 |
/** Callback function for opening socket (instead of socket(2)). Optionally, |
| 1161 |
callback is able change the address or refuse to connect returning |
| 1162 |
CURL_SOCKET_BAD. The callback should have type |
| 1163 |
curl_opensocket_callback */ |
| 1164 |
opensocketfunction = 20_163, |
| 1165 |
opensocketdata = 10_164, /// ditto |
| 1166 |
/** POST volatile input fields. */ |
| 1167 |
copypostfields, |
| 1168 |
/** set transfer mode (;type=$(LT)a|i$(GT)) when doing FTP via an HTTP proxy */ |
| 1169 |
proxy_transfer_mode = 166, |
| 1170 |
/** Callback function for seeking in the input stream */ |
| 1171 |
seekfunction = 20_167, |
| 1172 |
seekdata = 10_168, /// ditto |
| 1173 |
/** CRL file */ |
| 1174 |
crlfile, |
| 1175 |
/** Issuer certificate */ |
| 1176 |
issuercert, |
| 1177 |
/** (IPv6) Address scope */ |
| 1178 |
address_scope = 171, |
| 1179 |
/** Collect certificate chain info and allow it to get retrievable with |
| 1180 |
CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only |
| 1181 |
working with OpenSSL-powered builds. */ |
| 1182 |
certinfo, |
| 1183 |
/** "name" and "pwd" to use when fetching. */ |
| 1184 |
username = 10_173, |
| 1185 |
password, /// ditto |
| 1186 |
/** "name" and "pwd" to use with Proxy when fetching. */ |
| 1187 |
proxyusername, |
| 1188 |
proxypassword, /// ditto |
| 1189 |
/** Comma separated list of hostnames defining no-proxy zones. These should |
| 1190 |
match both hostnames directly, and hostnames within a domain. For |
| 1191 |
example, local.com will match local.com and www.local.com, but NOT |
| 1192 |
notlocal.com or www.notlocal.com. For compatibility with other |
| 1193 |
implementations of this, .local.com will be considered to be the same as |
| 1194 |
local.com. A single * is the only valid wildcard, and effectively |
| 1195 |
disables the use of proxy. */ |
| 1196 |
noproxy, |
| 1197 |
/** block size for TFTP transfers */ |
| 1198 |
tftp_blksize = 178, |
| 1199 |
/** Socks Service */ |
| 1200 |
socks5_gssapi_service = 10_179, |
| 1201 |
/** Socks Service */ |
| 1202 |
socks5_gssapi_nec = 180, |
| 1203 |
/** set the bitmask for the protocols that are allowed to be used for the |
| 1204 |
transfer, which thus helps the app which takes URLs from users or other |
| 1205 |
external inputs and want to restrict what protocol(s) to deal |
| 1206 |
with. Defaults to CURLPROTO_ALL. */ |
| 1207 |
protocols, |
| 1208 |
/** set the bitmask for the protocols that libcurl is allowed to follow to, |
| 1209 |
as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs |
| 1210 |
to be set in both bitmasks to be allowed to get redirected to. Defaults |
| 1211 |
to all protocols except FILE and SCP. */ |
| 1212 |
redir_protocols, |
| 1213 |
/** set the SSH knownhost file name to use */ |
| 1214 |
ssh_knownhosts = 10_183, |
| 1215 |
/** set the SSH host key callback, must point to a curl_sshkeycallback |
| 1216 |
function */ |
| 1217 |
ssh_keyfunction = 20_184, |
| 1218 |
/** set the SSH host key callback custom pointer */ |
| 1219 |
ssh_keydata = 10_185, |
| 1220 |
/** set the SMTP mail originator */ |
| 1221 |
mail_from, |
| 1222 |
/** set the SMTP mail receiver(s) */ |
| 1223 |
mail_rcpt, |
| 1224 |
/** FTP: send PRET before PASV */ |
| 1225 |
ftp_use_pret = 188, |
| 1226 |
/** RTSP request method (OPTIONS, SETUP, PLAY, etc...) */ |
| 1227 |
rtsp_request, |
| 1228 |
/** The RTSP session identifier */ |
| 1229 |
rtsp_session_id = 10_190, |
| 1230 |
/** The RTSP stream URI */ |
| 1231 |
rtsp_stream_uri, |
| 1232 |
/** The Transport: header to use in RTSP requests */ |
| 1233 |
rtsp_transport, |
| 1234 |
/** Manually initialize the client RTSP CSeq for this handle */ |
| 1235 |
rtsp_client_cseq = 193, |
| 1236 |
/** Manually initialize the server RTSP CSeq for this handle */ |
| 1237 |
rtsp_server_cseq, |
| 1238 |
/** The stream to pass to INTERLEAVEFUNCTION. */ |
| 1239 |
interleavedata = 10_195, |
| 1240 |
/** Let the application define a custom write method for RTP data */ |
| 1241 |
interleavefunction = 20_196, |
| 1242 |
/** Turn on wildcard matching */ |
| 1243 |
wildcardmatch = 197, |
| 1244 |
/** Directory matching callback called before downloading of an |
| 1245 |
individual file (chunk) started */ |
| 1246 |
chunk_bgn_function = 20_198, |
| 1247 |
/** Directory matching callback called after the file (chunk) |
| 1248 |
was downloaded, or skipped */ |
| 1249 |
chunk_end_function, |
| 1250 |
/** Change match (fnmatch-like) callback for wildcard matching */ |
| 1251 |
fnmatch_function, |
| 1252 |
/** Let the application define custom chunk data pointer */ |
| 1253 |
chunk_data = 10_201, |
| 1254 |
/** FNMATCH_FUNCTION user pointer */ |
| 1255 |
fnmatch_data, |
| 1256 |
/** send linked-list of name:port:address sets */ |
| 1257 |
resolve, |
| 1258 |
/** Set a username for authenticated TLS */ |
| 1259 |
tlsauth_username, |
| 1260 |
/** Set a password for authenticated TLS */ |
| 1261 |
tlsauth_password, |
| 1262 |
/** Set authentication type for authenticated TLS */ |
| 1263 |
tlsauth_type, |
| 1264 |
/** the last unused */ |
| 1265 |
lastentry, |
| 1266 |
|
| 1267 |
writedata = file, /// convenient alias |
| 1268 |
readdata = infile, /// ditto |
| 1269 |
headerdata = writeheader, /// ditto |
| 1270 |
rtspheader = httpheader, /// ditto |
| 1271 |
} |
| 1272 |
/// |
| 1273 |
alias CURLoption = int; |
| 1274 |
/// |
| 1275 |
enum CURLOPT_SERVER_RESPONSE_TIMEOUT = CurlOption.ftp_response_timeout; |
| 1276 |
|
| 1277 |
/** Below here follows defines for the CURLOPT_IPRESOLVE option. If a host |
| 1278 |
name resolves addresses using more than one IP protocol version, this |
| 1279 |
option might be handy to force libcurl to use a specific IP version. */ |
| 1280 |
enum CurlIpResolve { |
| 1281 |
whatever = 0, /** default, resolves addresses to all IP versions that your system allows */ |
| 1282 |
v4 = 1, /** resolve to ipv4 addresses */ |
| 1283 |
v6 = 2 /** resolve to ipv6 addresses */ |
| 1284 |
} |
| 1285 |
|
| 1286 |
/** three convenient "aliases" that follow the name scheme better */ |
| 1287 |
enum CURLOPT_WRITEDATA = CurlOption.file; |
| 1288 |
/// ditto |
| 1289 |
enum CURLOPT_READDATA = CurlOption.infile; |
| 1290 |
/// ditto |
| 1291 |
enum CURLOPT_HEADERDATA = CurlOption.writeheader; |
| 1292 |
/// ditto |
| 1293 |
enum CURLOPT_RTSPHEADER = CurlOption.httpheader; |
| 1294 |
|
| 1295 |
/** These enums are for use with the CURLOPT_HTTP_VERSION option. */ |
| 1296 |
enum CurlHttpVersion { |
| 1297 |
none, /** setting this means we don't care, and that we'd |
| 1298 |
like the library to choose the best possible |
| 1299 |
for us! */ |
| 1300 |
v1_0, /** please use HTTP 1.0 in the request */ |
| 1301 |
v1_1, /** please use HTTP 1.1 in the request */ |
| 1302 |
last /** *ILLEGAL* http version */ |
| 1303 |
} |
| 1304 |
|
| 1305 |
/** |
| 1306 |
* Public API enums for RTSP requests |
| 1307 |
*/ |
| 1308 |
enum CurlRtspReq { |
| 1309 |
none, /// |
| 1310 |
options, /// |
| 1311 |
describe, /// |
| 1312 |
announce, /// |
| 1313 |
setup, /// |
| 1314 |
play, /// |
| 1315 |
pause, /// |
| 1316 |
teardown, /// |
| 1317 |
get_parameter, /// |
| 1318 |
set_parameter, /// |
| 1319 |
record, /// |
| 1320 |
receive, /// |
| 1321 |
last /// |
| 1322 |
} |
| 1323 |
|
| 1324 |
/** These enums are for use with the CURLOPT_NETRC option. */ |
| 1325 |
enum CurlNetRcOption { |
| 1326 |
ignored, /** The .netrc will never be read. This is the default. */ |
| 1327 |
optional /** A user:password in the URL will be preferred to one in the .netrc. */, |
| 1328 |
required, /** A user:password in the URL will be ignored. |
| 1329 |
* Unless one is set programmatically, the .netrc |
| 1330 |
* will be queried. */ |
| 1331 |
last /// |
| 1332 |
} |
| 1333 |
|
| 1334 |
/// |
| 1335 |
enum CurlSslVersion { |
| 1336 |
default_version, /// |
| 1337 |
tlsv1, /// |
| 1338 |
sslv2, /// |
| 1339 |
sslv3, /// |
| 1340 |
last /** never use */ |
| 1341 |
} |
| 1342 |
|
| 1343 |
/// |
| 1344 |
enum CurlTlsAuth { |
| 1345 |
none, /// |
| 1346 |
srp, /// |
| 1347 |
last /** never use */ |
| 1348 |
} |
| 1349 |
|
| 1350 |
/** symbols to use with CURLOPT_POSTREDIR. |
| 1351 |
CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that |
| 1352 |
CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */ |
| 1353 |
enum CurlRedir { |
| 1354 |
get_all = 0, /// |
| 1355 |
post_301 = 1, /// |
| 1356 |
post_302 = 2, /// |
| 1357 |
/// |
| 1358 |
post_all = (1 | 2) // (CURL_REDIR_POST_301|CURL_REDIR_POST_302); |
| 1359 |
} |
| 1360 |
/// |
| 1361 |
enum CurlTimeCond { |
| 1362 |
none, /// |
| 1363 |
ifmodsince, /// |
| 1364 |
ifunmodsince, /// |
| 1365 |
lastmod, /// |
| 1366 |
last /// |
| 1367 |
} |
| 1368 |
/// |
| 1369 |
alias curl_TimeCond = int; |
| 1370 |
|
| 1371 |
|
| 1372 |
/** curl_strequal() and curl_strnequal() are subject for removal in a future |
| 1373 |
libcurl, see lib/README.curlx for details */ |
| 1374 |
extern (C) { |
| 1375 |
int curl_strequal(scope const(char) *s1, scope const(char) *s2); |
| 1376 |
/// ditto |
| 1377 |
int curl_strnequal(scope const(char) *s1, scope const(char) *s2, size_t n); |
| 1378 |
} |
| 1379 |
enum CurlForm { |
| 1380 |
nothing, /********** the first one is unused ************/ |
| 1381 |
copyname, |
| 1382 |
ptrname, |
| 1383 |
namelength, |
| 1384 |
copycontents, |
| 1385 |
ptrcontents, |
| 1386 |
contentslength, |
| 1387 |
filecontent, |
| 1388 |
array, |
| 1389 |
obsolete, |
| 1390 |
file, |
| 1391 |
buffer, |
| 1392 |
bufferptr, |
| 1393 |
bufferlength, |
| 1394 |
contenttype, |
| 1395 |
contentheader, |
| 1396 |
filename, |
| 1397 |
end, |
| 1398 |
obsolete2, |
| 1399 |
stream, |
| 1400 |
lastentry /** the last unused */ |
| 1401 |
} |
| 1402 |
alias CURLformoption = int; |
| 1403 |
|
| 1404 |
|
| 1405 |
/** structure to be used as parameter for CURLFORM_ARRAY */ |
| 1406 |
extern (C) struct curl_forms |
| 1407 |
{ |
| 1408 |
CURLformoption option; /// |
| 1409 |
const(char) *value; /// |
| 1410 |
} |
| 1411 |
|
| 1412 |
/** Use this for multipart formpost building |
| 1413 |
* |
| 1414 |
* Returns code for curl_formadd() |
| 1415 |
* |
| 1416 |
* Returns: |
| 1417 |
* |
| 1418 |
* $(UL |
| 1419 |
* $(LI CURL_FORMADD_OK on success ) |
| 1420 |
* $(LI CURL_FORMADD_MEMORY if the FormInfo allocation fails ) |
| 1421 |
* $(LI CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form ) |
| 1422 |
* $(LI CURL_FORMADD_NULL if a null pointer was given for a char ) |
| 1423 |
* $(LI CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed ) |
| 1424 |
* $(LI CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used ) |
| 1425 |
* $(LI CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error) ) |
| 1426 |
* $(LI CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated ) |
| 1427 |
* $(LI CURL_FORMADD_MEMORY if some allocation for string copying failed. ) |
| 1428 |
* $(LI CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array ) |
| 1429 |
* ) |
| 1430 |
* |
| 1431 |
***************************************************************************/ |
| 1432 |
enum CurlFormAdd { |
| 1433 |
ok, /** first, no error */ |
| 1434 |
memory, /// |
| 1435 |
option_twice, /// |
| 1436 |
null_ptr, /// |
| 1437 |
unknown_option, /// |
| 1438 |
incomplete, /// |
| 1439 |
illegal_array, /// |
| 1440 |
disabled, /** libcurl was built with this disabled */ |
| 1441 |
last /// |
| 1442 |
} |
| 1443 |
/// |
| 1444 |
alias CURLFORMcode = int; |
| 1445 |
|
| 1446 |
extern (C) { |
| 1447 |
|
| 1448 |
/** |
| 1449 |
* Name: curl_formadd() |
| 1450 |
* |
| 1451 |
* Description: |
| 1452 |
* |
| 1453 |
* Pretty advanced function for building multi-part formposts. Each invoke |
| 1454 |
* adds one part that together construct a full post. Then use |
| 1455 |
* CURLOPT_HTTPPOST to send it off to libcurl. |
| 1456 |
*/ |
| 1457 |
CURLFORMcode curl_formadd(curl_httppost **httppost, curl_httppost **last_post,...); |
| 1458 |
|
| 1459 |
/** |
| 1460 |
* callback function for curl_formget() |
| 1461 |
* The void *arg pointer will be the one passed as second argument to |
| 1462 |
* curl_formget(). |
| 1463 |
* The character buffer passed to it must not be freed. |
| 1464 |
* Should return the buffer length passed to it as the argument "len" on |
| 1465 |
* success. |
| 1466 |
*/ |
| 1467 |
alias curl_formget_callback = size_t function(void *arg, const(char) *buf, size_t len); |
| 1468 |
|
| 1469 |
/** |
| 1470 |
* Name: curl_formget() |
| 1471 |
* |
| 1472 |
* Description: |
| 1473 |
* |
| 1474 |
* Serialize a curl_httppost struct built with curl_formadd(). |
| 1475 |
* Accepts a void pointer as second argument which will be passed to |
| 1476 |
* the curl_formget_callback function. |
| 1477 |
* Returns 0 on success. |
| 1478 |
*/ |
| 1479 |
int curl_formget(curl_httppost *form, void *arg, curl_formget_callback append); |
| 1480 |
/** |
| 1481 |
* Name: curl_formfree() |
| 1482 |
* |
| 1483 |
* Description: |
| 1484 |
* |
| 1485 |
* Free a multipart formpost previously built with curl_formadd(). |
| 1486 |
*/ |
| 1487 |
void curl_formfree(curl_httppost *form); |
| 1488 |
|
| 1489 |
/** |
| 1490 |
* Name: curl_getenv() |
| 1491 |
* |
| 1492 |
* Description: |
| 1493 |
* |
| 1494 |
* Returns a malloc()'ed string that MUST be curl_free()ed after usage is |
| 1495 |
* complete. DEPRECATED - see lib/README.curlx |
| 1496 |
*/ |
| 1497 |
char * curl_getenv(scope const(char) *variable); |
| 1498 |
|
| 1499 |
/** |
| 1500 |
* Name: curl_version() |
| 1501 |
* |
| 1502 |
* Description: |
| 1503 |
* |
| 1504 |
* Returns a static ascii string of the libcurl version. |
| 1505 |
*/ |
| 1506 |
char * curl_version(); |
| 1507 |
|
| 1508 |
/** |
| 1509 |
* Name: curl_easy_escape() |
| 1510 |
* |
| 1511 |
* Description: |
| 1512 |
* |
| 1513 |
* Escapes URL strings (converts all letters consider illegal in URLs to their |
| 1514 |
* %XX versions). This function returns a new allocated string or NULL if an |
| 1515 |
* error occurred. |
| 1516 |
*/ |
| 1517 |
char * curl_easy_escape(CURL *handle, scope const(char) *string, int length); |
| 1518 |
|
| 1519 |
/** the previous version: */ |
| 1520 |
char * curl_escape(scope const(char) *string, int length); |
| 1521 |
|
| 1522 |
|
| 1523 |
/** |
| 1524 |
* Name: curl_easy_unescape() |
| 1525 |
* |
| 1526 |
* Description: |
| 1527 |
* |
| 1528 |
* Unescapes URL encoding in strings (converts all %XX codes to their 8bit |
| 1529 |
* versions). This function returns a new allocated string or NULL if an error |
| 1530 |
* occurred. |
| 1531 |
* Conversion Note: On non-ASCII platforms the ASCII %XX codes are |
| 1532 |
* converted into the host encoding. |
| 1533 |
*/ |
| 1534 |
char * curl_easy_unescape(CURL *handle, scope const(char) *string, int length, int *outlength); |
| 1535 |
|
| 1536 |
/** the previous version */ |
| 1537 |
char * curl_unescape(scope const(char) *string, int length); |
| 1538 |
|
| 1539 |
/** |
| 1540 |
* Name: curl_free() |
| 1541 |
* |
| 1542 |
* Description: |
| 1543 |
* |
| 1544 |
* Provided for de-allocation in the same translation unit that did the |
| 1545 |
* allocation. Added in libcurl 7.10 |
| 1546 |
*/ |
| 1547 |
void curl_free(void *p); |
| 1548 |
|
| 1549 |
/** |
| 1550 |
* Name: curl_global_init() |
| 1551 |
* |
| 1552 |
* Description: |
| 1553 |
* |
| 1554 |
* curl_global_init() should be invoked exactly once for each application that |
| 1555 |
* uses libcurl and before any call of other libcurl functions. |
| 1556 |
* |
| 1557 |
* This function is not thread-safe! |
| 1558 |
*/ |
| 1559 |
CURLcode curl_global_init(c_long flags); |
| 1560 |
|
| 1561 |
/** |
| 1562 |
* Name: curl_global_init_mem() |
| 1563 |
* |
| 1564 |
* Description: |
| 1565 |
* |
| 1566 |
* curl_global_init() or curl_global_init_mem() should be invoked exactly once |
| 1567 |
* for each application that uses libcurl. This function can be used to |
| 1568 |
* initialize libcurl and set user defined memory management callback |
| 1569 |
* functions. Users can implement memory management routines to check for |
| 1570 |
* memory leaks, check for mis-use of the curl library etc. User registered |
| 1571 |
* callback routines with be invoked by this library instead of the system |
| 1572 |
* memory management routines like malloc, free etc. |
| 1573 |
*/ |
| 1574 |
CURLcode curl_global_init_mem( |
| 1575 |
c_long flags, |
| 1576 |
curl_malloc_callback m, |
| 1577 |
curl_free_callback f, |
| 1578 |
curl_realloc_callback r, |
| 1579 |
curl_strdup_callback s, |
| 1580 |
curl_calloc_callback c |
| 1581 |
); |
| 1582 |
|
| 1583 |
/** |
| 1584 |
* Name: curl_global_cleanup() |
| 1585 |
* |
| 1586 |
* Description: |
| 1587 |
* |
| 1588 |
* curl_global_cleanup() should be invoked exactly once for each application |
| 1589 |
* that uses libcurl |
| 1590 |
*/ |
| 1591 |
void curl_global_cleanup(); |
| 1592 |
} |
| 1593 |
|
| 1594 |
/** linked-list structure for the CURLOPT_QUOTE option (and other) */ |
| 1595 |
extern (C) { |
| 1596 |
|
| 1597 |
struct curl_slist |
| 1598 |
{ |
| 1599 |
char *data; |
| 1600 |
curl_slist *next; |
| 1601 |
} |
| 1602 |
|
| 1603 |
/** |
| 1604 |
* Name: curl_slist_append() |
| 1605 |
* |
| 1606 |
* Description: |
| 1607 |
* |
| 1608 |
* Appends a string to a linked list. If no list exists, it will be created |
| 1609 |
* first. Returns the new list, after appending. |
| 1610 |
*/ |
| 1611 |
curl_slist * curl_slist_append(curl_slist *, const(char) *); |
| 1612 |
|
| 1613 |
/** |
| 1614 |
* Name: curl_slist_free_all() |
| 1615 |
* |
| 1616 |
* Description: |
| 1617 |
* |
| 1618 |
* free a previously built curl_slist. |
| 1619 |
*/ |
| 1620 |
void curl_slist_free_all(curl_slist *); |
| 1621 |
|
| 1622 |
/** |
| 1623 |
* Name: curl_getdate() |
| 1624 |
* |
| 1625 |
* Description: |
| 1626 |
* |
| 1627 |
* Returns the time, in seconds since 1 Jan 1970 of the time string given in |
| 1628 |
* the first argument. The time argument in the second parameter is unused |
| 1629 |
* and should be set to NULL. |
| 1630 |
*/ |
| 1631 |
time_t curl_getdate(const(char) *p, const(time_t) *unused); |
| 1632 |
|
| 1633 |
/** info about the certificate chain, only for OpenSSL builds. Asked |
| 1634 |
for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */ |
| 1635 |
struct curl_certinfo |
| 1636 |
{ |
| 1637 |
int num_of_certs; /** number of certificates with information */ |
| 1638 |
curl_slist **certinfo; /** for each index in this array, there's a |
| 1639 |
linked list with textual information in the |
| 1640 |
format "name: value" */ |
| 1641 |
} |
| 1642 |
|
| 1643 |
} // extern (C) end |
| 1644 |
|
| 1645 |
/// |
| 1646 |
enum CURLINFO_STRING = 0x100000; |
| 1647 |
/// |
| 1648 |
enum CURLINFO_LONG = 0x200000; |
| 1649 |
/// |
| 1650 |
enum CURLINFO_DOUBLE = 0x300000; |
| 1651 |
/// |
| 1652 |
enum CURLINFO_SLIST = 0x400000; |
| 1653 |
/// |
| 1654 |
enum CURLINFO_MASK = 0x0fffff; |
| 1655 |
|
| 1656 |
/// |
| 1657 |
enum CURLINFO_TYPEMASK = 0xf00000; |
| 1658 |
|
| 1659 |
/// |
| 1660 |
enum CurlInfo { |
| 1661 |
none, /// |
| 1662 |
effective_url = 1_048_577, /// |
| 1663 |
response_code = 2_097_154, /// |
| 1664 |
total_time = 3_145_731, /// |
| 1665 |
namelookup_time, /// |
| 1666 |
connect_time, /// |
| 1667 |
pretransfer_time, /// |
| 1668 |
size_upload, /// |
| 1669 |
size_download, /// |
| 1670 |
speed_download, /// |
| 1671 |
speed_upload, /// |
| 1672 |
header_size = 2_097_163, /// |
| 1673 |
request_size, /// |
| 1674 |
ssl_verifyresult, /// |
| 1675 |
filetime, /// |
| 1676 |
content_length_download = 3_145_743, /// |
| 1677 |
content_length_upload, /// |
| 1678 |
starttransfer_time, /// |
| 1679 |
content_type = 1_048_594, /// |
| 1680 |
redirect_time = 3_145_747, /// |
| 1681 |
redirect_count = 2_097_172, /// |
| 1682 |
private_info = 1_048_597, /// |
| 1683 |
http_connectcode = 2_097_174, /// |
| 1684 |
httpauth_avail, /// |
| 1685 |
proxyauth_avail, /// |
| 1686 |
os_errno, /// |
| 1687 |
num_connects, /// |
| 1688 |
ssl_engines = 4_194_331, /// |
| 1689 |
cookielist, /// |
| 1690 |
lastsocket = 2_097_181, /// |
| 1691 |
ftp_entry_path = 1_048_606, /// |
| 1692 |
redirect_url, /// |
| 1693 |
primary_ip, /// |
| 1694 |
appconnect_time = 3_145_761, /// |
| 1695 |
certinfo = 4_194_338, /// |
| 1696 |
condition_unmet = 2_097_187, /// |
| 1697 |
rtsp_session_id = 1_048_612, /// |
| 1698 |
rtsp_client_cseq = 2_097_189, /// |
| 1699 |
rtsp_server_cseq, /// |
| 1700 |
rtsp_cseq_recv, /// |
| 1701 |
primary_port, /// |
| 1702 |
local_ip = 1_048_617, /// |
| 1703 |
local_port = 2_097_194, /// |
| 1704 |
/** Fill in new entries below here! */ |
| 1705 |
lastone = 42 |
| 1706 |
} |
| 1707 |
/// |
| 1708 |
alias CURLINFO = int; |
| 1709 |
|
| 1710 |
/** CURLINFO_RESPONSE_CODE is the new name for the option previously known as |
| 1711 |
CURLINFO_HTTP_CODE */ |
| 1712 |
enum CURLINFO_HTTP_CODE = CurlInfo.response_code; |
| 1713 |
|
| 1714 |
/// |
| 1715 |
enum CurlClosePolicy { |
| 1716 |
none, /// |
| 1717 |
oldest, /// |
| 1718 |
least_recently_used, /// |
| 1719 |
least_traffic, /// |
| 1720 |
slowest, /// |
| 1721 |
callback, /// |
| 1722 |
last /// |
| 1723 |
} |
| 1724 |
/// |
| 1725 |
alias curl_closepolicy = int; |
| 1726 |
|
| 1727 |
/// |
| 1728 |
enum CurlGlobal { |
| 1729 |
ssl = 1, /// |
| 1730 |
win32 = 2, /// |
| 1731 |
/// |
| 1732 |
all = (1 | 2), // (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32); |
| 1733 |
nothing = 0, /// |
| 1734 |
default_ = (1 | 2) /// all |
| 1735 |
} |
| 1736 |
|
| 1737 |
/****************************************************************************** |
| 1738 |
* Setup defines, protos etc for the sharing stuff. |
| 1739 |
*/ |
| 1740 |
|
| 1741 |
/** Different data locks for a single share */ |
| 1742 |
enum CurlLockData { |
| 1743 |
none, /// |
| 1744 |
/** CURL_LOCK_DATA_SHARE is used internally to say that |
| 1745 |
* the locking is just made to change the internal state of the share |
| 1746 |
* itself. |
| 1747 |
*/ |
| 1748 |
share, |
| 1749 |
cookie, /// |
| 1750 |
dns, /// |
| 1751 |
ssl_session, /// |
| 1752 |
connect, /// |
| 1753 |
last /// |
| 1754 |
} |
| 1755 |
/// |
| 1756 |
alias curl_lock_data = int; |
| 1757 |
|
| 1758 |
/** Different lock access types */ |
| 1759 |
enum CurlLockAccess { |
| 1760 |
none, /** unspecified action */ |
| 1761 |
shared_access, /** for read perhaps */ |
| 1762 |
single, /** for write perhaps */ |
| 1763 |
last /** never use */ |
| 1764 |
} |
| 1765 |
/// |
| 1766 |
alias curl_lock_access = int; |
| 1767 |
|
| 1768 |
/// |
| 1769 |
alias curl_lock_function = void function(CURL *handle, curl_lock_data data, curl_lock_access locktype, void *userptr); |
| 1770 |
/// |
| 1771 |
alias curl_unlock_function = void function(CURL *handle, curl_lock_data data, void *userptr); |
| 1772 |
|
| 1773 |
/// |
| 1774 |
alias CURLSH = void; |
| 1775 |
|
| 1776 |
/// |
| 1777 |
enum CurlShError { |
| 1778 |
ok, /** all is fine */ |
| 1779 |
bad_option, /** 1 */ |
| 1780 |
in_use, /** 2 */ |
| 1781 |
invalid, /** 3 */ |
| 1782 |
nomem, /** out of memory */ |
| 1783 |
last /** never use */ |
| 1784 |
} |
| 1785 |
/// |
| 1786 |
alias CURLSHcode = int; |
| 1787 |
|
| 1788 |
/** pass in a user data pointer used in the lock/unlock callback |
| 1789 |
functions */ |
| 1790 |
enum CurlShOption { |
| 1791 |
none, /** don't use */ |
| 1792 |
share, /** specify a data type to share */ |
| 1793 |
unshare, /** specify which data type to stop sharing */ |
| 1794 |
lockfunc, /** pass in a 'curl_lock_function' pointer */ |
| 1795 |
unlockfunc, /** pass in a 'curl_unlock_function' pointer */ |
| 1796 |
userdata, /** pass in a user data pointer used in the lock/unlock |
| 1797 |
callback functions */ |
| 1798 |
last /** never use */ |
| 1799 |
} |
| 1800 |
/// |
| 1801 |
alias CURLSHoption = int; |
| 1802 |
|
| 1803 |
extern (C) { |
| 1804 |
/// |
| 1805 |
CURLSH * curl_share_init(); |
| 1806 |
/// |
| 1807 |
CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option,...); |
| 1808 |
/// |
| 1809 |
CURLSHcode curl_share_cleanup(CURLSH *); |
| 1810 |
} |
| 1811 |
|
| 1812 |
/***************************************************************************** |
| 1813 |
* Structures for querying information about the curl library at runtime. |
| 1814 |
*/ |
| 1815 |
|
| 1816 |
// CURLVERSION_* |
| 1817 |
enum CurlVer { |
| 1818 |
first, /// |
| 1819 |
second, /// |
| 1820 |
third, /// |
| 1821 |
fourth, /// |
| 1822 |
last /// |
| 1823 |
} |
| 1824 |
/// |
| 1825 |
alias CURLversion = int; |
| 1826 |
|
| 1827 |
/** The 'CURLVERSION_NOW' is the symbolic name meant to be used by |
| 1828 |
basically all programs ever that want to get version information. It is |
| 1829 |
meant to be a built-in version number for what kind of struct the caller |
| 1830 |
expects. If the struct ever changes, we redefine the NOW to another enum |
| 1831 |
from above. */ |
| 1832 |
enum CURLVERSION_NOW = CurlVer.fourth; |
| 1833 |
|
| 1834 |
/// |
| 1835 |
extern (C) struct _N28 |
| 1836 |
{ |
| 1837 |
CURLversion age; /** age of the returned struct */ |
| 1838 |
const(char) *version_; /** LIBCURL_VERSION */ |
| 1839 |
uint version_num; /** LIBCURL_VERSION_NUM */ |
| 1840 |
const(char) *host; /** OS/host/cpu/machine when configured */ |
| 1841 |
int features; /** bitmask, see defines below */ |
| 1842 |
const(char) *ssl_version; /** human readable string */ |
| 1843 |
c_long ssl_version_num; /** not used anymore, always 0 */ |
| 1844 |
const(char) *libz_version; /** human readable string */ |
| 1845 |
/** protocols is terminated by an entry with a NULL protoname */ |
| 1846 |
const(char) **protocols; |
| 1847 |
/** The fields below this were added in CURLVERSION_SECOND */ |
| 1848 |
const(char) *ares; |
| 1849 |
int ares_num; |
| 1850 |
/** This field was added in CURLVERSION_THIRD */ |
| 1851 |
const(char) *libidn; |
| 1852 |
/** These field were added in CURLVERSION_FOURTH. */ |
| 1853 |
/** Same as '_libiconv_version' if built with HAVE_ICONV */ |
| 1854 |
int iconv_ver_num; |
| 1855 |
const(char) *libssh_version; /** human readable string */ |
| 1856 |
} |
| 1857 |
/// |
| 1858 |
alias curl_version_info_data = _N28; |
| 1859 |
|
| 1860 |
/// |
| 1861 |
// CURL_VERSION_* |
| 1862 |
enum CurlVersion { |
| 1863 |
ipv6 = 1, /** IPv6-enabled */ |
| 1864 |
kerberos4 = 2, /** kerberos auth is supported */ |
| 1865 |
ssl = 4, /** SSL options are present */ |
| 1866 |
libz = 8, /** libz features are present */ |
| 1867 |
ntlm = 16, /** NTLM auth is supported */ |
| 1868 |
gssnegotiate = 32, /** Negotiate auth support */ |
| 1869 |
dbg = 64, /** built with debug capabilities */ |
| 1870 |
asynchdns = 128, /** asynchronous dns resolves */ |
| 1871 |
spnego = 256, /** SPNEGO auth */ |
| 1872 |
largefile = 512, /** supports files bigger than 2GB */ |
| 1873 |
idn = 1024, /** International Domain Names support */ |
| 1874 |
sspi = 2048, /** SSPI is supported */ |
| 1875 |
conv = 4096, /** character conversions supported */ |
| 1876 |
curldebug = 8192, /** debug memory tracking supported */ |
| 1877 |
tlsauth_srp = 16_384 /** TLS-SRP auth is supported */ |
| 1878 |
} |
| 1879 |
|
| 1880 |
extern (C) { |
| 1881 |
/** |
| 1882 |
* Name: curl_version_info() |
| 1883 |
* |
| 1884 |
* Description: |
| 1885 |
* |
| 1886 |
* This function returns a pointer to a static copy of the version info |
| 1887 |
* struct. See above. |
| 1888 |
*/ |
| 1889 |
curl_version_info_data * curl_version_info(CURLversion ); |
| 1890 |
|
| 1891 |
/** |
| 1892 |
* Name: curl_easy_strerror() |
| 1893 |
* |
| 1894 |
* Description: |
| 1895 |
* |
| 1896 |
* The curl_easy_strerror function may be used to turn a CURLcode value |
| 1897 |
* into the equivalent human readable error string. This is useful |
| 1898 |
* for printing meaningful error messages. |
| 1899 |
*/ |
| 1900 |
const(char)* curl_easy_strerror(CURLcode ); |
| 1901 |
|
| 1902 |
/** |
| 1903 |
* Name: curl_share_strerror() |
| 1904 |
* |
| 1905 |
* Description: |
| 1906 |
* |
| 1907 |
* The curl_share_strerror function may be used to turn a CURLSHcode value |
| 1908 |
* into the equivalent human readable error string. This is useful |
| 1909 |
* for printing meaningful error messages. |
| 1910 |
*/ |
| 1911 |
const(char)* curl_share_strerror(CURLSHcode ); |
| 1912 |
|
| 1913 |
/** |
| 1914 |
* Name: curl_easy_pause() |
| 1915 |
* |
| 1916 |
* Description: |
| 1917 |
* |
| 1918 |
* The curl_easy_pause function pauses or unpauses transfers. Select the new |
| 1919 |
* state by setting the bitmask, use the convenience defines below. |
| 1920 |
* |
| 1921 |
*/ |
| 1922 |
CURLcode curl_easy_pause(CURL *handle, int bitmask); |
| 1923 |
} |
| 1924 |
|
| 1925 |
|
| 1926 |
/// |
| 1927 |
enum CurlPause { |
| 1928 |
recv = 1, /// |
| 1929 |
recv_cont = 0, /// |
| 1930 |
send = 4, /// |
| 1931 |
send_cont = 0, /// |
| 1932 |
/// |
| 1933 |
all = (1 | 4), // CURLPAUSE_RECV | CURLPAUSE_SEND |
| 1934 |
/// |
| 1935 |
cont = (0 | 0), // CURLPAUSE_RECV_CONT | CURLPAUSE_SEND_CONT |
| 1936 |
} |
| 1937 |
|
| 1938 |
/* unfortunately, the easy.h and multi.h include files need options and info |
| 1939 |
stuff before they can be included! */ |
| 1940 |
/* *************************************************************************** |
| 1941 |
* _ _ ____ _ |
| 1942 |
* Project ___| | | | _ \| | |
| 1943 |
* / __| | | | |_) | | |
| 1944 |
* | (__| |_| | _ <| |___ |
| 1945 |
* \___|\___/|_| \_\_____| |
| 1946 |
* |
| 1947 |
* Copyright (C) 1998 - 2008, Daniel Stenberg, <[email protected]>, et al. |
| 1948 |
* |
| 1949 |
* This software is licensed as described in the file COPYING, which |
| 1950 |
* you should have received as part of this distribution. The terms |
| 1951 |
* are also available at http://curl.haxx.se/docs/copyright.html. |
| 1952 |
* |
| 1953 |
* You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 1954 |
* copies of the Software, and permit persons to whom the Software is |
| 1955 |
* furnished to do so, under the terms of the COPYING file. |
| 1956 |
* |
| 1957 |
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 1958 |
* KIND, either express or implied. |
| 1959 |
* |
| 1960 |
***************************************************************************/ |
| 1961 |
|
| 1962 |
extern (C) { |
| 1963 |
/// |
| 1964 |
CURL * curl_easy_init(); |
| 1965 |
/// |
| 1966 |
CURLcode curl_easy_setopt(CURL *curl, CURLoption option,...); |
| 1967 |
/// |
| 1968 |
CURLcode curl_easy_perform(CURL *curl); |
| 1969 |
/// |
| 1970 |
void curl_easy_cleanup(CURL *curl); |
| 1971 |
} |
| 1972 |
|
| 1973 |
/** |
| 1974 |
* Name: curl_easy_getinfo() |
| 1975 |
* |
| 1976 |
* Description: |
| 1977 |
* |
| 1978 |
* Request internal information from the curl session with this function. The |
| 1979 |
* third argument MUST be a pointer to a long, a pointer to a char * or a |
| 1980 |
* pointer to a double (as the documentation describes elsewhere). The data |
| 1981 |
* pointed to will be filled in accordingly and can be relied upon only if the |
| 1982 |
* function returns CURLE_OK. This function is intended to get used *AFTER* a |
| 1983 |
* performed transfer, all results from this function are undefined until the |
| 1984 |
* transfer is completed. |
| 1985 |
*/ |
| 1986 |
extern (C) CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info,...); |
| 1987 |
|
| 1988 |
|
| 1989 |
/** |
| 1990 |
* Name: curl_easy_duphandle() |
| 1991 |
* |
| 1992 |
* Description: |
| 1993 |
* |
| 1994 |
* Creates a new curl session handle with the same options set for the handle |
| 1995 |
* passed in. Duplicating a handle could only be a matter of cloning data and |
| 1996 |
* options, internal state info and things like persistant connections cannot |
| 1997 |
* be transfered. It is useful in multithreaded applications when you can run |
| 1998 |
* curl_easy_duphandle() for each new thread to avoid a series of identical |
| 1999 |
* curl_easy_setopt() invokes in every thread. |
| 2000 |
*/ |
| 2001 |
extern (C) CURL * curl_easy_duphandle(CURL *curl); |
| 2002 |
|
| 2003 |
/** |
| 2004 |
* Name: curl_easy_reset() |
| 2005 |
* |
| 2006 |
* Description: |
| 2007 |
* |
| 2008 |
* Re-initializes a CURL handle to the default values. This puts back the |
| 2009 |
* handle to the same state as it was in when it was just created. |
| 2010 |
* |
| 2011 |
* It does keep: live connections, the Session ID cache, the DNS cache and the |
| 2012 |
* cookies. |
| 2013 |
*/ |
| 2014 |
extern (C) void curl_easy_reset(CURL *curl); |
| 2015 |
|
| 2016 |
/** |
| 2017 |
* Name: curl_easy_recv() |
| 2018 |
* |
| 2019 |
* Description: |
| 2020 |
* |
| 2021 |
* Receives data from the connected socket. Use after successful |
| 2022 |
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option. |
| 2023 |
*/ |
| 2024 |
extern (C) CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n); |
| 2025 |
|
| 2026 |
/** |
| 2027 |
* Name: curl_easy_send() |
| 2028 |
* |
| 2029 |
* Description: |
| 2030 |
* |
| 2031 |
* Sends data over the connected socket. Use after successful |
| 2032 |
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option. |
| 2033 |
*/ |
| 2034 |
extern (C) CURLcode curl_easy_send(CURL *curl, void *buffer, size_t buflen, size_t *n); |
| 2035 |
|
| 2036 |
|
| 2037 |
/* |
| 2038 |
* This header file should not really need to include "curl.h" since curl.h |
| 2039 |
* itself includes this file and we expect user applications to do #include |
| 2040 |
* <curl/curl.h> without the need for especially including multi.h. |
| 2041 |
* |
| 2042 |
* For some reason we added this include here at one point, and rather than to |
| 2043 |
* break existing (wrongly written) libcurl applications, we leave it as-is |
| 2044 |
* but with this warning attached. |
| 2045 |
*/ |
| 2046 |
/* *************************************************************************** |
| 2047 |
* _ _ ____ _ |
| 2048 |
* Project ___| | | | _ \| | |
| 2049 |
* / __| | | | |_) | | |
| 2050 |
* | (__| |_| | _ <| |___ |
| 2051 |
* \___|\___/|_| \_\_____| |
| 2052 |
* |
| 2053 |
* Copyright (C) 1998 - 2010, Daniel Stenberg, <[email protected]>, et al. |
| 2054 |
* |
| 2055 |
* This software is licensed as described in the file COPYING, which |
| 2056 |
* you should have received as part of this distribution. The terms |
| 2057 |
* are also available at http://curl.haxx.se/docs/copyright.html. |
| 2058 |
* |
| 2059 |
* You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 2060 |
* copies of the Software, and permit persons to whom the Software is |
| 2061 |
* furnished to do so, under the terms of the COPYING file. |
| 2062 |
* |
| 2063 |
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 2064 |
* KIND, either express or implied. |
| 2065 |
* |
| 2066 |
***************************************************************************/ |
| 2067 |
|
| 2068 |
/// |
| 2069 |
alias CURLM = void; |
| 2070 |
|
| 2071 |
/// |
| 2072 |
enum CurlM { |
| 2073 |
call_multi_perform = -1, /** please call curl_multi_perform() or curl_multi_socket*() soon */ |
| 2074 |
ok, /// |
| 2075 |
bad_handle, /** the passed-in handle is not a valid CURLM handle */ |
| 2076 |
bad_easy_handle, /** an easy handle was not good/valid */ |
| 2077 |
out_of_memory, /** if you ever get this, you're in deep sh*t */ |
| 2078 |
internal_error, /** this is a libcurl bug */ |
| 2079 |
bad_socket, /** the passed in socket argument did not match */ |
| 2080 |
unknown_option, /** curl_multi_setopt() with unsupported option */ |
| 2081 |
last, /// |
| 2082 |
} |
| 2083 |
/// |
| 2084 |
alias CURLMcode = int; |
| 2085 |
|
| 2086 |
/** just to make code nicer when using curl_multi_socket() you can now check |
| 2087 |
for CURLM_CALL_MULTI_SOCKET too in the same style it works for |
| 2088 |
curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ |
| 2089 |
enum CURLM_CALL_MULTI_SOCKET = CurlM.call_multi_perform; |
| 2090 |
|
| 2091 |
/// |
| 2092 |
enum CurlMsg |
| 2093 |
{ |
| 2094 |
none, /// |
| 2095 |
done, /** This easy handle has completed. 'result' contains |
| 2096 |
the CURLcode of the transfer */ |
| 2097 |
last, /** no used */ |
| 2098 |
} |
| 2099 |
/// |
| 2100 |
alias CURLMSG = int; |
| 2101 |
|
| 2102 |
/// |
| 2103 |
extern (C) union _N31 |
| 2104 |
{ |
| 2105 |
void *whatever; /** message-specific data */ |
| 2106 |
CURLcode result; /** return code for transfer */ |
| 2107 |
} |
| 2108 |
|
| 2109 |
/// |
| 2110 |
extern (C) struct CURLMsg |
| 2111 |
{ |
| 2112 |
CURLMSG msg; /** what this message means */ |
| 2113 |
CURL *easy_handle; /** the handle it concerns */ |
| 2114 |
_N31 data; /// |
| 2115 |
} |
| 2116 |
|
| 2117 |
/** |
| 2118 |
* Name: curl_multi_init() |
| 2119 |
* |
| 2120 |
* Desc: inititalize multi-style curl usage |
| 2121 |
* |
| 2122 |
* Returns: a new CURLM handle to use in all 'curl_multi' functions. |
| 2123 |
*/ |
| 2124 |
extern (C) CURLM * curl_multi_init(); |
| 2125 |
|
| 2126 |
/** |
| 2127 |
* Name: curl_multi_add_handle() |
| 2128 |
* |
| 2129 |
* Desc: add a standard curl handle to the multi stack |
| 2130 |
* |
| 2131 |
* Returns: CURLMcode type, general multi error code. |
| 2132 |
*/ |
| 2133 |
extern (C) CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *curl_handle); |
| 2134 |
|
| 2135 |
/** |
| 2136 |
* Name: curl_multi_remove_handle() |
| 2137 |
* |
| 2138 |
* Desc: removes a curl handle from the multi stack again |
| 2139 |
* |
| 2140 |
* Returns: CURLMcode type, general multi error code. |
| 2141 |
*/ |
| 2142 |
extern (C) CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *curl_handle); |
| 2143 |
|
| 2144 |
/** |
| 2145 |
* Name: curl_multi_fdset() |
| 2146 |
* |
| 2147 |
* Desc: Ask curl for its fd_set sets. The app can use these to select() or |
| 2148 |
* poll() on. We want curl_multi_perform() called as soon as one of |
| 2149 |
* them are ready. |
| 2150 |
* |
| 2151 |
* Returns: CURLMcode type, general multi error code. |
| 2152 |
*/ |
| 2153 |
|
| 2154 |
/** tmp decl */ |
| 2155 |
alias fd_set = int; |
| 2156 |
/// |
| 2157 |
extern (C) CURLMcode curl_multi_fdset( |
| 2158 |
CURLM *multi_handle, |
| 2159 |
fd_set *read_fd_set, |
| 2160 |
fd_set *write_fd_set, |
| 2161 |
fd_set *exc_fd_set, |
| 2162 |
int *max_fd |
| 2163 |
); |
| 2164 |
|
| 2165 |
/** |
| 2166 |
* Name: curl_multi_perform() |
| 2167 |
* |
| 2168 |
* Desc: When the app thinks there's data available for curl it calls this |
| 2169 |
* function to read/write whatever there is right now. This returns |
| 2170 |
* as soon as the reads and writes are done. This function does not |
| 2171 |
* require that there actually is data available for reading or that |
| 2172 |
* data can be written, it can be called just in case. It returns |
| 2173 |
* the number of handles that still transfer data in the second |
| 2174 |
* argument's integer-pointer. |
| 2175 |
* |
| 2176 |
* Returns: CURLMcode type, general multi error code. *NOTE* that this only |
| 2177 |
* returns errors etc regarding the whole multi stack. There might |
| 2178 |
* still have occurred problems on invidual transfers even when this |
| 2179 |
* returns OK. |
| 2180 |
*/ |
| 2181 |
extern (C) CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles); |
| 2182 |
|
| 2183 |
/** |
| 2184 |
* Name: curl_multi_cleanup() |
| 2185 |
* |
| 2186 |
* Desc: Cleans up and removes a whole multi stack. It does not free or |
| 2187 |
* touch any individual easy handles in any way. We need to define |
| 2188 |
* in what state those handles will be if this function is called |
| 2189 |
* in the middle of a transfer. |
| 2190 |
* |
| 2191 |
* Returns: CURLMcode type, general multi error code. |
| 2192 |
*/ |
| 2193 |
extern (C) CURLMcode curl_multi_cleanup(CURLM *multi_handle); |
| 2194 |
|
| 2195 |
/** |
| 2196 |
* Name: curl_multi_info_read() |
| 2197 |
* |
| 2198 |
* Desc: Ask the multi handle if there's any messages/informationals from |
| 2199 |
* the individual transfers. Messages include informationals such as |
| 2200 |
* error code from the transfer or just the fact that a transfer is |
| 2201 |
* completed. More details on these should be written down as well. |
| 2202 |
* |
| 2203 |
* Repeated calls to this function will return a new struct each |
| 2204 |
* time, until a special "end of msgs" struct is returned as a signal |
| 2205 |
* that there is no more to get at this point. |
| 2206 |
* |
| 2207 |
* The data the returned pointer points to will not survive calling |
| 2208 |
* curl_multi_cleanup(). |
| 2209 |
* |
| 2210 |
* The 'CURLMsg' struct is meant to be very simple and only contain |
| 2211 |
* very basic informations. If more involved information is wanted, |
| 2212 |
* we will provide the particular "transfer handle" in that struct |
| 2213 |
* and that should/could/would be used in subsequent |
| 2214 |
* curl_easy_getinfo() calls (or similar). The point being that we |
| 2215 |
* must never expose complex structs to applications, as then we'll |
| 2216 |
* undoubtably get backwards compatibility problems in the future. |
| 2217 |
* |
| 2218 |
* Returns: A pointer to a filled-in struct, or NULL if it failed or ran out |
| 2219 |
* of structs. It also writes the number of messages left in the |
| 2220 |
* queue (after this read) in the integer the second argument points |
| 2221 |
* to. |
| 2222 |
*/ |
| 2223 |
extern (C) CURLMsg * curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue); |
| 2224 |
|
| 2225 |
/** |
| 2226 |
* Name: curl_multi_strerror() |
| 2227 |
* |
| 2228 |
* Desc: The curl_multi_strerror function may be used to turn a CURLMcode |
| 2229 |
* value into the equivalent human readable error string. This is |
| 2230 |
* useful for printing meaningful error messages. |
| 2231 |
* |
| 2232 |
* Returns: A pointer to a zero-terminated error message. |
| 2233 |
*/ |
| 2234 |
extern (C) const(char)* curl_multi_strerror(CURLMcode ); |
| 2235 |
|
| 2236 |
/** |
| 2237 |
* Name: curl_multi_socket() and |
| 2238 |
* curl_multi_socket_all() |
| 2239 |
* |
| 2240 |
* Desc: An alternative version of curl_multi_perform() that allows the |
| 2241 |
* application to pass in one of the file descriptors that have been |
| 2242 |
* detected to have "action" on them and let libcurl perform. |
| 2243 |
* See man page for details. |
| 2244 |
*/ |
| 2245 |
enum CurlPoll { |
| 2246 |
none_ = 0, /** jdrewsen - underscored in order not to clash with reserved D symbols */ |
| 2247 |
in_ = 1, /// |
| 2248 |
out_ = 2, /// |
| 2249 |
inout_ = 3, /// |
| 2250 |
remove_ = 4 /// |
| 2251 |
} |
| 2252 |
|
| 2253 |
/// |
| 2254 |
alias CURL_SOCKET_TIMEOUT = CURL_SOCKET_BAD; |
| 2255 |
|
| 2256 |
/// |
| 2257 |
enum CurlCSelect { |
| 2258 |
in_ = 0x01, /** jdrewsen - underscored in order not to clash with reserved D symbols */ |
| 2259 |
out_ = 0x02, /// |
| 2260 |
err_ = 0x04 /// |
| 2261 |
} |
| 2262 |
|
| 2263 |
extern (C) { |
| 2264 |
/// |
| 2265 |
alias curl_socket_callback = |
| 2266 |
int function(CURL *easy, /** easy handle */ |
| 2267 |
curl_socket_t s, /** socket */ |
| 2268 |
int what, /** see above */ |
| 2269 |
void *userp, /** private callback pointer */ |
| 2270 |
void *socketp); /** private socket pointer */ |
| 2271 |
} |
| 2272 |
|
| 2273 |
/** |
| 2274 |
* Name: curl_multi_timer_callback |
| 2275 |
* |
| 2276 |
* Desc: Called by libcurl whenever the library detects a change in the |
| 2277 |
* maximum number of milliseconds the app is allowed to wait before |
| 2278 |
* curl_multi_socket() or curl_multi_perform() must be called |
| 2279 |
* (to allow libcurl's timed events to take place). |
| 2280 |
* |
| 2281 |
* Returns: The callback should return zero. |
| 2282 |
*/ |
| 2283 |
|
| 2284 |
extern (C) { |
| 2285 |
alias curl_multi_timer_callback = |
| 2286 |
int function(CURLM *multi, /** multi handle */ |
| 2287 |
c_long timeout_ms, /** see above */ |
| 2288 |
void *userp); /** private callback pointer */ |
| 2289 |
/// ditto |
| 2290 |
CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, int *running_handles); |
| 2291 |
/// ditto |
| 2292 |
CURLMcode curl_multi_socket_action(CURLM *multi_handle, curl_socket_t s, int ev_bitmask, int *running_handles); |
| 2293 |
/// ditto |
| 2294 |
CURLMcode curl_multi_socket_all(CURLM *multi_handle, int *running_handles); |
| 2295 |
} |
| 2296 |
|
| 2297 |
/** This macro below was added in 7.16.3 to push users who recompile to use |
| 2298 |
the new curl_multi_socket_action() instead of the old curl_multi_socket() |
| 2299 |
*/ |
| 2300 |
|
| 2301 |
/** |
| 2302 |
* Name: curl_multi_timeout() |
| 2303 |
* |
| 2304 |
* Desc: Returns the maximum number of milliseconds the app is allowed to |
| 2305 |
* wait before curl_multi_socket() or curl_multi_perform() must be |
| 2306 |
* called (to allow libcurl's timed events to take place). |
| 2307 |
* |
| 2308 |
* Returns: CURLM error code. |
| 2309 |
*/ |
| 2310 |
extern (C) CURLMcode curl_multi_timeout(CURLM *multi_handle, c_long *milliseconds); |
| 2311 |
|
| 2312 |
/// |
| 2313 |
enum CurlMOption { |
| 2314 |
socketfunction = 20_001, /** This is the socket callback function pointer */ |
| 2315 |
socketdata = 10_002, /** This is the argument passed to the socket callback */ |
| 2316 |
pipelining = 3, /** set to 1 to enable pipelining for this multi handle */ |
| 2317 |
timerfunction = 20_004, /** This is the timer callback function pointer */ |
| 2318 |
timerdata = 10_005, /** This is the argument passed to the timer callback */ |
| 2319 |
maxconnects = 6, /** maximum number of entries in the connection cache */ |
| 2320 |
lastentry /// |
| 2321 |
} |
| 2322 |
/// |
| 2323 |
alias CURLMoption = int; |
| 2324 |
|
| 2325 |
/** |
| 2326 |
* Name: curl_multi_setopt() |
| 2327 |
* |
| 2328 |
* Desc: Sets options for the multi handle. |
| 2329 |
* |
| 2330 |
* Returns: CURLM error code. |
| 2331 |
*/ |
| 2332 |
extern (C) CURLMcode curl_multi_setopt(CURLM *multi_handle, CURLMoption option,...); |
| 2333 |
|
| 2334 |
/** |
| 2335 |
* Name: curl_multi_assign() |
| 2336 |
* |
| 2337 |
* Desc: This function sets an association in the multi handle between the |
| 2338 |
* given socket and a private pointer of the application. This is |
| 2339 |
* (only) useful for curl_multi_socket uses. |
| 2340 |
* |
| 2341 |
* Returns: CURLM error code. |
| 2342 |
*/ |
| 2343 |
extern (C) CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd, void *sockp); |