Mercurial > hg > CbC > CbC_gcc
comparison libphobos/src/etc/c/curl.d @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
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, <daniel@haxx.se>, 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, <daniel@haxx.se>."; | |
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.windows, 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(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 char *pattern, in 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 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 : long { | |
552 none = 0, | |
553 basic = 1, /** Basic (default) */ | |
554 digest = 2, /** Digest */ | |
555 gssnegotiate = 4, /** GSS-Negotiate */ | |
556 ntlm = 8, /** NTLM */ | |
557 digest_ie = 16, /** Digest with IE flavour */ | |
558 only = 2_147_483_648, /** used together with a single other | |
559 type to force no auth or just that | |
560 single type */ | |
561 any = -17, /* (~CURLAUTH_DIGEST_IE) */ /** all fine types set */ | |
562 anysafe = -18 /* (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) */ /// | |
563 } | |
564 | |
565 /// | |
566 enum CurlSshAuth { | |
567 any = -1, /** all types supported by the server */ | |
568 none = 0, /** none allowed, silly but complete */ | |
569 publickey = 1, /** public/private key files */ | |
570 password = 2, /** password */ | |
571 host = 4, /** host key files */ | |
572 keyboard = 8, /** keyboard interactive */ | |
573 default_ = -1 // CURLSSH_AUTH_ANY; | |
574 } | |
575 /// | |
576 enum CURL_ERROR_SIZE = 256; | |
577 /** points to a zero-terminated string encoded with base64 | |
578 if len is zero, otherwise to the "raw" data */ | |
579 enum CurlKHType | |
580 { | |
581 unknown, /// | |
582 rsa1, /// | |
583 rsa, /// | |
584 dss /// | |
585 } | |
586 /// | |
587 extern (C) struct curl_khkey | |
588 { | |
589 const(char) *key; /** points to a zero-terminated string encoded with base64 | |
590 if len is zero, otherwise to the "raw" data */ | |
591 size_t len; /// | |
592 CurlKHType keytype; /// | |
593 } | |
594 | |
595 /** this is the set of return values expected from the curl_sshkeycallback | |
596 callback */ | |
597 enum CurlKHStat { | |
598 fine_add_to_file, /// | |
599 fine, /// | |
600 reject, /** reject the connection, return an error */ | |
601 defer, /** do not accept it, but we can't answer right now so | |
602 this causes a CURLE_DEFER error but otherwise the | |
603 connection will be left intact etc */ | |
604 last /** not for use, only a marker for last-in-list */ | |
605 } | |
606 | |
607 /** this is the set of status codes pass in to the callback */ | |
608 enum CurlKHMatch { | |
609 ok, /** match */ | |
610 mismatch, /** host found, key mismatch! */ | |
611 missing, /** no matching host/key found */ | |
612 last /** not for use, only a marker for last-in-list */ | |
613 } | |
614 | |
615 /// | |
616 alias curl_sshkeycallback = | |
617 int function(CURL *easy, /** easy handle */ | |
618 curl_khkey *knownkey, /** known */ | |
619 curl_khkey *foundkey, /** found */ | |
620 CurlKHMatch m, /** libcurl's view on the keys */ | |
621 void *clientp /** custom pointer passed from app */ | |
622 ); | |
623 | |
624 /** parameter for the CURLOPT_USE_SSL option */ | |
625 enum CurlUseSSL { | |
626 none, /** do not attempt to use SSL */ | |
627 tryssl, /** try using SSL, proceed anyway otherwise */ | |
628 control, /** SSL for the control connection or fail */ | |
629 all, /** SSL for all communication or fail */ | |
630 last /** not an option, never use */ | |
631 } | |
632 /// | |
633 alias curl_usessl = int; | |
634 | |
635 /** parameter for the CURLOPT_FTP_SSL_CCC option */ | |
636 enum CurlFtpSSL { | |
637 ccc_none, /** do not send CCC */ | |
638 ccc_passive, /** Let the server initiate the shutdown */ | |
639 ccc_active, /** Initiate the shutdown */ | |
640 ccc_last /** not an option, never use */ | |
641 } | |
642 /// | |
643 alias curl_ftpccc = int; | |
644 | |
645 /** parameter for the CURLOPT_FTPSSLAUTH option */ | |
646 enum CurlFtpAuth { | |
647 defaultauth, /** let libcurl decide */ | |
648 ssl, /** use "AUTH SSL" */ | |
649 tls, /** use "AUTH TLS" */ | |
650 last /** not an option, never use */ | |
651 } | |
652 /// | |
653 alias curl_ftpauth = int; | |
654 | |
655 /** parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */ | |
656 enum CurlFtp { | |
657 create_dir_none, /** do NOT create missing dirs! */ | |
658 create_dir, /** (FTP/SFTP) if CWD fails, try MKD and then CWD again if MKD | |
659 succeeded, for SFTP this does similar magic */ | |
660 create_dir_retry, /** (FTP only) if CWD fails, try MKD and then CWD again even if MKD | |
661 failed! */ | |
662 create_dir_last /** not an option, never use */ | |
663 } | |
664 /// | |
665 alias curl_ftpcreatedir = int; | |
666 | |
667 /** parameter for the CURLOPT_FTP_FILEMETHOD option */ | |
668 enum CurlFtpMethod { | |
669 defaultmethod, /** let libcurl pick */ | |
670 multicwd, /** single CWD operation for each path part */ | |
671 nocwd, /** no CWD at all */ | |
672 singlecwd, /** one CWD to full dir, then work on file */ | |
673 last /** not an option, never use */ | |
674 } | |
675 /// | |
676 alias curl_ftpmethod = int; | |
677 | |
678 /** CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */ | |
679 enum CurlProto { | |
680 http = 1, /// | |
681 https = 2, /// | |
682 ftp = 4, /// | |
683 ftps = 8, /// | |
684 scp = 16, /// | |
685 sftp = 32, /// | |
686 telnet = 64, /// | |
687 ldap = 128, /// | |
688 ldaps = 256, /// | |
689 dict = 512, /// | |
690 file = 1024, /// | |
691 tftp = 2048, /// | |
692 imap = 4096, /// | |
693 imaps = 8192, /// | |
694 pop3 = 16_384, /// | |
695 pop3s = 32_768, /// | |
696 smtp = 65_536, /// | |
697 smtps = 131_072, /// | |
698 rtsp = 262_144, /// | |
699 rtmp = 524_288, /// | |
700 rtmpt = 1_048_576, /// | |
701 rtmpe = 2_097_152, /// | |
702 rtmpte = 4_194_304, /// | |
703 rtmps = 8_388_608, /// | |
704 rtmpts = 16_777_216, /// | |
705 gopher = 33_554_432, /// | |
706 all = -1 /** enable everything */ | |
707 } | |
708 | |
709 /** long may be 32 or 64 bits, but we should never depend on anything else | |
710 but 32 */ | |
711 enum CURLOPTTYPE_LONG = 0; | |
712 /// ditto | |
713 enum CURLOPTTYPE_OBJECTPOINT = 10_000; | |
714 /// ditto | |
715 enum CURLOPTTYPE_FUNCTIONPOINT = 20_000; | |
716 | |
717 /// ditto | |
718 enum CURLOPTTYPE_OFF_T = 30_000; | |
719 /** name is uppercase CURLOPT_$(LT)name$(GT), | |
720 type is one of the defined CURLOPTTYPE_$(LT)type$(GT) | |
721 number is unique identifier */ | |
722 | |
723 /** The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ | |
724 alias LONG = CURLOPTTYPE_LONG; | |
725 /// ditto | |
726 alias OBJECTPOINT = CURLOPTTYPE_OBJECTPOINT; | |
727 /// ditto | |
728 alias FUNCTIONPOINT = CURLOPTTYPE_FUNCTIONPOINT; | |
729 | |
730 /// ditto | |
731 alias OFF_T = CURLOPTTYPE_OFF_T; | |
732 | |
733 /// | |
734 enum CurlOption { | |
735 /** This is the FILE * or void * the regular output should be written to. */ | |
736 file = 10_001, | |
737 /** The full URL to get/put */ | |
738 url, | |
739 /** Port number to connect to, if other than default. */ | |
740 port = 3, | |
741 /** Name of proxy to use. */ | |
742 proxy = 10_004, | |
743 /** "name:password" to use when fetching. */ | |
744 userpwd, | |
745 /** "name:password" to use with proxy. */ | |
746 proxyuserpwd, | |
747 /** Range to get, specified as an ASCII string. */ | |
748 range, | |
749 /** not used */ | |
750 | |
751 /** Specified file stream to upload from (use as input): */ | |
752 infile = 10_009, | |
753 /** Buffer to receive error messages in, must be at least CURL_ERROR_SIZE | |
754 * bytes big. If this is not used, error messages go to stderr instead: */ | |
755 errorbuffer, | |
756 /** Function that will be called to store the output (instead of fwrite). The | |
757 * parameters will use fwrite() syntax, make sure to follow them. */ | |
758 writefunction = 20_011, | |
759 /** Function that will be called to read the input (instead of fread). The | |
760 * parameters will use fread() syntax, make sure to follow them. */ | |
761 readfunction, | |
762 /** Time-out the read operation after this amount of seconds */ | |
763 timeout = 13, | |
764 /** If the CURLOPT_INFILE is used, this can be used to inform libcurl about | |
765 * how large the file being sent really is. That allows better error | |
766 * checking and better verifies that the upload was successful. -1 means | |
767 * unknown size. | |
768 * | |
769 * For large file support, there is also a _LARGE version of the key | |
770 * which takes an off_t type, allowing platforms with larger off_t | |
771 * sizes to handle larger files. See below for INFILESIZE_LARGE. | |
772 */ | |
773 infilesize, | |
774 /** POST static input fields. */ | |
775 postfields = 10_015, | |
776 /** Set the referrer page (needed by some CGIs) */ | |
777 referer, | |
778 /** Set the FTP PORT string (interface name, named or numerical IP address) | |
779 Use i.e '-' to use default address. */ | |
780 ftpport, | |
781 /** Set the User-Agent string (examined by some CGIs) */ | |
782 useragent, | |
783 /** If the download receives less than "low speed limit" bytes/second | |
784 * during "low speed time" seconds, the operations is aborted. | |
785 * You could i.e if you have a pretty high speed connection, abort if | |
786 * it is less than 2000 bytes/sec during 20 seconds. | |
787 */ | |
788 | |
789 /** Set the "low speed limit" */ | |
790 low_speed_limit = 19, | |
791 /** Set the "low speed time" */ | |
792 low_speed_time, | |
793 /** Set the continuation offset. | |
794 * | |
795 * Note there is also a _LARGE version of this key which uses | |
796 * off_t types, allowing for large file offsets on platforms which | |
797 * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE. | |
798 */ | |
799 resume_from, | |
800 /** Set cookie in request: */ | |
801 cookie = 10_022, | |
802 /** This points to a linked list of headers, struct curl_slist kind */ | |
803 httpheader, | |
804 /** This points to a linked list of post entries, struct curl_httppost */ | |
805 httppost, | |
806 /** name of the file keeping your private SSL-certificate */ | |
807 sslcert, | |
808 /** password for the SSL or SSH private key */ | |
809 keypasswd, | |
810 /** send TYPE parameter? */ | |
811 crlf = 27, | |
812 /** send linked-list of QUOTE commands */ | |
813 quote = 10_028, | |
814 /** send FILE * or void * to store headers to, if you use a callback it | |
815 is simply passed to the callback unmodified */ | |
816 writeheader, | |
817 /** point to a file to read the initial cookies from, also enables | |
818 "cookie awareness" */ | |
819 cookiefile = 10_031, | |
820 /** What version to specifically try to use. | |
821 See CURL_SSLVERSION defines below. */ | |
822 sslversion = 32, | |
823 /** What kind of HTTP time condition to use, see defines */ | |
824 timecondition, | |
825 /** Time to use with the above condition. Specified in number of seconds | |
826 since 1 Jan 1970 */ | |
827 timevalue, | |
828 /* 35 = OBSOLETE */ | |
829 | |
830 /** Custom request, for customizing the get command like | |
831 HTTP: DELETE, TRACE and others | |
832 FTP: to use a different list command | |
833 */ | |
834 customrequest = 10_036, | |
835 /** HTTP request, for odd commands like DELETE, TRACE and others */ | |
836 stderr, | |
837 /* 38 is not used */ | |
838 | |
839 /** send linked-list of post-transfer QUOTE commands */ | |
840 postquote = 10_039, | |
841 /** Pass a pointer to string of the output using full variable-replacement | |
842 as described elsewhere. */ | |
843 writeinfo, | |
844 verbose = 41, /** talk a lot */ | |
845 header, /** throw the header out too */ | |
846 noprogress, /** shut off the progress meter */ | |
847 nobody, /** use HEAD to get http document */ | |
848 failonerror, /** no output on http error codes >= 300 */ | |
849 upload, /** this is an upload */ | |
850 post, /** HTTP POST method */ | |
851 dirlistonly, /** return bare names when listing directories */ | |
852 append = 50, /** Append instead of overwrite on upload! */ | |
853 /** Specify whether to read the user+password from the .netrc or the URL. | |
854 * This must be one of the CURL_NETRC_* enums below. */ | |
855 netrc, | |
856 followlocation, /** use Location: Luke! */ | |
857 transfertext, /** transfer data in text/ASCII format */ | |
858 put, /** HTTP PUT */ | |
859 /* 55 = OBSOLETE */ | |
860 | |
861 /** Function that will be called instead of the internal progress display | |
862 * function. This function should be defined as the curl_progress_callback | |
863 * prototype defines. */ | |
864 progressfunction = 20_056, | |
865 /** Data passed to the progress callback */ | |
866 progressdata = 10_057, | |
867 /** We want the referrer field set automatically when following locations */ | |
868 autoreferer = 58, | |
869 /** Port of the proxy, can be set in the proxy string as well with: | |
870 "[host]:[port]" */ | |
871 proxyport, | |
872 /** size of the POST input data, if strlen() is not good to use */ | |
873 postfieldsize, | |
874 /** tunnel non-http operations through a HTTP proxy */ | |
875 httpproxytunnel, | |
876 /** Set the interface string to use as outgoing network interface */ | |
877 intrface = 10_062, | |
878 /** Set the krb4/5 security level, this also enables krb4/5 awareness. This | |
879 * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string | |
880 * is set but doesn't match one of these, 'private' will be used. */ | |
881 krblevel, | |
882 /** Set if we should verify the peer in ssl handshake, set 1 to verify. */ | |
883 ssl_verifypeer = 64, | |
884 /** The CApath or CAfile used to validate the peer certificate | |
885 this option is used only if SSL_VERIFYPEER is true */ | |
886 cainfo = 10_065, | |
887 /* 66 = OBSOLETE */ | |
888 /* 67 = OBSOLETE */ | |
889 | |
890 /** Maximum number of http redirects to follow */ | |
891 maxredirs = 68, | |
892 /** Pass a long set to 1 to get the date of the requested document (if | |
893 possible)! Pass a zero to shut it off. */ | |
894 filetime, | |
895 /** This points to a linked list of telnet options */ | |
896 telnetoptions = 10_070, | |
897 /** Max amount of cached alive connections */ | |
898 maxconnects = 71, | |
899 /** What policy to use when closing connections when the cache is filled | |
900 up */ | |
901 closepolicy, | |
902 /* 73 = OBSOLETE */ | |
903 | |
904 /** Set to explicitly use a new connection for the upcoming transfer. | |
905 Do not use this unless you're absolutely sure of this, as it makes the | |
906 operation slower and is less friendly for the network. */ | |
907 fresh_connect = 74, | |
908 /** Set to explicitly forbid the upcoming transfer's connection to be re-used | |
909 when done. Do not use this unless you're absolutely sure of this, as it | |
910 makes the operation slower and is less friendly for the network. */ | |
911 forbid_reuse, | |
912 /** Set to a file name that contains random data for libcurl to use to | |
913 seed the random engine when doing SSL connects. */ | |
914 random_file = 10_076, | |
915 /** Set to the Entropy Gathering Daemon socket pathname */ | |
916 egdsocket, | |
917 /** Time-out connect operations after this amount of seconds, if connects | |
918 are OK within this time, then fine... This only aborts the connect | |
919 phase. [Only works on unix-style/SIGALRM operating systems] */ | |
920 connecttimeout = 78, | |
921 /** Function that will be called to store headers (instead of fwrite). The | |
922 * parameters will use fwrite() syntax, make sure to follow them. */ | |
923 headerfunction = 20_079, | |
924 /** Set this to force the HTTP request to get back to GET. Only really usable | |
925 if POST, PUT or a custom request have been used first. | |
926 */ | |
927 httpget = 80, | |
928 /** Set if we should verify the Common name from the peer certificate in ssl | |
929 * handshake, set 1 to check existence, 2 to ensure that it matches the | |
930 * provided hostname. */ | |
931 ssl_verifyhost, | |
932 /** Specify which file name to write all known cookies in after completed | |
933 operation. Set file name to "-" (dash) to make it go to stdout. */ | |
934 cookiejar = 10_082, | |
935 /** Specify which SSL ciphers to use */ | |
936 ssl_cipher_list, | |
937 /** Specify which HTTP version to use! This must be set to one of the | |
938 CURL_HTTP_VERSION* enums set below. */ | |
939 http_version = 84, | |
940 /** Specifically switch on or off the FTP engine's use of the EPSV command. By | |
941 default, that one will always be attempted before the more traditional | |
942 PASV command. */ | |
943 ftp_use_epsv, | |
944 /** type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */ | |
945 sslcerttype = 10_086, | |
946 /** name of the file keeping your private SSL-key */ | |
947 sslkey, | |
948 /** type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */ | |
949 sslkeytype, | |
950 /** crypto engine for the SSL-sub system */ | |
951 sslengine, | |
952 /** set the crypto engine for the SSL-sub system as default | |
953 the param has no meaning... | |
954 */ | |
955 sslengine_default = 90, | |
956 /** Non-zero value means to use the global dns cache */ | |
957 dns_use_global_cache, | |
958 /** DNS cache timeout */ | |
959 dns_cache_timeout, | |
960 /** send linked-list of pre-transfer QUOTE commands */ | |
961 prequote = 10_093, | |
962 /** set the debug function */ | |
963 debugfunction = 20_094, | |
964 /** set the data for the debug function */ | |
965 debugdata = 10_095, | |
966 /** mark this as start of a cookie session */ | |
967 cookiesession = 96, | |
968 /** The CApath directory used to validate the peer certificate | |
969 this option is used only if SSL_VERIFYPEER is true */ | |
970 capath = 10_097, | |
971 /** Instruct libcurl to use a smaller receive buffer */ | |
972 buffersize = 98, | |
973 /** Instruct libcurl to not use any signal/alarm handlers, even when using | |
974 timeouts. This option is useful for multi-threaded applications. | |
975 See libcurl-the-guide for more background information. */ | |
976 nosignal, | |
977 /** Provide a CURLShare for mutexing non-ts data */ | |
978 share = 10_100, | |
979 /** indicates type of proxy. accepted values are CURLPROXY_HTTP (default), | |
980 CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */ | |
981 proxytype = 101, | |
982 /** Set the Accept-Encoding string. Use this to tell a server you would like | |
983 the response to be compressed. */ | |
984 encoding = 10_102, | |
985 /** Set pointer to private data */ | |
986 private_opt, | |
987 /** Set aliases for HTTP 200 in the HTTP Response header */ | |
988 http200aliases, | |
989 /** Continue to send authentication (user+password) when following locations, | |
990 even when hostname changed. This can potentially send off the name | |
991 and password to whatever host the server decides. */ | |
992 unrestricted_auth = 105, | |
993 /** Specifically switch on or off the FTP engine's use of the EPRT command ( it | |
994 also disables the LPRT attempt). By default, those ones will always be | |
995 attempted before the good old traditional PORT command. */ | |
996 ftp_use_eprt, | |
997 /** Set this to a bitmask value to enable the particular authentications | |
998 methods you like. Use this in combination with CURLOPT_USERPWD. | |
999 Note that setting multiple bits may cause extra network round-trips. */ | |
1000 httpauth, | |
1001 /** Set the ssl context callback function, currently only for OpenSSL ssl_ctx | |
1002 in second argument. The function must be matching the | |
1003 curl_ssl_ctx_callback proto. */ | |
1004 ssl_ctx_function = 20_108, | |
1005 /** Set the userdata for the ssl context callback function's third | |
1006 argument */ | |
1007 ssl_ctx_data = 10_109, | |
1008 /** FTP Option that causes missing dirs to be created on the remote server. | |
1009 In 7.19.4 we introduced the convenience enums for this option using the | |
1010 CURLFTP_CREATE_DIR prefix. | |
1011 */ | |
1012 ftp_create_missing_dirs = 110, | |
1013 /** Set this to a bitmask value to enable the particular authentications | |
1014 methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. | |
1015 Note that setting multiple bits may cause extra network round-trips. */ | |
1016 proxyauth, | |
1017 /** FTP option that changes the timeout, in seconds, associated with | |
1018 getting a response. This is different from transfer timeout time and | |
1019 essentially places a demand on the FTP server to acknowledge commands | |
1020 in a timely manner. */ | |
1021 ftp_response_timeout, | |
1022 /** Set this option to one of the CURL_IPRESOLVE_* defines (see below) to | |
1023 tell libcurl to resolve names to those IP versions only. This only has | |
1024 affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */ | |
1025 ipresolve, | |
1026 /** Set this option to limit the size of a file that will be downloaded from | |
1027 an HTTP or FTP server. | |
1028 | |
1029 Note there is also _LARGE version which adds large file support for | |
1030 platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */ | |
1031 maxfilesize, | |
1032 /** See the comment for INFILESIZE above, but in short, specifies | |
1033 * the size of the file being uploaded. -1 means unknown. | |
1034 */ | |
1035 infilesize_large = 30_115, | |
1036 /** Sets the continuation offset. There is also a LONG version of this; | |
1037 * look above for RESUME_FROM. | |
1038 */ | |
1039 resume_from_large, | |
1040 /** Sets the maximum size of data that will be downloaded from | |
1041 * an HTTP or FTP server. See MAXFILESIZE above for the LONG version. | |
1042 */ | |
1043 maxfilesize_large, | |
1044 /** Set this option to the file name of your .netrc file you want libcurl | |
1045 to parse (using the CURLOPT_NETRC option). If not set, libcurl will do | |
1046 a poor attempt to find the user's home directory and check for a .netrc | |
1047 file in there. */ | |
1048 netrc_file = 10_118, | |
1049 /** Enable SSL/TLS for FTP, pick one of: | |
1050 CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise | |
1051 CURLFTPSSL_CONTROL - SSL for the control connection or fail | |
1052 CURLFTPSSL_ALL - SSL for all communication or fail | |
1053 */ | |
1054 use_ssl = 119, | |
1055 /** The _LARGE version of the standard POSTFIELDSIZE option */ | |
1056 postfieldsize_large = 30_120, | |
1057 /** Enable/disable the TCP Nagle algorithm */ | |
1058 tcp_nodelay = 121, | |
1059 /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ | |
1060 /* 123 OBSOLETE. Gone in 7.16.0 */ | |
1061 /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ | |
1062 /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ | |
1063 /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ | |
1064 /* 127 OBSOLETE. Gone in 7.16.0 */ | |
1065 /* 128 OBSOLETE. Gone in 7.16.0 */ | |
1066 | |
1067 /** When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option | |
1068 can be used to change libcurl's default action which is to first try | |
1069 "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK | |
1070 response has been received. | |
1071 | |
1072 Available parameters are: | |
1073 CURLFTPAUTH_DEFAULT - let libcurl decide | |
1074 CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS | |
1075 CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL | |
1076 */ | |
1077 ftpsslauth = 129, | |
1078 ioctlfunction = 20_130, /// | |
1079 ioctldata = 10_131, /// | |
1080 /* 132 OBSOLETE. Gone in 7.16.0 */ | |
1081 /* 133 OBSOLETE. Gone in 7.16.0 */ | |
1082 | |
1083 /** zero terminated string for pass on to the FTP server when asked for | |
1084 "account" info */ | |
1085 ftp_account = 10_134, | |
1086 /** feed cookies into cookie engine */ | |
1087 cookielist, | |
1088 /** ignore Content-Length */ | |
1089 ignore_content_length = 136, | |
1090 /** Set to non-zero to skip the IP address received in a 227 PASV FTP server | |
1091 response. Typically used for FTP-SSL purposes but is not restricted to | |
1092 that. libcurl will then instead use the same IP address it used for the | |
1093 control connection. */ | |
1094 ftp_skip_pasv_ip, | |
1095 /** Select "file method" to use when doing FTP, see the curl_ftpmethod | |
1096 above. */ | |
1097 ftp_filemethod, | |
1098 /** Local port number to bind the socket to */ | |
1099 localport, | |
1100 /** Number of ports to try, including the first one set with LOCALPORT. | |
1101 Thus, setting it to 1 will make no additional attempts but the first. | |
1102 */ | |
1103 localportrange, | |
1104 /** no transfer, set up connection and let application use the socket by | |
1105 extracting it with CURLINFO_LASTSOCKET */ | |
1106 connect_only, | |
1107 /** Function that will be called to convert from the | |
1108 network encoding (instead of using the iconv calls in libcurl) */ | |
1109 conv_from_network_function = 20_142, | |
1110 /** Function that will be called to convert to the | |
1111 network encoding (instead of using the iconv calls in libcurl) */ | |
1112 conv_to_network_function, | |
1113 /** Function that will be called to convert from UTF8 | |
1114 (instead of using the iconv calls in libcurl) | |
1115 Note that this is used only for SSL certificate processing */ | |
1116 conv_from_utf8_function, | |
1117 /** If the connection proceeds too quickly then need to slow it down */ | |
1118 /** */ | |
1119 /** limit-rate: maximum number of bytes per second to send or receive */ | |
1120 max_send_speed_large = 30_145, | |
1121 max_recv_speed_large, /// ditto | |
1122 /** Pointer to command string to send if USER/PASS fails. */ | |
1123 ftp_alternative_to_user = 10_147, | |
1124 /** callback function for setting socket options */ | |
1125 sockoptfunction = 20_148, | |
1126 sockoptdata = 10_149, | |
1127 /** set to 0 to disable session ID re-use for this transfer, default is | |
1128 enabled (== 1) */ | |
1129 ssl_sessionid_cache = 150, | |
1130 /** allowed SSH authentication methods */ | |
1131 ssh_auth_types, | |
1132 /** Used by scp/sftp to do public/private key authentication */ | |
1133 ssh_public_keyfile = 10_152, | |
1134 ssh_private_keyfile, | |
1135 /** Send CCC (Clear Command Channel) after authentication */ | |
1136 ftp_ssl_ccc = 154, | |
1137 /** Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */ | |
1138 timeout_ms, | |
1139 connecttimeout_ms, | |
1140 /** set to zero to disable the libcurl's decoding and thus pass the raw body | |
1141 data to the application even when it is encoded/compressed */ | |
1142 http_transfer_decoding, | |
1143 http_content_decoding, /// ditto | |
1144 /** Permission used when creating new files and directories on the remote | |
1145 server for protocols that support it, SFTP/SCP/FILE */ | |
1146 new_file_perms, | |
1147 new_directory_perms, /// ditto | |
1148 /** Set the behaviour of POST when redirecting. Values must be set to one | |
1149 of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */ | |
1150 postredir, | |
1151 /** used by scp/sftp to verify the host's public key */ | |
1152 ssh_host_public_key_md5 = 10_162, | |
1153 /** Callback function for opening socket (instead of socket(2)). Optionally, | |
1154 callback is able change the address or refuse to connect returning | |
1155 CURL_SOCKET_BAD. The callback should have type | |
1156 curl_opensocket_callback */ | |
1157 opensocketfunction = 20_163, | |
1158 opensocketdata = 10_164, /// ditto | |
1159 /** POST volatile input fields. */ | |
1160 copypostfields, | |
1161 /** set transfer mode (;type=$(LT)a|i$(GT)) when doing FTP via an HTTP proxy */ | |
1162 proxy_transfer_mode = 166, | |
1163 /** Callback function for seeking in the input stream */ | |
1164 seekfunction = 20_167, | |
1165 seekdata = 10_168, /// ditto | |
1166 /** CRL file */ | |
1167 crlfile, | |
1168 /** Issuer certificate */ | |
1169 issuercert, | |
1170 /** (IPv6) Address scope */ | |
1171 address_scope = 171, | |
1172 /** Collect certificate chain info and allow it to get retrievable with | |
1173 CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only | |
1174 working with OpenSSL-powered builds. */ | |
1175 certinfo, | |
1176 /** "name" and "pwd" to use when fetching. */ | |
1177 username = 10_173, | |
1178 password, /// ditto | |
1179 /** "name" and "pwd" to use with Proxy when fetching. */ | |
1180 proxyusername, | |
1181 proxypassword, /// ditto | |
1182 /** Comma separated list of hostnames defining no-proxy zones. These should | |
1183 match both hostnames directly, and hostnames within a domain. For | |
1184 example, local.com will match local.com and www.local.com, but NOT | |
1185 notlocal.com or www.notlocal.com. For compatibility with other | |
1186 implementations of this, .local.com will be considered to be the same as | |
1187 local.com. A single * is the only valid wildcard, and effectively | |
1188 disables the use of proxy. */ | |
1189 noproxy, | |
1190 /** block size for TFTP transfers */ | |
1191 tftp_blksize = 178, | |
1192 /** Socks Service */ | |
1193 socks5_gssapi_service = 10_179, | |
1194 /** Socks Service */ | |
1195 socks5_gssapi_nec = 180, | |
1196 /** set the bitmask for the protocols that are allowed to be used for the | |
1197 transfer, which thus helps the app which takes URLs from users or other | |
1198 external inputs and want to restrict what protocol(s) to deal | |
1199 with. Defaults to CURLPROTO_ALL. */ | |
1200 protocols, | |
1201 /** set the bitmask for the protocols that libcurl is allowed to follow to, | |
1202 as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs | |
1203 to be set in both bitmasks to be allowed to get redirected to. Defaults | |
1204 to all protocols except FILE and SCP. */ | |
1205 redir_protocols, | |
1206 /** set the SSH knownhost file name to use */ | |
1207 ssh_knownhosts = 10_183, | |
1208 /** set the SSH host key callback, must point to a curl_sshkeycallback | |
1209 function */ | |
1210 ssh_keyfunction = 20_184, | |
1211 /** set the SSH host key callback custom pointer */ | |
1212 ssh_keydata = 10_185, | |
1213 /** set the SMTP mail originator */ | |
1214 mail_from, | |
1215 /** set the SMTP mail receiver(s) */ | |
1216 mail_rcpt, | |
1217 /** FTP: send PRET before PASV */ | |
1218 ftp_use_pret = 188, | |
1219 /** RTSP request method (OPTIONS, SETUP, PLAY, etc...) */ | |
1220 rtsp_request, | |
1221 /** The RTSP session identifier */ | |
1222 rtsp_session_id = 10_190, | |
1223 /** The RTSP stream URI */ | |
1224 rtsp_stream_uri, | |
1225 /** The Transport: header to use in RTSP requests */ | |
1226 rtsp_transport, | |
1227 /** Manually initialize the client RTSP CSeq for this handle */ | |
1228 rtsp_client_cseq = 193, | |
1229 /** Manually initialize the server RTSP CSeq for this handle */ | |
1230 rtsp_server_cseq, | |
1231 /** The stream to pass to INTERLEAVEFUNCTION. */ | |
1232 interleavedata = 10_195, | |
1233 /** Let the application define a custom write method for RTP data */ | |
1234 interleavefunction = 20_196, | |
1235 /** Turn on wildcard matching */ | |
1236 wildcardmatch = 197, | |
1237 /** Directory matching callback called before downloading of an | |
1238 individual file (chunk) started */ | |
1239 chunk_bgn_function = 20_198, | |
1240 /** Directory matching callback called after the file (chunk) | |
1241 was downloaded, or skipped */ | |
1242 chunk_end_function, | |
1243 /** Change match (fnmatch-like) callback for wildcard matching */ | |
1244 fnmatch_function, | |
1245 /** Let the application define custom chunk data pointer */ | |
1246 chunk_data = 10_201, | |
1247 /** FNMATCH_FUNCTION user pointer */ | |
1248 fnmatch_data, | |
1249 /** send linked-list of name:port:address sets */ | |
1250 resolve, | |
1251 /** Set a username for authenticated TLS */ | |
1252 tlsauth_username, | |
1253 /** Set a password for authenticated TLS */ | |
1254 tlsauth_password, | |
1255 /** Set authentication type for authenticated TLS */ | |
1256 tlsauth_type, | |
1257 /** the last unused */ | |
1258 lastentry, | |
1259 | |
1260 writedata = file, /// convenient alias | |
1261 readdata = infile, /// ditto | |
1262 headerdata = writeheader, /// ditto | |
1263 rtspheader = httpheader, /// ditto | |
1264 } | |
1265 /// | |
1266 alias CURLoption = int; | |
1267 /// | |
1268 enum CURLOPT_SERVER_RESPONSE_TIMEOUT = CurlOption.ftp_response_timeout; | |
1269 | |
1270 /** Below here follows defines for the CURLOPT_IPRESOLVE option. If a host | |
1271 name resolves addresses using more than one IP protocol version, this | |
1272 option might be handy to force libcurl to use a specific IP version. */ | |
1273 enum CurlIpResolve { | |
1274 whatever = 0, /** default, resolves addresses to all IP versions that your system allows */ | |
1275 v4 = 1, /** resolve to ipv4 addresses */ | |
1276 v6 = 2 /** resolve to ipv6 addresses */ | |
1277 } | |
1278 | |
1279 /** three convenient "aliases" that follow the name scheme better */ | |
1280 enum CURLOPT_WRITEDATA = CurlOption.file; | |
1281 /// ditto | |
1282 enum CURLOPT_READDATA = CurlOption.infile; | |
1283 /// ditto | |
1284 enum CURLOPT_HEADERDATA = CurlOption.writeheader; | |
1285 /// ditto | |
1286 enum CURLOPT_RTSPHEADER = CurlOption.httpheader; | |
1287 | |
1288 /** These enums are for use with the CURLOPT_HTTP_VERSION option. */ | |
1289 enum CurlHttpVersion { | |
1290 none, /** setting this means we don't care, and that we'd | |
1291 like the library to choose the best possible | |
1292 for us! */ | |
1293 v1_0, /** please use HTTP 1.0 in the request */ | |
1294 v1_1, /** please use HTTP 1.1 in the request */ | |
1295 last /** *ILLEGAL* http version */ | |
1296 } | |
1297 | |
1298 /** | |
1299 * Public API enums for RTSP requests | |
1300 */ | |
1301 enum CurlRtspReq { | |
1302 none, /// | |
1303 options, /// | |
1304 describe, /// | |
1305 announce, /// | |
1306 setup, /// | |
1307 play, /// | |
1308 pause, /// | |
1309 teardown, /// | |
1310 get_parameter, /// | |
1311 set_parameter, /// | |
1312 record, /// | |
1313 receive, /// | |
1314 last /// | |
1315 } | |
1316 | |
1317 /** These enums are for use with the CURLOPT_NETRC option. */ | |
1318 enum CurlNetRcOption { | |
1319 ignored, /** The .netrc will never be read. This is the default. */ | |
1320 optional /** A user:password in the URL will be preferred to one in the .netrc. */, | |
1321 required, /** A user:password in the URL will be ignored. | |
1322 * Unless one is set programmatically, the .netrc | |
1323 * will be queried. */ | |
1324 last /// | |
1325 } | |
1326 | |
1327 /// | |
1328 enum CurlSslVersion { | |
1329 default_version, /// | |
1330 tlsv1, /// | |
1331 sslv2, /// | |
1332 sslv3, /// | |
1333 last /** never use */ | |
1334 } | |
1335 | |
1336 /// | |
1337 enum CurlTlsAuth { | |
1338 none, /// | |
1339 srp, /// | |
1340 last /** never use */ | |
1341 } | |
1342 | |
1343 /** symbols to use with CURLOPT_POSTREDIR. | |
1344 CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that | |
1345 CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */ | |
1346 enum CurlRedir { | |
1347 get_all = 0, /// | |
1348 post_301 = 1, /// | |
1349 post_302 = 2, /// | |
1350 /// | |
1351 post_all = (1 | 2) // (CURL_REDIR_POST_301|CURL_REDIR_POST_302); | |
1352 } | |
1353 /// | |
1354 enum CurlTimeCond { | |
1355 none, /// | |
1356 ifmodsince, /// | |
1357 ifunmodsince, /// | |
1358 lastmod, /// | |
1359 last /// | |
1360 } | |
1361 /// | |
1362 alias curl_TimeCond = int; | |
1363 | |
1364 | |
1365 /** curl_strequal() and curl_strnequal() are subject for removal in a future | |
1366 libcurl, see lib/README.curlx for details */ | |
1367 extern (C) { | |
1368 int curl_strequal(in char *s1, in char *s2); | |
1369 /// ditto | |
1370 int curl_strnequal(in char *s1, in char *s2, size_t n); | |
1371 } | |
1372 enum CurlForm { | |
1373 nothing, /********** the first one is unused ************/ | |
1374 copyname, | |
1375 ptrname, | |
1376 namelength, | |
1377 copycontents, | |
1378 ptrcontents, | |
1379 contentslength, | |
1380 filecontent, | |
1381 array, | |
1382 obsolete, | |
1383 file, | |
1384 buffer, | |
1385 bufferptr, | |
1386 bufferlength, | |
1387 contenttype, | |
1388 contentheader, | |
1389 filename, | |
1390 end, | |
1391 obsolete2, | |
1392 stream, | |
1393 lastentry /** the last unused */ | |
1394 } | |
1395 alias CURLformoption = int; | |
1396 | |
1397 | |
1398 /** structure to be used as parameter for CURLFORM_ARRAY */ | |
1399 extern (C) struct curl_forms | |
1400 { | |
1401 CURLformoption option; /// | |
1402 const(char) *value; /// | |
1403 } | |
1404 | |
1405 /** Use this for multipart formpost building | |
1406 * | |
1407 * Returns code for curl_formadd() | |
1408 * | |
1409 * Returns: | |
1410 * | |
1411 * $(UL | |
1412 * $(LI CURL_FORMADD_OK on success ) | |
1413 * $(LI CURL_FORMADD_MEMORY if the FormInfo allocation fails ) | |
1414 * $(LI CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form ) | |
1415 * $(LI CURL_FORMADD_NULL if a null pointer was given for a char ) | |
1416 * $(LI CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed ) | |
1417 * $(LI CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used ) | |
1418 * $(LI CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error) ) | |
1419 * $(LI CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated ) | |
1420 * $(LI CURL_FORMADD_MEMORY if some allocation for string copying failed. ) | |
1421 * $(LI CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array ) | |
1422 * ) | |
1423 * | |
1424 ***************************************************************************/ | |
1425 enum CurlFormAdd { | |
1426 ok, /** first, no error */ | |
1427 memory, /// | |
1428 option_twice, /// | |
1429 null_ptr, /// | |
1430 unknown_option, /// | |
1431 incomplete, /// | |
1432 illegal_array, /// | |
1433 disabled, /** libcurl was built with this disabled */ | |
1434 last /// | |
1435 } | |
1436 /// | |
1437 alias CURLFORMcode = int; | |
1438 | |
1439 extern (C) { | |
1440 | |
1441 /** | |
1442 * Name: curl_formadd() | |
1443 * | |
1444 * Description: | |
1445 * | |
1446 * Pretty advanced function for building multi-part formposts. Each invoke | |
1447 * adds one part that together construct a full post. Then use | |
1448 * CURLOPT_HTTPPOST to send it off to libcurl. | |
1449 */ | |
1450 CURLFORMcode curl_formadd(curl_httppost **httppost, curl_httppost **last_post,...); | |
1451 | |
1452 /** | |
1453 * callback function for curl_formget() | |
1454 * The void *arg pointer will be the one passed as second argument to | |
1455 * curl_formget(). | |
1456 * The character buffer passed to it must not be freed. | |
1457 * Should return the buffer length passed to it as the argument "len" on | |
1458 * success. | |
1459 */ | |
1460 alias curl_formget_callback = size_t function(void *arg, in char *buf, size_t len); | |
1461 | |
1462 /** | |
1463 * Name: curl_formget() | |
1464 * | |
1465 * Description: | |
1466 * | |
1467 * Serialize a curl_httppost struct built with curl_formadd(). | |
1468 * Accepts a void pointer as second argument which will be passed to | |
1469 * the curl_formget_callback function. | |
1470 * Returns 0 on success. | |
1471 */ | |
1472 int curl_formget(curl_httppost *form, void *arg, curl_formget_callback append); | |
1473 /** | |
1474 * Name: curl_formfree() | |
1475 * | |
1476 * Description: | |
1477 * | |
1478 * Free a multipart formpost previously built with curl_formadd(). | |
1479 */ | |
1480 void curl_formfree(curl_httppost *form); | |
1481 | |
1482 /** | |
1483 * Name: curl_getenv() | |
1484 * | |
1485 * Description: | |
1486 * | |
1487 * Returns a malloc()'ed string that MUST be curl_free()ed after usage is | |
1488 * complete. DEPRECATED - see lib/README.curlx | |
1489 */ | |
1490 char * curl_getenv(in char *variable); | |
1491 | |
1492 /** | |
1493 * Name: curl_version() | |
1494 * | |
1495 * Description: | |
1496 * | |
1497 * Returns a static ascii string of the libcurl version. | |
1498 */ | |
1499 char * curl_version(); | |
1500 | |
1501 /** | |
1502 * Name: curl_easy_escape() | |
1503 * | |
1504 * Description: | |
1505 * | |
1506 * Escapes URL strings (converts all letters consider illegal in URLs to their | |
1507 * %XX versions). This function returns a new allocated string or NULL if an | |
1508 * error occurred. | |
1509 */ | |
1510 char * curl_easy_escape(CURL *handle, in char *string, int length); | |
1511 | |
1512 /** the previous version: */ | |
1513 char * curl_escape(in char *string, int length); | |
1514 | |
1515 | |
1516 /** | |
1517 * Name: curl_easy_unescape() | |
1518 * | |
1519 * Description: | |
1520 * | |
1521 * Unescapes URL encoding in strings (converts all %XX codes to their 8bit | |
1522 * versions). This function returns a new allocated string or NULL if an error | |
1523 * occurred. | |
1524 * Conversion Note: On non-ASCII platforms the ASCII %XX codes are | |
1525 * converted into the host encoding. | |
1526 */ | |
1527 char * curl_easy_unescape(CURL *handle, in char *string, int length, int *outlength); | |
1528 | |
1529 /** the previous version */ | |
1530 char * curl_unescape(in char *string, int length); | |
1531 | |
1532 /** | |
1533 * Name: curl_free() | |
1534 * | |
1535 * Description: | |
1536 * | |
1537 * Provided for de-allocation in the same translation unit that did the | |
1538 * allocation. Added in libcurl 7.10 | |
1539 */ | |
1540 void curl_free(void *p); | |
1541 | |
1542 /** | |
1543 * Name: curl_global_init() | |
1544 * | |
1545 * Description: | |
1546 * | |
1547 * curl_global_init() should be invoked exactly once for each application that | |
1548 * uses libcurl and before any call of other libcurl functions. | |
1549 * | |
1550 * This function is not thread-safe! | |
1551 */ | |
1552 CURLcode curl_global_init(c_long flags); | |
1553 | |
1554 /** | |
1555 * Name: curl_global_init_mem() | |
1556 * | |
1557 * Description: | |
1558 * | |
1559 * curl_global_init() or curl_global_init_mem() should be invoked exactly once | |
1560 * for each application that uses libcurl. This function can be used to | |
1561 * initialize libcurl and set user defined memory management callback | |
1562 * functions. Users can implement memory management routines to check for | |
1563 * memory leaks, check for mis-use of the curl library etc. User registered | |
1564 * callback routines with be invoked by this library instead of the system | |
1565 * memory management routines like malloc, free etc. | |
1566 */ | |
1567 CURLcode curl_global_init_mem( | |
1568 c_long flags, | |
1569 curl_malloc_callback m, | |
1570 curl_free_callback f, | |
1571 curl_realloc_callback r, | |
1572 curl_strdup_callback s, | |
1573 curl_calloc_callback c | |
1574 ); | |
1575 | |
1576 /** | |
1577 * Name: curl_global_cleanup() | |
1578 * | |
1579 * Description: | |
1580 * | |
1581 * curl_global_cleanup() should be invoked exactly once for each application | |
1582 * that uses libcurl | |
1583 */ | |
1584 void curl_global_cleanup(); | |
1585 } | |
1586 | |
1587 /** linked-list structure for the CURLOPT_QUOTE option (and other) */ | |
1588 extern (C) { | |
1589 | |
1590 struct curl_slist | |
1591 { | |
1592 char *data; | |
1593 curl_slist *next; | |
1594 } | |
1595 | |
1596 /** | |
1597 * Name: curl_slist_append() | |
1598 * | |
1599 * Description: | |
1600 * | |
1601 * Appends a string to a linked list. If no list exists, it will be created | |
1602 * first. Returns the new list, after appending. | |
1603 */ | |
1604 curl_slist * curl_slist_append(curl_slist *, in char *); | |
1605 | |
1606 /** | |
1607 * Name: curl_slist_free_all() | |
1608 * | |
1609 * Description: | |
1610 * | |
1611 * free a previously built curl_slist. | |
1612 */ | |
1613 void curl_slist_free_all(curl_slist *); | |
1614 | |
1615 /** | |
1616 * Name: curl_getdate() | |
1617 * | |
1618 * Description: | |
1619 * | |
1620 * Returns the time, in seconds since 1 Jan 1970 of the time string given in | |
1621 * the first argument. The time argument in the second parameter is unused | |
1622 * and should be set to NULL. | |
1623 */ | |
1624 time_t curl_getdate(char *p, time_t *unused); | |
1625 | |
1626 /** info about the certificate chain, only for OpenSSL builds. Asked | |
1627 for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */ | |
1628 struct curl_certinfo | |
1629 { | |
1630 int num_of_certs; /** number of certificates with information */ | |
1631 curl_slist **certinfo; /** for each index in this array, there's a | |
1632 linked list with textual information in the | |
1633 format "name: value" */ | |
1634 } | |
1635 | |
1636 } // extern (C) end | |
1637 | |
1638 /// | |
1639 enum CURLINFO_STRING = 0x100000; | |
1640 /// | |
1641 enum CURLINFO_LONG = 0x200000; | |
1642 /// | |
1643 enum CURLINFO_DOUBLE = 0x300000; | |
1644 /// | |
1645 enum CURLINFO_SLIST = 0x400000; | |
1646 /// | |
1647 enum CURLINFO_MASK = 0x0fffff; | |
1648 | |
1649 /// | |
1650 enum CURLINFO_TYPEMASK = 0xf00000; | |
1651 | |
1652 /// | |
1653 enum CurlInfo { | |
1654 none, /// | |
1655 effective_url = 1_048_577, /// | |
1656 response_code = 2_097_154, /// | |
1657 total_time = 3_145_731, /// | |
1658 namelookup_time, /// | |
1659 connect_time, /// | |
1660 pretransfer_time, /// | |
1661 size_upload, /// | |
1662 size_download, /// | |
1663 speed_download, /// | |
1664 speed_upload, /// | |
1665 header_size = 2_097_163, /// | |
1666 request_size, /// | |
1667 ssl_verifyresult, /// | |
1668 filetime, /// | |
1669 content_length_download = 3_145_743, /// | |
1670 content_length_upload, /// | |
1671 starttransfer_time, /// | |
1672 content_type = 1_048_594, /// | |
1673 redirect_time = 3_145_747, /// | |
1674 redirect_count = 2_097_172, /// | |
1675 private_info = 1_048_597, /// | |
1676 http_connectcode = 2_097_174, /// | |
1677 httpauth_avail, /// | |
1678 proxyauth_avail, /// | |
1679 os_errno, /// | |
1680 num_connects, /// | |
1681 ssl_engines = 4_194_331, /// | |
1682 cookielist, /// | |
1683 lastsocket = 2_097_181, /// | |
1684 ftp_entry_path = 1_048_606, /// | |
1685 redirect_url, /// | |
1686 primary_ip, /// | |
1687 appconnect_time = 3_145_761, /// | |
1688 certinfo = 4_194_338, /// | |
1689 condition_unmet = 2_097_187, /// | |
1690 rtsp_session_id = 1_048_612, /// | |
1691 rtsp_client_cseq = 2_097_189, /// | |
1692 rtsp_server_cseq, /// | |
1693 rtsp_cseq_recv, /// | |
1694 primary_port, /// | |
1695 local_ip = 1_048_617, /// | |
1696 local_port = 2_097_194, /// | |
1697 /** Fill in new entries below here! */ | |
1698 lastone = 42 | |
1699 } | |
1700 /// | |
1701 alias CURLINFO = int; | |
1702 | |
1703 /** CURLINFO_RESPONSE_CODE is the new name for the option previously known as | |
1704 CURLINFO_HTTP_CODE */ | |
1705 enum CURLINFO_HTTP_CODE = CurlInfo.response_code; | |
1706 | |
1707 /// | |
1708 enum CurlClosePolicy { | |
1709 none, /// | |
1710 oldest, /// | |
1711 least_recently_used, /// | |
1712 least_traffic, /// | |
1713 slowest, /// | |
1714 callback, /// | |
1715 last /// | |
1716 } | |
1717 /// | |
1718 alias curl_closepolicy = int; | |
1719 | |
1720 /// | |
1721 enum CurlGlobal { | |
1722 ssl = 1, /// | |
1723 win32 = 2, /// | |
1724 /// | |
1725 all = (1 | 2), // (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32); | |
1726 nothing = 0, /// | |
1727 default_ = (1 | 2) /// all | |
1728 } | |
1729 | |
1730 /****************************************************************************** | |
1731 * Setup defines, protos etc for the sharing stuff. | |
1732 */ | |
1733 | |
1734 /** Different data locks for a single share */ | |
1735 enum CurlLockData { | |
1736 none, /// | |
1737 /** CURL_LOCK_DATA_SHARE is used internally to say that | |
1738 * the locking is just made to change the internal state of the share | |
1739 * itself. | |
1740 */ | |
1741 share, | |
1742 cookie, /// | |
1743 dns, /// | |
1744 ssl_session, /// | |
1745 connect, /// | |
1746 last /// | |
1747 } | |
1748 /// | |
1749 alias curl_lock_data = int; | |
1750 | |
1751 /** Different lock access types */ | |
1752 enum CurlLockAccess { | |
1753 none, /** unspecified action */ | |
1754 shared_access, /** for read perhaps */ | |
1755 single, /** for write perhaps */ | |
1756 last /** never use */ | |
1757 } | |
1758 /// | |
1759 alias curl_lock_access = int; | |
1760 | |
1761 /// | |
1762 alias curl_lock_function = void function(CURL *handle, curl_lock_data data, curl_lock_access locktype, void *userptr); | |
1763 /// | |
1764 alias curl_unlock_function = void function(CURL *handle, curl_lock_data data, void *userptr); | |
1765 | |
1766 /// | |
1767 alias CURLSH = void; | |
1768 | |
1769 /// | |
1770 enum CurlShError { | |
1771 ok, /** all is fine */ | |
1772 bad_option, /** 1 */ | |
1773 in_use, /** 2 */ | |
1774 invalid, /** 3 */ | |
1775 nomem, /** out of memory */ | |
1776 last /** never use */ | |
1777 } | |
1778 /// | |
1779 alias CURLSHcode = int; | |
1780 | |
1781 /** pass in a user data pointer used in the lock/unlock callback | |
1782 functions */ | |
1783 enum CurlShOption { | |
1784 none, /** don't use */ | |
1785 share, /** specify a data type to share */ | |
1786 unshare, /** specify which data type to stop sharing */ | |
1787 lockfunc, /** pass in a 'curl_lock_function' pointer */ | |
1788 unlockfunc, /** pass in a 'curl_unlock_function' pointer */ | |
1789 userdata, /** pass in a user data pointer used in the lock/unlock | |
1790 callback functions */ | |
1791 last /** never use */ | |
1792 } | |
1793 /// | |
1794 alias CURLSHoption = int; | |
1795 | |
1796 extern (C) { | |
1797 /// | |
1798 CURLSH * curl_share_init(); | |
1799 /// | |
1800 CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option,...); | |
1801 /// | |
1802 CURLSHcode curl_share_cleanup(CURLSH *); | |
1803 } | |
1804 | |
1805 /***************************************************************************** | |
1806 * Structures for querying information about the curl library at runtime. | |
1807 */ | |
1808 | |
1809 // CURLVERSION_* | |
1810 enum CurlVer { | |
1811 first, /// | |
1812 second, /// | |
1813 third, /// | |
1814 fourth, /// | |
1815 last /// | |
1816 } | |
1817 /// | |
1818 alias CURLversion = int; | |
1819 | |
1820 /** The 'CURLVERSION_NOW' is the symbolic name meant to be used by | |
1821 basically all programs ever that want to get version information. It is | |
1822 meant to be a built-in version number for what kind of struct the caller | |
1823 expects. If the struct ever changes, we redefine the NOW to another enum | |
1824 from above. */ | |
1825 enum CURLVERSION_NOW = CurlVer.fourth; | |
1826 | |
1827 /// | |
1828 extern (C) struct _N28 | |
1829 { | |
1830 CURLversion age; /** age of the returned struct */ | |
1831 const(char) *version_; /** LIBCURL_VERSION */ | |
1832 uint version_num; /** LIBCURL_VERSION_NUM */ | |
1833 const(char) *host; /** OS/host/cpu/machine when configured */ | |
1834 int features; /** bitmask, see defines below */ | |
1835 const(char) *ssl_version; /** human readable string */ | |
1836 c_long ssl_version_num; /** not used anymore, always 0 */ | |
1837 const(char) *libz_version; /** human readable string */ | |
1838 /** protocols is terminated by an entry with a NULL protoname */ | |
1839 const(char) **protocols; | |
1840 /** The fields below this were added in CURLVERSION_SECOND */ | |
1841 const(char) *ares; | |
1842 int ares_num; | |
1843 /** This field was added in CURLVERSION_THIRD */ | |
1844 const(char) *libidn; | |
1845 /** These field were added in CURLVERSION_FOURTH. */ | |
1846 /** Same as '_libiconv_version' if built with HAVE_ICONV */ | |
1847 int iconv_ver_num; | |
1848 const(char) *libssh_version; /** human readable string */ | |
1849 } | |
1850 /// | |
1851 alias curl_version_info_data = _N28; | |
1852 | |
1853 /// | |
1854 // CURL_VERSION_* | |
1855 enum CurlVersion { | |
1856 ipv6 = 1, /** IPv6-enabled */ | |
1857 kerberos4 = 2, /** kerberos auth is supported */ | |
1858 ssl = 4, /** SSL options are present */ | |
1859 libz = 8, /** libz features are present */ | |
1860 ntlm = 16, /** NTLM auth is supported */ | |
1861 gssnegotiate = 32, /** Negotiate auth support */ | |
1862 dbg = 64, /** built with debug capabilities */ | |
1863 asynchdns = 128, /** asynchronous dns resolves */ | |
1864 spnego = 256, /** SPNEGO auth */ | |
1865 largefile = 512, /** supports files bigger than 2GB */ | |
1866 idn = 1024, /** International Domain Names support */ | |
1867 sspi = 2048, /** SSPI is supported */ | |
1868 conv = 4096, /** character conversions supported */ | |
1869 curldebug = 8192, /** debug memory tracking supported */ | |
1870 tlsauth_srp = 16_384 /** TLS-SRP auth is supported */ | |
1871 } | |
1872 | |
1873 extern (C) { | |
1874 /** | |
1875 * Name: curl_version_info() | |
1876 * | |
1877 * Description: | |
1878 * | |
1879 * This function returns a pointer to a static copy of the version info | |
1880 * struct. See above. | |
1881 */ | |
1882 curl_version_info_data * curl_version_info(CURLversion ); | |
1883 | |
1884 /** | |
1885 * Name: curl_easy_strerror() | |
1886 * | |
1887 * Description: | |
1888 * | |
1889 * The curl_easy_strerror function may be used to turn a CURLcode value | |
1890 * into the equivalent human readable error string. This is useful | |
1891 * for printing meaningful error messages. | |
1892 */ | |
1893 const(char)* curl_easy_strerror(CURLcode ); | |
1894 | |
1895 /** | |
1896 * Name: curl_share_strerror() | |
1897 * | |
1898 * Description: | |
1899 * | |
1900 * The curl_share_strerror function may be used to turn a CURLSHcode value | |
1901 * into the equivalent human readable error string. This is useful | |
1902 * for printing meaningful error messages. | |
1903 */ | |
1904 const(char)* curl_share_strerror(CURLSHcode ); | |
1905 | |
1906 /** | |
1907 * Name: curl_easy_pause() | |
1908 * | |
1909 * Description: | |
1910 * | |
1911 * The curl_easy_pause function pauses or unpauses transfers. Select the new | |
1912 * state by setting the bitmask, use the convenience defines below. | |
1913 * | |
1914 */ | |
1915 CURLcode curl_easy_pause(CURL *handle, int bitmask); | |
1916 } | |
1917 | |
1918 | |
1919 /// | |
1920 enum CurlPause { | |
1921 recv = 1, /// | |
1922 recv_cont = 0, /// | |
1923 send = 4, /// | |
1924 send_cont = 0, /// | |
1925 /// | |
1926 all = (1 | 4), // CURLPAUSE_RECV | CURLPAUSE_SEND | |
1927 /// | |
1928 cont = (0 | 0), // CURLPAUSE_RECV_CONT | CURLPAUSE_SEND_CONT | |
1929 } | |
1930 | |
1931 /* unfortunately, the easy.h and multi.h include files need options and info | |
1932 stuff before they can be included! */ | |
1933 /* *************************************************************************** | |
1934 * _ _ ____ _ | |
1935 * Project ___| | | | _ \| | | |
1936 * / __| | | | |_) | | | |
1937 * | (__| |_| | _ <| |___ | |
1938 * \___|\___/|_| \_\_____| | |
1939 * | |
1940 * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. | |
1941 * | |
1942 * This software is licensed as described in the file COPYING, which | |
1943 * you should have received as part of this distribution. The terms | |
1944 * are also available at http://curl.haxx.se/docs/copyright.html. | |
1945 * | |
1946 * You may opt to use, copy, modify, merge, publish, distribute and/or sell | |
1947 * copies of the Software, and permit persons to whom the Software is | |
1948 * furnished to do so, under the terms of the COPYING file. | |
1949 * | |
1950 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | |
1951 * KIND, either express or implied. | |
1952 * | |
1953 ***************************************************************************/ | |
1954 | |
1955 extern (C) { | |
1956 /// | |
1957 CURL * curl_easy_init(); | |
1958 /// | |
1959 CURLcode curl_easy_setopt(CURL *curl, CURLoption option,...); | |
1960 /// | |
1961 CURLcode curl_easy_perform(CURL *curl); | |
1962 /// | |
1963 void curl_easy_cleanup(CURL *curl); | |
1964 } | |
1965 | |
1966 /** | |
1967 * Name: curl_easy_getinfo() | |
1968 * | |
1969 * Description: | |
1970 * | |
1971 * Request internal information from the curl session with this function. The | |
1972 * third argument MUST be a pointer to a long, a pointer to a char * or a | |
1973 * pointer to a double (as the documentation describes elsewhere). The data | |
1974 * pointed to will be filled in accordingly and can be relied upon only if the | |
1975 * function returns CURLE_OK. This function is intended to get used *AFTER* a | |
1976 * performed transfer, all results from this function are undefined until the | |
1977 * transfer is completed. | |
1978 */ | |
1979 extern (C) CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info,...); | |
1980 | |
1981 | |
1982 /** | |
1983 * Name: curl_easy_duphandle() | |
1984 * | |
1985 * Description: | |
1986 * | |
1987 * Creates a new curl session handle with the same options set for the handle | |
1988 * passed in. Duplicating a handle could only be a matter of cloning data and | |
1989 * options, internal state info and things like persistant connections cannot | |
1990 * be transfered. It is useful in multithreaded applications when you can run | |
1991 * curl_easy_duphandle() for each new thread to avoid a series of identical | |
1992 * curl_easy_setopt() invokes in every thread. | |
1993 */ | |
1994 extern (C) CURL * curl_easy_duphandle(CURL *curl); | |
1995 | |
1996 /** | |
1997 * Name: curl_easy_reset() | |
1998 * | |
1999 * Description: | |
2000 * | |
2001 * Re-initializes a CURL handle to the default values. This puts back the | |
2002 * handle to the same state as it was in when it was just created. | |
2003 * | |
2004 * It does keep: live connections, the Session ID cache, the DNS cache and the | |
2005 * cookies. | |
2006 */ | |
2007 extern (C) void curl_easy_reset(CURL *curl); | |
2008 | |
2009 /** | |
2010 * Name: curl_easy_recv() | |
2011 * | |
2012 * Description: | |
2013 * | |
2014 * Receives data from the connected socket. Use after successful | |
2015 * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. | |
2016 */ | |
2017 extern (C) CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n); | |
2018 | |
2019 /** | |
2020 * Name: curl_easy_send() | |
2021 * | |
2022 * Description: | |
2023 * | |
2024 * Sends data over the connected socket. Use after successful | |
2025 * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. | |
2026 */ | |
2027 extern (C) CURLcode curl_easy_send(CURL *curl, void *buffer, size_t buflen, size_t *n); | |
2028 | |
2029 | |
2030 /* | |
2031 * This header file should not really need to include "curl.h" since curl.h | |
2032 * itself includes this file and we expect user applications to do #include | |
2033 * <curl/curl.h> without the need for especially including multi.h. | |
2034 * | |
2035 * For some reason we added this include here at one point, and rather than to | |
2036 * break existing (wrongly written) libcurl applications, we leave it as-is | |
2037 * but with this warning attached. | |
2038 */ | |
2039 /* *************************************************************************** | |
2040 * _ _ ____ _ | |
2041 * Project ___| | | | _ \| | | |
2042 * / __| | | | |_) | | | |
2043 * | (__| |_| | _ <| |___ | |
2044 * \___|\___/|_| \_\_____| | |
2045 * | |
2046 * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. | |
2047 * | |
2048 * This software is licensed as described in the file COPYING, which | |
2049 * you should have received as part of this distribution. The terms | |
2050 * are also available at http://curl.haxx.se/docs/copyright.html. | |
2051 * | |
2052 * You may opt to use, copy, modify, merge, publish, distribute and/or sell | |
2053 * copies of the Software, and permit persons to whom the Software is | |
2054 * furnished to do so, under the terms of the COPYING file. | |
2055 * | |
2056 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | |
2057 * KIND, either express or implied. | |
2058 * | |
2059 ***************************************************************************/ | |
2060 | |
2061 /// | |
2062 alias CURLM = void; | |
2063 | |
2064 /// | |
2065 enum CurlM { | |
2066 call_multi_perform = -1, /** please call curl_multi_perform() or curl_multi_socket*() soon */ | |
2067 ok, /// | |
2068 bad_handle, /** the passed-in handle is not a valid CURLM handle */ | |
2069 bad_easy_handle, /** an easy handle was not good/valid */ | |
2070 out_of_memory, /** if you ever get this, you're in deep sh*t */ | |
2071 internal_error, /** this is a libcurl bug */ | |
2072 bad_socket, /** the passed in socket argument did not match */ | |
2073 unknown_option, /** curl_multi_setopt() with unsupported option */ | |
2074 last, /// | |
2075 } | |
2076 /// | |
2077 alias CURLMcode = int; | |
2078 | |
2079 /** just to make code nicer when using curl_multi_socket() you can now check | |
2080 for CURLM_CALL_MULTI_SOCKET too in the same style it works for | |
2081 curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ | |
2082 enum CURLM_CALL_MULTI_SOCKET = CurlM.call_multi_perform; | |
2083 | |
2084 /// | |
2085 enum CurlMsg | |
2086 { | |
2087 none, /// | |
2088 done, /** This easy handle has completed. 'result' contains | |
2089 the CURLcode of the transfer */ | |
2090 last, /** no used */ | |
2091 } | |
2092 /// | |
2093 alias CURLMSG = int; | |
2094 | |
2095 /// | |
2096 extern (C) union _N31 | |
2097 { | |
2098 void *whatever; /** message-specific data */ | |
2099 CURLcode result; /** return code for transfer */ | |
2100 } | |
2101 | |
2102 /// | |
2103 extern (C) struct CURLMsg | |
2104 { | |
2105 CURLMSG msg; /** what this message means */ | |
2106 CURL *easy_handle; /** the handle it concerns */ | |
2107 _N31 data; /// | |
2108 } | |
2109 | |
2110 /** | |
2111 * Name: curl_multi_init() | |
2112 * | |
2113 * Desc: inititalize multi-style curl usage | |
2114 * | |
2115 * Returns: a new CURLM handle to use in all 'curl_multi' functions. | |
2116 */ | |
2117 extern (C) CURLM * curl_multi_init(); | |
2118 | |
2119 /** | |
2120 * Name: curl_multi_add_handle() | |
2121 * | |
2122 * Desc: add a standard curl handle to the multi stack | |
2123 * | |
2124 * Returns: CURLMcode type, general multi error code. | |
2125 */ | |
2126 extern (C) CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *curl_handle); | |
2127 | |
2128 /** | |
2129 * Name: curl_multi_remove_handle() | |
2130 * | |
2131 * Desc: removes a curl handle from the multi stack again | |
2132 * | |
2133 * Returns: CURLMcode type, general multi error code. | |
2134 */ | |
2135 extern (C) CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *curl_handle); | |
2136 | |
2137 /** | |
2138 * Name: curl_multi_fdset() | |
2139 * | |
2140 * Desc: Ask curl for its fd_set sets. The app can use these to select() or | |
2141 * poll() on. We want curl_multi_perform() called as soon as one of | |
2142 * them are ready. | |
2143 * | |
2144 * Returns: CURLMcode type, general multi error code. | |
2145 */ | |
2146 | |
2147 /** tmp decl */ | |
2148 alias fd_set = int; | |
2149 /// | |
2150 extern (C) CURLMcode curl_multi_fdset( | |
2151 CURLM *multi_handle, | |
2152 fd_set *read_fd_set, | |
2153 fd_set *write_fd_set, | |
2154 fd_set *exc_fd_set, | |
2155 int *max_fd | |
2156 ); | |
2157 | |
2158 /** | |
2159 * Name: curl_multi_perform() | |
2160 * | |
2161 * Desc: When the app thinks there's data available for curl it calls this | |
2162 * function to read/write whatever there is right now. This returns | |
2163 * as soon as the reads and writes are done. This function does not | |
2164 * require that there actually is data available for reading or that | |
2165 * data can be written, it can be called just in case. It returns | |
2166 * the number of handles that still transfer data in the second | |
2167 * argument's integer-pointer. | |
2168 * | |
2169 * Returns: CURLMcode type, general multi error code. *NOTE* that this only | |
2170 * returns errors etc regarding the whole multi stack. There might | |
2171 * still have occurred problems on invidual transfers even when this | |
2172 * returns OK. | |
2173 */ | |
2174 extern (C) CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles); | |
2175 | |
2176 /** | |
2177 * Name: curl_multi_cleanup() | |
2178 * | |
2179 * Desc: Cleans up and removes a whole multi stack. It does not free or | |
2180 * touch any individual easy handles in any way. We need to define | |
2181 * in what state those handles will be if this function is called | |
2182 * in the middle of a transfer. | |
2183 * | |
2184 * Returns: CURLMcode type, general multi error code. | |
2185 */ | |
2186 extern (C) CURLMcode curl_multi_cleanup(CURLM *multi_handle); | |
2187 | |
2188 /** | |
2189 * Name: curl_multi_info_read() | |
2190 * | |
2191 * Desc: Ask the multi handle if there's any messages/informationals from | |
2192 * the individual transfers. Messages include informationals such as | |
2193 * error code from the transfer or just the fact that a transfer is | |
2194 * completed. More details on these should be written down as well. | |
2195 * | |
2196 * Repeated calls to this function will return a new struct each | |
2197 * time, until a special "end of msgs" struct is returned as a signal | |
2198 * that there is no more to get at this point. | |
2199 * | |
2200 * The data the returned pointer points to will not survive calling | |
2201 * curl_multi_cleanup(). | |
2202 * | |
2203 * The 'CURLMsg' struct is meant to be very simple and only contain | |
2204 * very basic informations. If more involved information is wanted, | |
2205 * we will provide the particular "transfer handle" in that struct | |
2206 * and that should/could/would be used in subsequent | |
2207 * curl_easy_getinfo() calls (or similar). The point being that we | |
2208 * must never expose complex structs to applications, as then we'll | |
2209 * undoubtably get backwards compatibility problems in the future. | |
2210 * | |
2211 * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out | |
2212 * of structs. It also writes the number of messages left in the | |
2213 * queue (after this read) in the integer the second argument points | |
2214 * to. | |
2215 */ | |
2216 extern (C) CURLMsg * curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue); | |
2217 | |
2218 /** | |
2219 * Name: curl_multi_strerror() | |
2220 * | |
2221 * Desc: The curl_multi_strerror function may be used to turn a CURLMcode | |
2222 * value into the equivalent human readable error string. This is | |
2223 * useful for printing meaningful error messages. | |
2224 * | |
2225 * Returns: A pointer to a zero-terminated error message. | |
2226 */ | |
2227 extern (C) const(char)* curl_multi_strerror(CURLMcode ); | |
2228 | |
2229 /** | |
2230 * Name: curl_multi_socket() and | |
2231 * curl_multi_socket_all() | |
2232 * | |
2233 * Desc: An alternative version of curl_multi_perform() that allows the | |
2234 * application to pass in one of the file descriptors that have been | |
2235 * detected to have "action" on them and let libcurl perform. | |
2236 * See man page for details. | |
2237 */ | |
2238 enum CurlPoll { | |
2239 none_ = 0, /** jdrewsen - underscored in order not to clash with reserved D symbols */ | |
2240 in_ = 1, /// | |
2241 out_ = 2, /// | |
2242 inout_ = 3, /// | |
2243 remove_ = 4 /// | |
2244 } | |
2245 | |
2246 /// | |
2247 alias CURL_SOCKET_TIMEOUT = CURL_SOCKET_BAD; | |
2248 | |
2249 /// | |
2250 enum CurlCSelect { | |
2251 in_ = 0x01, /** jdrewsen - underscored in order not to clash with reserved D symbols */ | |
2252 out_ = 0x02, /// | |
2253 err_ = 0x04 /// | |
2254 } | |
2255 | |
2256 extern (C) { | |
2257 /// | |
2258 alias curl_socket_callback = | |
2259 int function(CURL *easy, /** easy handle */ | |
2260 curl_socket_t s, /** socket */ | |
2261 int what, /** see above */ | |
2262 void *userp, /** private callback pointer */ | |
2263 void *socketp); /** private socket pointer */ | |
2264 } | |
2265 | |
2266 /** | |
2267 * Name: curl_multi_timer_callback | |
2268 * | |
2269 * Desc: Called by libcurl whenever the library detects a change in the | |
2270 * maximum number of milliseconds the app is allowed to wait before | |
2271 * curl_multi_socket() or curl_multi_perform() must be called | |
2272 * (to allow libcurl's timed events to take place). | |
2273 * | |
2274 * Returns: The callback should return zero. | |
2275 */ | |
2276 | |
2277 extern (C) { | |
2278 alias curl_multi_timer_callback = | |
2279 int function(CURLM *multi, /** multi handle */ | |
2280 c_long timeout_ms, /** see above */ | |
2281 void *userp); /** private callback pointer */ | |
2282 /// ditto | |
2283 CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, int *running_handles); | |
2284 /// ditto | |
2285 CURLMcode curl_multi_socket_action(CURLM *multi_handle, curl_socket_t s, int ev_bitmask, int *running_handles); | |
2286 /// ditto | |
2287 CURLMcode curl_multi_socket_all(CURLM *multi_handle, int *running_handles); | |
2288 } | |
2289 | |
2290 /** This macro below was added in 7.16.3 to push users who recompile to use | |
2291 the new curl_multi_socket_action() instead of the old curl_multi_socket() | |
2292 */ | |
2293 | |
2294 /** | |
2295 * Name: curl_multi_timeout() | |
2296 * | |
2297 * Desc: Returns the maximum number of milliseconds the app is allowed to | |
2298 * wait before curl_multi_socket() or curl_multi_perform() must be | |
2299 * called (to allow libcurl's timed events to take place). | |
2300 * | |
2301 * Returns: CURLM error code. | |
2302 */ | |
2303 extern (C) CURLMcode curl_multi_timeout(CURLM *multi_handle, c_long *milliseconds); | |
2304 | |
2305 /// | |
2306 enum CurlMOption { | |
2307 socketfunction = 20_001, /** This is the socket callback function pointer */ | |
2308 socketdata = 10_002, /** This is the argument passed to the socket callback */ | |
2309 pipelining = 3, /** set to 1 to enable pipelining for this multi handle */ | |
2310 timerfunction = 20_004, /** This is the timer callback function pointer */ | |
2311 timerdata = 10_005, /** This is the argument passed to the timer callback */ | |
2312 maxconnects = 6, /** maximum number of entries in the connection cache */ | |
2313 lastentry /// | |
2314 } | |
2315 /// | |
2316 alias CURLMoption = int; | |
2317 | |
2318 /** | |
2319 * Name: curl_multi_setopt() | |
2320 * | |
2321 * Desc: Sets options for the multi handle. | |
2322 * | |
2323 * Returns: CURLM error code. | |
2324 */ | |
2325 extern (C) CURLMcode curl_multi_setopt(CURLM *multi_handle, CURLMoption option,...); | |
2326 | |
2327 /** | |
2328 * Name: curl_multi_assign() | |
2329 * | |
2330 * Desc: This function sets an association in the multi handle between the | |
2331 * given socket and a private pointer of the application. This is | |
2332 * (only) useful for curl_multi_socket uses. | |
2333 * | |
2334 * Returns: CURLM error code. | |
2335 */ | |
2336 extern (C) CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd, void *sockp); |