PageRenderTime 53ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/etc/c/curl.d

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