curl.h 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340
  1. #ifndef __CURL_CURL_H
  2. #define __CURL_CURL_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2004, Daniel Stenberg, <[email protected]>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at http://curl.haxx.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * $Id$
  24. ***************************************************************************/
  25. /* If you have problems, all libcurl docs and details are found here:
  26. http://curl.haxx.se/libcurl/
  27. */
  28. #include "curlver.h" /* the libcurl version defines */
  29. #include <stdio.h>
  30. #include <limits.h>
  31. /* The include stuff here below is mainly for time_t! */
  32. #ifdef vms
  33. # include <types.h>
  34. # include <time.h>
  35. #else
  36. # include <sys/types.h>
  37. # include <time.h>
  38. #endif /* defined (vms) */
  39. typedef void CURL;
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /*
  44. * We want the typedef curl_off_t setup for large file support on all
  45. * platforms. We also provide a CURL_FORMAT_OFF_T define to use in *printf
  46. * format strings when outputting a variable of type curl_off_t.
  47. */
  48. #if defined(_MSC_VER) || defined(__LCC__)
  49. /* MSVC */
  50. typedef signed __int64 curl_off_t;
  51. #define CURL_FORMAT_OFF_T "%I64d"
  52. #else /* _MSC_VER || __LCC__ */
  53. #if (defined(__GNUC__) && defined(WIN32)) || defined(__WATCOMC__)
  54. /* gcc on windows or Watcom */
  55. typedef long long curl_off_t;
  56. #define CURL_FORMAT_OFF_T "%I64d"
  57. #else /* GCC or Watcom on Windows */
  58. /* "normal" POSIX approach, do note that this does not necessarily mean that
  59. the type is >32 bits, see the SIZEOF_CURL_OFF_T define for that! */
  60. typedef off_t curl_off_t;
  61. /* Check a range of defines to detect large file support. On Linux it seems
  62. none of these are set by default, so if you don't explicitly switches on
  63. large file support, this define will be made for "small file" support. */
  64. #ifndef _FILE_OFFSET_BITS
  65. #define _FILE_OFFSET_BITS 0 /* to prevent warnings in the check below */
  66. #define UNDEF_FILE_OFFSET_BITS
  67. #endif
  68. #ifndef FILESIZEBITS
  69. #define FILESIZEBITS 0 /* to prevent warnings in the check below */
  70. #define UNDEF_FILESIZEBITS
  71. #endif
  72. #if defined(_LARGE_FILES) || (_FILE_OFFSET_BITS > 32) || (FILESIZEBITS > 32) \
  73. || defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)
  74. /* For now, we assume at least one of these to be set for large files to
  75. work! */
  76. #define CURL_FORMAT_OFF_T "%lld"
  77. #else /* LARGE_FILE support */
  78. #define CURL_FORMAT_OFF_T "%ld"
  79. #endif
  80. #endif /* GCC or Watcom on Windows */
  81. #endif /* _MSC_VER || __LCC__ */
  82. #ifdef UNDEF_FILE_OFFSET_BITS
  83. /* this was defined above for our checks, undefine it again */
  84. #undef _FILE_OFFSET_BITS
  85. #endif
  86. #ifdef UNDEF_FILESIZEBITS
  87. /* this was defined above for our checks, undefine it again */
  88. #undef FILESIZEBITS
  89. #endif
  90. struct curl_httppost {
  91. struct curl_httppost *next; /* next entry in the list */
  92. char *name; /* pointer to allocated name */
  93. long namelength; /* length of name length */
  94. char *contents; /* pointer to allocated data contents */
  95. long contentslength; /* length of contents field */
  96. char *buffer; /* pointer to allocated buffer contents */
  97. long bufferlength; /* length of buffer field */
  98. char *contenttype; /* Content-Type */
  99. struct curl_slist* contentheader; /* list of extra headers for this form */
  100. struct curl_httppost *more; /* if one field name has more than one
  101. file, this link should link to following
  102. files */
  103. long flags; /* as defined below */
  104. #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */
  105. #define HTTPPOST_READFILE (1<<1) /* specified content is a file name */
  106. #define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer
  107. do not free in formfree */
  108. #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
  109. do not free in formfree */
  110. #define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */
  111. #define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */
  112. char *showfilename; /* The file name to show. If not set, the
  113. actual file name will be used (if this
  114. is a file part) */
  115. };
  116. typedef int (*curl_progress_callback)(void *clientp,
  117. double dltotal,
  118. double dlnow,
  119. double ultotal,
  120. double ulnow);
  121. /* Tests have proven that 20K is a very bad buffer size for uploads on
  122. Windows, while 16K for some odd reason performed a lot better. */
  123. #define CURL_MAX_WRITE_SIZE 16384
  124. typedef size_t (*curl_write_callback)(char *buffer,
  125. size_t size,
  126. size_t nitems,
  127. void *outstream);
  128. /* This is a brand new return code for the read callback that will signal
  129. the caller to immediately abort the current transfer. */
  130. #define CURL_READFUNC_ABORT 0x10000000
  131. typedef size_t (*curl_read_callback)(char *buffer,
  132. size_t size,
  133. size_t nitems,
  134. void *instream);
  135. /* not used since 7.10.8, will be removed in a future release */
  136. typedef int (*curl_passwd_callback)(void *clientp,
  137. const char *prompt,
  138. char *buffer,
  139. int buflen);
  140. /*
  141. * The following typedef's are signatures of malloc, free, realloc, strdup and
  142. * calloc respectively. Function pointers of these types can be passed to the
  143. * curl_global_init_mem() function to set user defined memory management
  144. * callback routines.
  145. */
  146. typedef void *(*curl_malloc_callback)(size_t size);
  147. typedef void (*curl_free_callback)(void *ptr);
  148. typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
  149. typedef char *(*curl_strdup_callback)(const char *str);
  150. typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
  151. /* the kind of data that is passed to information_callback*/
  152. typedef enum {
  153. CURLINFO_TEXT = 0,
  154. CURLINFO_HEADER_IN, /* 1 */
  155. CURLINFO_HEADER_OUT, /* 2 */
  156. CURLINFO_DATA_IN, /* 3 */
  157. CURLINFO_DATA_OUT, /* 4 */
  158. CURLINFO_SSL_DATA_IN, /* 5 */
  159. CURLINFO_SSL_DATA_OUT, /* 6 */
  160. CURLINFO_END
  161. } curl_infotype;
  162. typedef int (*curl_debug_callback)
  163. (CURL *handle, /* the handle/transfer this concerns */
  164. curl_infotype type, /* what kind of data */
  165. char *data, /* points to the data */
  166. size_t size, /* size of the data pointed to */
  167. void *userptr); /* whatever the user please */
  168. /* All possible error codes from all sorts of curl functions. Future versions
  169. may return other values, stay prepared.
  170. Always add new return codes last. Never *EVER* remove any. The return
  171. codes must remain the same!
  172. */
  173. typedef enum {
  174. CURLE_OK = 0,
  175. CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
  176. CURLE_FAILED_INIT, /* 2 */
  177. CURLE_URL_MALFORMAT, /* 3 */
  178. CURLE_URL_MALFORMAT_USER, /* 4 (NOT USED) */
  179. CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
  180. CURLE_COULDNT_RESOLVE_HOST, /* 6 */
  181. CURLE_COULDNT_CONNECT, /* 7 */
  182. CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
  183. CURLE_FTP_ACCESS_DENIED, /* 9 */
  184. CURLE_FTP_USER_PASSWORD_INCORRECT, /* 10 */
  185. CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
  186. CURLE_FTP_WEIRD_USER_REPLY, /* 12 */
  187. CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
  188. CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
  189. CURLE_FTP_CANT_GET_HOST, /* 15 */
  190. CURLE_FTP_CANT_RECONNECT, /* 16 */
  191. CURLE_FTP_COULDNT_SET_BINARY, /* 17 */
  192. CURLE_PARTIAL_FILE, /* 18 */
  193. CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
  194. CURLE_FTP_WRITE_ERROR, /* 20 */
  195. CURLE_FTP_QUOTE_ERROR, /* 21 */
  196. CURLE_HTTP_RETURNED_ERROR, /* 22 */
  197. CURLE_WRITE_ERROR, /* 23 */
  198. CURLE_MALFORMAT_USER, /* 24 - NOT USED */
  199. CURLE_FTP_COULDNT_STOR_FILE, /* 25 - failed FTP upload */
  200. CURLE_READ_ERROR, /* 26 - could open/read from file */
  201. CURLE_OUT_OF_MEMORY, /* 27 */
  202. CURLE_OPERATION_TIMEOUTED, /* 28 - the timeout time was reached */
  203. CURLE_FTP_COULDNT_SET_ASCII, /* 29 - TYPE A failed */
  204. CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
  205. CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
  206. CURLE_FTP_COULDNT_GET_SIZE, /* 32 - the SIZE command failed */
  207. CURLE_HTTP_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
  208. CURLE_HTTP_POST_ERROR, /* 34 */
  209. CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
  210. CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
  211. CURLE_FILE_COULDNT_READ_FILE, /* 37 */
  212. CURLE_LDAP_CANNOT_BIND, /* 38 */
  213. CURLE_LDAP_SEARCH_FAILED, /* 39 */
  214. CURLE_LIBRARY_NOT_FOUND, /* 40 */
  215. CURLE_FUNCTION_NOT_FOUND, /* 41 */
  216. CURLE_ABORTED_BY_CALLBACK, /* 42 */
  217. CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
  218. CURLE_BAD_CALLING_ORDER, /* 44 - NOT USED */
  219. CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
  220. CURLE_BAD_PASSWORD_ENTERED, /* 46 - NOT USED */
  221. CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
  222. CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */
  223. CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
  224. CURLE_OBSOLETE, /* 50 - NOT USED */
  225. CURLE_SSL_PEER_CERTIFICATE, /* 51 - peer's certificate wasn't ok */
  226. CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
  227. CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
  228. CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
  229. default */
  230. CURLE_SEND_ERROR, /* 55 - failed sending network data */
  231. CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
  232. CURLE_SHARE_IN_USE, /* 57 - share is in use */
  233. CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
  234. CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
  235. CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
  236. CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */
  237. CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
  238. CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
  239. CURLE_FTP_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
  240. CURL_LAST /* never use! */
  241. } CURLcode;
  242. typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
  243. void *ssl_ctx, /* actually an
  244. OpenSSL SSL_CTX */
  245. void *userptr);
  246. /* Make a spelling correction for the operation timed-out define */
  247. #define CURLE_OPERATION_TIMEDOUT CURLE_OPERATION_TIMEOUTED
  248. /* backwards compatibility with older names */
  249. #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
  250. #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
  251. typedef enum {
  252. CURLPROXY_HTTP = 0,
  253. CURLPROXY_SOCKS4 = 4,
  254. CURLPROXY_SOCKS5 = 5
  255. } curl_proxytype;
  256. #define CURLAUTH_NONE 0 /* nothing */
  257. #define CURLAUTH_BASIC (1<<0) /* Basic (default) */
  258. #define CURLAUTH_DIGEST (1<<1) /* Digest */
  259. #define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */
  260. #define CURLAUTH_NTLM (1<<3) /* NTLM */
  261. #define CURLAUTH_ANY ~0 /* all types set */
  262. #define CURLAUTH_ANYSAFE (~CURLAUTH_BASIC)
  263. /* this was the error code 50 in 7.7.3 and a few earlier versions, this
  264. is no longer used by libcurl but is instead #defined here only to not
  265. make programs break */
  266. #define CURLE_ALREADY_COMPLETE 99999
  267. /* This is just to make older programs not break: */
  268. #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
  269. #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
  270. #define CURL_ERROR_SIZE 256
  271. typedef enum {
  272. CURLFTPSSL_NONE, /* do not attempt to use SSL */
  273. CURLFTPSSL_TRY, /* try using SSL, proceed anyway otherwise */
  274. CURLFTPSSL_CONTROL, /* SSL for the control connection or fail */
  275. CURLFTPSSL_ALL, /* SSL for all communication or fail */
  276. CURLFTPSSL_LAST /* not an option, never use */
  277. } curl_ftpssl;
  278. /* long may be 32 or 64 bits, but we should never depend on anything else
  279. but 32 */
  280. #define CURLOPTTYPE_LONG 0
  281. #define CURLOPTTYPE_OBJECTPOINT 10000
  282. #define CURLOPTTYPE_FUNCTIONPOINT 20000
  283. #define CURLOPTTYPE_OFF_T 30000
  284. /* name is uppercase CURLOPT_<name>,
  285. type is one of the defined CURLOPTTYPE_<type>
  286. number is unique identifier */
  287. #ifdef CINIT
  288. #undef CINIT
  289. #endif
  290. /*
  291. * Figure out if we can use the ## operator, which is supported by ISO/ANSI C
  292. * and C++. Some compilers support it without setting __STDC__ or __cplusplus
  293. * so we need to carefully check for them too. We don't use configure-checks
  294. * for these since we want these headers to remain generic and working for all
  295. * platforms.
  296. */
  297. #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
  298. defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__)
  299. /* This compiler is believed to have an ISO compatible preprocessor */
  300. #define CURL_ISOCPP
  301. #else
  302. /* This compiler is believed NOT to have an ISO compatible preprocessor */
  303. #undef CURL_ISOCPP
  304. #endif
  305. #ifdef CURL_ISOCPP
  306. #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
  307. #else
  308. /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
  309. #define LONG CURLOPTTYPE_LONG
  310. #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
  311. #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
  312. #define OFF_T CURLOPTTYPE_OFF_T
  313. #define CINIT(name,type,number) CURLOPT_/**/name = type + number
  314. #endif
  315. /*
  316. * This macro-mania below setups the CURLOPT_[what] enum, to be used with
  317. * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
  318. * word.
  319. */
  320. typedef enum {
  321. /* This is the FILE * or void * the regular output should be written to. */
  322. CINIT(FILE, OBJECTPOINT, 1),
  323. /* The full URL to get/put */
  324. CINIT(URL, OBJECTPOINT, 2),
  325. /* Port number to connect to, if other than default. */
  326. CINIT(PORT, LONG, 3),
  327. /* Name of proxy to use. */
  328. CINIT(PROXY, OBJECTPOINT, 4),
  329. /* "name:password" to use when fetching. */
  330. CINIT(USERPWD, OBJECTPOINT, 5),
  331. /* "name:password" to use with proxy. */
  332. CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
  333. /* Range to get, specified as an ASCII string. */
  334. CINIT(RANGE, OBJECTPOINT, 7),
  335. /* not used */
  336. /* Specified file stream to upload from (use as input): */
  337. CINIT(INFILE, OBJECTPOINT, 9),
  338. /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
  339. * bytes big. If this is not used, error messages go to stderr instead: */
  340. CINIT(ERRORBUFFER, OBJECTPOINT, 10),
  341. /* Function that will be called to store the output (instead of fwrite). The
  342. * parameters will use fwrite() syntax, make sure to follow them. */
  343. CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
  344. /* Function that will be called to read the input (instead of fread). The
  345. * parameters will use fread() syntax, make sure to follow them. */
  346. CINIT(READFUNCTION, FUNCTIONPOINT, 12),
  347. /* Time-out the read operation after this amount of seconds */
  348. CINIT(TIMEOUT, LONG, 13),
  349. /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
  350. * how large the file being sent really is. That allows better error
  351. * checking and better verifies that the upload was succcessful. -1 means
  352. * unknown size.
  353. *
  354. * For large file support, there is also a _LARGE version of the key
  355. * which takes an off_t type, allowing platforms with larger off_t
  356. * sizes to handle larger files. See below for INFILESIZE_LARGE.
  357. */
  358. CINIT(INFILESIZE, LONG, 14),
  359. /* POST input fields. */
  360. CINIT(POSTFIELDS, OBJECTPOINT, 15),
  361. /* Set the referer page (needed by some CGIs) */
  362. CINIT(REFERER, OBJECTPOINT, 16),
  363. /* Set the FTP PORT string (interface name, named or numerical IP address)
  364. Use i.e '-' to use default address. */
  365. CINIT(FTPPORT, OBJECTPOINT, 17),
  366. /* Set the User-Agent string (examined by some CGIs) */
  367. CINIT(USERAGENT, OBJECTPOINT, 18),
  368. /* If the download receives less than "low speed limit" bytes/second
  369. * during "low speed time" seconds, the operations is aborted.
  370. * You could i.e if you have a pretty high speed connection, abort if
  371. * it is less than 2000 bytes/sec during 20 seconds.
  372. */
  373. /* Set the "low speed limit" */
  374. CINIT(LOW_SPEED_LIMIT, LONG , 19),
  375. /* Set the "low speed time" */
  376. CINIT(LOW_SPEED_TIME, LONG, 20),
  377. /* Set the continuation offset.
  378. *
  379. * Note there is also a _LARGE version of this key which uses
  380. * off_t types, allowing for large file offsets on platforms which
  381. * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
  382. */
  383. CINIT(RESUME_FROM, LONG, 21),
  384. /* Set cookie in request: */
  385. CINIT(COOKIE, OBJECTPOINT, 22),
  386. /* This points to a linked list of headers, struct curl_slist kind */
  387. CINIT(HTTPHEADER, OBJECTPOINT, 23),
  388. /* This points to a linked list of post entries, struct HttpPost */
  389. CINIT(HTTPPOST, OBJECTPOINT, 24),
  390. /* name of the file keeping your private SSL-certificate */
  391. CINIT(SSLCERT, OBJECTPOINT, 25),
  392. /* password for the SSL-private key, keep this for compatibility */
  393. CINIT(SSLCERTPASSWD, OBJECTPOINT, 26),
  394. /* password for the SSL private key */
  395. CINIT(SSLKEYPASSWD, OBJECTPOINT, 26),
  396. /* send TYPE parameter? */
  397. CINIT(CRLF, LONG, 27),
  398. /* send linked-list of QUOTE commands */
  399. CINIT(QUOTE, OBJECTPOINT, 28),
  400. /* send FILE * or void * to store headers to, if you use a callback it
  401. is simply passed to the callback unmodified */
  402. CINIT(WRITEHEADER, OBJECTPOINT, 29),
  403. /* point to a file to read the initial cookies from, also enables
  404. "cookie awareness" */
  405. CINIT(COOKIEFILE, OBJECTPOINT, 31),
  406. /* What version to specifly try to use.
  407. See CURL_SSLVERSION defines below. */
  408. CINIT(SSLVERSION, LONG, 32),
  409. /* What kind of HTTP time condition to use, see defines */
  410. CINIT(TIMECONDITION, LONG, 33),
  411. /* Time to use with the above condition. Specified in number of seconds
  412. since 1 Jan 1970 */
  413. CINIT(TIMEVALUE, LONG, 34),
  414. /* 35 = OBSOLETE */
  415. /* Custom request, for customizing the get command like
  416. HTTP: DELETE, TRACE and others
  417. FTP: to use a different list command
  418. */
  419. CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
  420. /* HTTP request, for odd commands like DELETE, TRACE and others */
  421. CINIT(STDERR, OBJECTPOINT, 37),
  422. /* 38 is not used */
  423. /* send linked-list of post-transfer QUOTE commands */
  424. CINIT(POSTQUOTE, OBJECTPOINT, 39),
  425. /* Pass a pointer to string of the output using full variable-replacement
  426. as described elsewhere. */
  427. CINIT(WRITEINFO, OBJECTPOINT, 40),
  428. CINIT(VERBOSE, LONG, 41), /* talk a lot */
  429. CINIT(HEADER, LONG, 42), /* throw the header out too */
  430. CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */
  431. CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */
  432. CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */
  433. CINIT(UPLOAD, LONG, 46), /* this is an upload */
  434. CINIT(POST, LONG, 47), /* HTTP POST method */
  435. CINIT(FTPLISTONLY, LONG, 48), /* Use NLST when listing ftp dir */
  436. CINIT(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
  437. /* Specify whether to read the user+password from the .netrc or the URL.
  438. * This must be one of the CURL_NETRC_* enums below. */
  439. CINIT(NETRC, LONG, 51),
  440. CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
  441. CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
  442. CINIT(PUT, LONG, 54), /* HTTP PUT */
  443. /* 55 = OBSOLETE */
  444. /* Function that will be called instead of the internal progress display
  445. * function. This function should be defined as the curl_progress_callback
  446. * prototype defines. */
  447. CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
  448. /* Data passed to the progress callback */
  449. CINIT(PROGRESSDATA, OBJECTPOINT, 57),
  450. /* We want the referer field set automatically when following locations */
  451. CINIT(AUTOREFERER, LONG, 58),
  452. /* Port of the proxy, can be set in the proxy string as well with:
  453. "[host]:[port]" */
  454. CINIT(PROXYPORT, LONG, 59),
  455. /* size of the POST input data, if strlen() is not good to use */
  456. CINIT(POSTFIELDSIZE, LONG, 60),
  457. /* tunnel non-http operations through a HTTP proxy */
  458. CINIT(HTTPPROXYTUNNEL, LONG, 61),
  459. /* Set the interface string to use as outgoing network interface */
  460. CINIT(INTERFACE, OBJECTPOINT, 62),
  461. /* Set the krb4 security level, this also enables krb4 awareness. This is a
  462. * string, 'clear', 'safe', 'confidential' or 'private'. If the string is
  463. * set but doesn't match one of these, 'private' will be used. */
  464. CINIT(KRB4LEVEL, OBJECTPOINT, 63),
  465. /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
  466. CINIT(SSL_VERIFYPEER, LONG, 64),
  467. /* The CApath or CAfile used to validate the peer certificate
  468. this option is used only if SSL_VERIFYPEER is true */
  469. CINIT(CAINFO, OBJECTPOINT, 65),
  470. /* 66 = OBSOLETE */
  471. /* 67 = OBSOLETE */
  472. /* Maximum number of http redirects to follow */
  473. CINIT(MAXREDIRS, LONG, 68),
  474. /* Pass a long set to 1 to get the date of the requested document (if
  475. possible)! Pass a zero to shut it off. */
  476. CINIT(FILETIME, LONG, 69),
  477. /* This points to a linked list of telnet options */
  478. CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
  479. /* Max amount of cached alive connections */
  480. CINIT(MAXCONNECTS, LONG, 71),
  481. /* What policy to use when closing connections when the cache is filled
  482. up */
  483. CINIT(CLOSEPOLICY, LONG, 72),
  484. /* 73 = OBSOLETE */
  485. /* Set to explicitly use a new connection for the upcoming transfer.
  486. Do not use this unless you're absolutely sure of this, as it makes the
  487. operation slower and is less friendly for the network. */
  488. CINIT(FRESH_CONNECT, LONG, 74),
  489. /* Set to explicitly forbid the upcoming transfer's connection to be re-used
  490. when done. Do not use this unless you're absolutely sure of this, as it
  491. makes the operation slower and is less friendly for the network. */
  492. CINIT(FORBID_REUSE, LONG, 75),
  493. /* Set to a file name that contains random data for libcurl to use to
  494. seed the random engine when doing SSL connects. */
  495. CINIT(RANDOM_FILE, OBJECTPOINT, 76),
  496. /* Set to the Entropy Gathering Daemon socket pathname */
  497. CINIT(EGDSOCKET, OBJECTPOINT, 77),
  498. /* Time-out connect operations after this amount of seconds, if connects
  499. are OK within this time, then fine... This only aborts the connect
  500. phase. [Only works on unix-style/SIGALRM operating systems] */
  501. CINIT(CONNECTTIMEOUT, LONG, 78),
  502. /* Function that will be called to store headers (instead of fwrite). The
  503. * parameters will use fwrite() syntax, make sure to follow them. */
  504. CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
  505. /* Set this to force the HTTP request to get back to GET. Only really usable
  506. if POST, PUT or a custom request have been used first.
  507. */
  508. CINIT(HTTPGET, LONG, 80),
  509. /* Set if we should verify the Common name from the peer certificate in ssl
  510. * handshake, set 1 to check existence, 2 to ensure that it matches the
  511. * provided hostname. */
  512. CINIT(SSL_VERIFYHOST, LONG, 81),
  513. /* Specify which file name to write all known cookies in after completed
  514. operation. Set file name to "-" (dash) to make it go to stdout. */
  515. CINIT(COOKIEJAR, OBJECTPOINT, 82),
  516. /* Specify which SSL ciphers to use */
  517. CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),
  518. /* Specify which HTTP version to use! This must be set to one of the
  519. CURL_HTTP_VERSION* enums set below. */
  520. CINIT(HTTP_VERSION, LONG, 84),
  521. /* Specificly switch on or off the FTP engine's use of the EPSV command. By
  522. default, that one will always be attempted before the more traditional
  523. PASV command. */
  524. CINIT(FTP_USE_EPSV, LONG, 85),
  525. /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
  526. CINIT(SSLCERTTYPE, OBJECTPOINT, 86),
  527. /* name of the file keeping your private SSL-key */
  528. CINIT(SSLKEY, OBJECTPOINT, 87),
  529. /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
  530. CINIT(SSLKEYTYPE, OBJECTPOINT, 88),
  531. /* crypto engine for the SSL-sub system */
  532. CINIT(SSLENGINE, OBJECTPOINT, 89),
  533. /* set the crypto engine for the SSL-sub system as default
  534. the param has no meaning...
  535. */
  536. CINIT(SSLENGINE_DEFAULT, LONG, 90),
  537. /* Non-zero value means to use the global dns cache */
  538. CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */
  539. /* DNS cache timeout */
  540. CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
  541. /* send linked-list of pre-transfer QUOTE commands (Wesley Laxton)*/
  542. CINIT(PREQUOTE, OBJECTPOINT, 93),
  543. /* set the debug function */
  544. CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
  545. /* set the data for the debug function */
  546. CINIT(DEBUGDATA, OBJECTPOINT, 95),
  547. /* mark this as start of a cookie session */
  548. CINIT(COOKIESESSION, LONG, 96),
  549. /* The CApath directory used to validate the peer certificate
  550. this option is used only if SSL_VERIFYPEER is true */
  551. CINIT(CAPATH, OBJECTPOINT, 97),
  552. /* Instruct libcurl to use a smaller receive buffer */
  553. CINIT(BUFFERSIZE, LONG, 98),
  554. /* Instruct libcurl to not use any signal/alarm handlers, even when using
  555. timeouts. This option is useful for multi-threaded applications.
  556. See libcurl-the-guide for more background information. */
  557. CINIT(NOSIGNAL, LONG, 99),
  558. /* Provide a CURLShare for mutexing non-ts data */
  559. CINIT(SHARE, OBJECTPOINT, 100),
  560. /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
  561. CURLPROXY_SOCKS4 and CURLPROXY_SOCKS5. */
  562. CINIT(PROXYTYPE, LONG, 101),
  563. /* Set the Accept-Encoding string. Use this to tell a server you would like
  564. the response to be compressed. */
  565. CINIT(ENCODING, OBJECTPOINT, 102),
  566. /* Set pointer to private data */
  567. CINIT(PRIVATE, OBJECTPOINT, 103),
  568. /* Set aliases for HTTP 200 in the HTTP Response header */
  569. CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
  570. /* Continue to send authentication (user+password) when following locations,
  571. even when hostname changed. This can potentionally send off the name
  572. and password to whatever host the server decides. */
  573. CINIT(UNRESTRICTED_AUTH, LONG, 105),
  574. /* Specificly switch on or off the FTP engine's use of the EPRT command ( it
  575. also disables the LPRT attempt). By default, those ones will always be
  576. attempted before the good old traditional PORT command. */
  577. CINIT(FTP_USE_EPRT, LONG, 106),
  578. /* Set this to a bitmask value to enable the particular authentications
  579. methods you like. Use this in combination with CURLOPT_USERPWD.
  580. Note that setting multiple bits may cause extra network round-trips. */
  581. CINIT(HTTPAUTH, LONG, 107),
  582. /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
  583. in second argument. The function must be matching the
  584. curl_ssl_ctx_callback proto. */
  585. CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
  586. /* Set the userdata for the ssl context callback function's third
  587. argument */
  588. CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
  589. /* FTP Option that causes missing dirs to be created on the remote server */
  590. CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
  591. /* Set this to a bitmask value to enable the particular authentications
  592. methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
  593. Note that setting multiple bits may cause extra network round-trips. */
  594. CINIT(PROXYAUTH, LONG, 111),
  595. /* FTP option that changes the timeout, in seconds, associated with
  596. getting a response. This is different from transfer timeout time and
  597. essentially places a demand on the FTP server to acknowledge commands
  598. in a timely manner. */
  599. CINIT(FTP_RESPONSE_TIMEOUT, LONG , 112),
  600. /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
  601. tell libcurl to resolve names to those IP versions only. This only has
  602. affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
  603. CINIT(IPRESOLVE, LONG, 113),
  604. /* Set this option to limit the size of a file that will be downloaded from
  605. an HTTP or FTP server.
  606. Note there is also _LARGE version which adds large file support for
  607. platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
  608. CINIT(MAXFILESIZE, LONG, 114),
  609. /* See the comment for INFILESIZE above, but in short, specifies
  610. * the size of the file being uploaded. -1 means unknown.
  611. */
  612. CINIT(INFILESIZE_LARGE, OFF_T, 115),
  613. /* Sets the continuation offset. There is also a LONG version of this;
  614. * look above for RESUME_FROM.
  615. */
  616. CINIT(RESUME_FROM_LARGE, OFF_T, 116),
  617. /* Sets the maximum size of data that will be downloaded from
  618. * an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
  619. */
  620. CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
  621. /* Set this option to the file name of your .netrc file you want libcurl
  622. to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
  623. a poor attempt to find the user's home directory and check for a .netrc
  624. file in there. */
  625. CINIT(NETRC_FILE, OBJECTPOINT, 118),
  626. /* Enable SSL/TLS for FTP, pick one of:
  627. CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise
  628. CURLFTPSSL_CONTROL - SSL for the control connection or fail
  629. CURLFTPSSL_ALL - SSL for all communication or fail
  630. */
  631. CINIT(FTP_SSL, LONG, 119),
  632. /* The _LARGE version of the standard POSTFIELDSIZE option */
  633. CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
  634. /* Enable/disable the TCP Nagle algorithm */
  635. CINIT(TCP_NODELAY, LONG, 121),
  636. /* When doing 3rd party transfer, set the source host name with this */
  637. CINIT(SOURCE_HOST, OBJECTPOINT, 122),
  638. /* When doing 3rd party transfer, set the source user and password with
  639. this */
  640. CINIT(SOURCE_USERPWD, OBJECTPOINT, 123),
  641. /* When doing 3rd party transfer, set the source file path with this */
  642. CINIT(SOURCE_PATH, OBJECTPOINT, 124),
  643. /* When doing 3rd party transfer, set the source server's port number
  644. with this */
  645. CINIT(SOURCE_PORT, LONG, 125),
  646. /* When doing 3rd party transfer, decide which server that should get the
  647. PASV command (and the other gets the PORT).
  648. 0 (default) - The target host issues PASV.
  649. 1 - The source host issues PASV */
  650. CINIT(PASV_HOST, LONG, 126),
  651. /* When doing 3rd party transfer, set the source pre-quote linked list
  652. of commands with this */
  653. CINIT(SOURCE_PREQUOTE, OBJECTPOINT, 127),
  654. /* When doing 3rd party transfer, set the source post-quote linked list
  655. of commands with this */
  656. CINIT(SOURCE_POSTQUOTE, OBJECTPOINT, 128),
  657. CURLOPT_LASTENTRY /* the last unused */
  658. } CURLoption;
  659. /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
  660. name resolves addresses using more than one IP protocol version, this
  661. option might be handy to force libcurl to use a specific IP version. */
  662. #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
  663. versions that your system allows */
  664. #define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */
  665. #define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */
  666. /* three convenient "aliases" that follow the name scheme better */
  667. #define CURLOPT_WRITEDATA CURLOPT_FILE
  668. #define CURLOPT_READDATA CURLOPT_INFILE
  669. #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
  670. #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
  671. the obsolete stuff removed! */
  672. #define CURLOPT_HTTPREQUEST -1
  673. #define CURLOPT_FTPASCII CURLOPT_TRANSFERTEXT
  674. #define CURLOPT_MUTE -2
  675. #define CURLOPT_PASSWDFUNCTION -3
  676. #define CURLOPT_PASSWDDATA -4
  677. #define CURLOPT_CLOSEFUNCTION -5
  678. #else
  679. /* This is set if CURL_NO_OLDIES is defined at compile-time */
  680. #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
  681. #endif
  682. /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
  683. enum {
  684. CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
  685. like the library to choose the best possible
  686. for us! */
  687. CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */
  688. CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */
  689. CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
  690. };
  691. /* These enums are for use with the CURLOPT_NETRC option. */
  692. enum CURL_NETRC_OPTION {
  693. CURL_NETRC_IGNORED, /* The .netrc will never be read.
  694. * This is the default. */
  695. CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred
  696. * to one in the .netrc. */
  697. CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored.
  698. * Unless one is set programmatically, the .netrc
  699. * will be queried. */
  700. CURL_NETRC_LAST
  701. };
  702. enum {
  703. CURL_SSLVERSION_DEFAULT,
  704. CURL_SSLVERSION_TLSv1,
  705. CURL_SSLVERSION_SSLv2,
  706. CURL_SSLVERSION_SSLv3,
  707. CURL_SSLVERSION_LAST /* never use, keep last */
  708. };
  709. typedef enum {
  710. CURL_TIMECOND_NONE,
  711. CURL_TIMECOND_IFMODSINCE,
  712. CURL_TIMECOND_IFUNMODSINCE,
  713. CURL_TIMECOND_LASTMOD,
  714. CURL_TIMECOND_LAST
  715. } curl_TimeCond;
  716. #ifdef __BEOS__
  717. #include <support/SupportDefs.h>
  718. #endif
  719. /* curl_strequal() and curl_strnequal() are subject for removal in a future
  720. libcurl, see lib/README.curlx for details */
  721. extern int (curl_strequal)(const char *s1, const char *s2);
  722. extern int (curl_strnequal)(const char *s1, const char *s2, size_t n);
  723. /* name is uppercase CURLFORM_<name> */
  724. #ifdef CFINIT
  725. #undef CFINIT
  726. #endif
  727. #ifdef CURL_ISOCPP
  728. #define CFINIT(name) CURLFORM_ ## name
  729. #else
  730. /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
  731. #define CFINIT(name) CURLFORM_/**/name
  732. #endif
  733. typedef enum {
  734. CFINIT(NOTHING), /********* the first one is unused ************/
  735. /* */
  736. CFINIT(COPYNAME),
  737. CFINIT(PTRNAME),
  738. CFINIT(NAMELENGTH),
  739. CFINIT(COPYCONTENTS),
  740. CFINIT(PTRCONTENTS),
  741. CFINIT(CONTENTSLENGTH),
  742. CFINIT(FILECONTENT),
  743. CFINIT(ARRAY),
  744. CFINIT(OBSOLETE),
  745. CFINIT(FILE),
  746. CFINIT(BUFFER),
  747. CFINIT(BUFFERPTR),
  748. CFINIT(BUFFERLENGTH),
  749. CFINIT(CONTENTTYPE),
  750. CFINIT(CONTENTHEADER),
  751. CFINIT(FILENAME),
  752. CFINIT(END),
  753. CFINIT(OBSOLETE2),
  754. CURLFORM_LASTENTRY /* the last unusued */
  755. } CURLformoption;
  756. #undef CFINIT /* done */
  757. /* structure to be used as parameter for CURLFORM_ARRAY */
  758. struct curl_forms {
  759. CURLformoption option;
  760. const char *value;
  761. };
  762. /* use this for multipart formpost building */
  763. /* Returns code for curl_formadd()
  764. *
  765. * Returns:
  766. * CURL_FORMADD_OK on success
  767. * CURL_FORMADD_MEMORY if the FormInfo allocation fails
  768. * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
  769. * CURL_FORMADD_NULL if a null pointer was given for a char
  770. * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
  771. * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
  772. * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
  773. * CURL_FORMADD_MEMORY if a HttpPost struct cannot be allocated
  774. * CURL_FORMADD_MEMORY if some allocation for string copying failed.
  775. * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
  776. *
  777. ***************************************************************************/
  778. typedef enum {
  779. CURL_FORMADD_OK, /* first, no error */
  780. CURL_FORMADD_MEMORY,
  781. CURL_FORMADD_OPTION_TWICE,
  782. CURL_FORMADD_NULL,
  783. CURL_FORMADD_UNKNOWN_OPTION,
  784. CURL_FORMADD_INCOMPLETE,
  785. CURL_FORMADD_ILLEGAL_ARRAY,
  786. CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
  787. CURL_FORMADD_LAST /* last */
  788. } CURLFORMcode;
  789. /*
  790. * NAME curl_formadd()
  791. *
  792. * DESCRIPTION
  793. *
  794. * Pretty advanved function for building multi-part formposts. Each invoke
  795. * adds one part that together construct a full post. Then use
  796. * CURLOPT_HTTPPOST to send it off to libcurl.
  797. */
  798. CURLFORMcode curl_formadd(struct curl_httppost **httppost,
  799. struct curl_httppost **last_post,
  800. ...);
  801. /*
  802. * NAME curl_formfree()
  803. *
  804. * DESCRIPTION
  805. *
  806. * Free a multipart formpost previously built with curl_formadd().
  807. */
  808. void curl_formfree(struct curl_httppost *form);
  809. /*
  810. * NAME curl_getenv()
  811. *
  812. * DESCRIPTION
  813. *
  814. * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
  815. * complete. DEPRECATED - see lib/README.curlx
  816. */
  817. char *curl_getenv(const char *variable);
  818. /*
  819. * NAME curl_version()
  820. *
  821. * DESCRIPTION
  822. *
  823. * Returns a static ascii string of the libcurl version.
  824. */
  825. char *curl_version(void);
  826. /*
  827. * NAME curl_escape()
  828. *
  829. * DESCRIPTION
  830. *
  831. * Escapes URL strings (converts all letters consider illegal in URLs to their
  832. * %XX versions). This function returns a new allocated string or NULL if an
  833. * error occurred.
  834. */
  835. char *curl_escape(const char *string, int length);
  836. /*
  837. * NAME curl_unescape()
  838. *
  839. * DESCRIPTION
  840. *
  841. * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
  842. * versions). This function returns a new allocated string or NULL if an error
  843. * occurred.
  844. */
  845. char *curl_unescape(const char *string, int length);
  846. /*
  847. * NAME curl_free()
  848. *
  849. * DESCRIPTION
  850. *
  851. * Provided for de-allocation in the same translation unit that did the
  852. * allocation. Added in libcurl 7.10
  853. */
  854. void curl_free(void *p);
  855. /*
  856. * NAME curl_global_init()
  857. *
  858. * DESCRIPTION
  859. *
  860. * curl_global_init() should be invoked exactly once for each application that
  861. * uses libcurl
  862. */
  863. CURLcode curl_global_init(long flags);
  864. /*
  865. * NAME curl_global_init_mem()
  866. *
  867. * DESCRIPTION
  868. *
  869. * curl_global_init() or curl_global_init_mem() should be invoked exactly once
  870. * for each application that uses libcurl. This function can be used to
  871. * initialize libcurl and set user defined memory management callback
  872. * functions. Users can implement memory management routines to check for
  873. * memory leaks, check for mis-use of the curl library etc. User registered
  874. * callback routines with be invoked by this library instead of the system
  875. * memory management routines like malloc, free etc.
  876. */
  877. CURLcode curl_global_init_mem(long flags,
  878. curl_malloc_callback m,
  879. curl_free_callback f,
  880. curl_realloc_callback r,
  881. curl_strdup_callback s,
  882. curl_calloc_callback c);
  883. /*
  884. * NAME curl_global_cleanup()
  885. *
  886. * DESCRIPTION
  887. *
  888. * curl_global_cleanup() should be invoked exactly once for each application
  889. * that uses libcurl
  890. */
  891. void curl_global_cleanup(void);
  892. /* linked-list structure for the CURLOPT_QUOTE option (and other) */
  893. struct curl_slist {
  894. char *data;
  895. struct curl_slist *next;
  896. };
  897. /*
  898. * NAME curl_slist_append()
  899. *
  900. * DESCRIPTION
  901. *
  902. * Appends a string to a linked list. If no list exists, it will be created
  903. * first. Returns the new list, after appending.
  904. */
  905. struct curl_slist *curl_slist_append(struct curl_slist *, const char *);
  906. /*
  907. * NAME curl_slist_free_all()
  908. *
  909. * DESCRIPTION
  910. *
  911. * free a previously built curl_slist.
  912. */
  913. void curl_slist_free_all(struct curl_slist *);
  914. /*
  915. * NAME curl_getdate()
  916. *
  917. * DESCRIPTION
  918. *
  919. * Returns the time, in seconds since 1 Jan 1970 of the time string given in
  920. * the first argument. The time argument in the second parameter is for cases
  921. * where the specified time is relative now, like 'two weeks' or 'tomorrow'
  922. * etc.
  923. */
  924. time_t curl_getdate(const char *p, const time_t *now);
  925. #define CURLINFO_STRING 0x100000
  926. #define CURLINFO_LONG 0x200000
  927. #define CURLINFO_DOUBLE 0x300000
  928. #define CURLINFO_MASK 0x0fffff
  929. #define CURLINFO_TYPEMASK 0xf00000
  930. typedef enum {
  931. CURLINFO_NONE, /* first, never use this */
  932. CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1,
  933. CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2,
  934. CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3,
  935. CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4,
  936. CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5,
  937. CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
  938. CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7,
  939. CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8,
  940. CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9,
  941. CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10,
  942. CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11,
  943. CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12,
  944. CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13,
  945. CURLINFO_FILETIME = CURLINFO_LONG + 14,
  946. CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15,
  947. CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16,
  948. CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
  949. CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18,
  950. CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19,
  951. CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20,
  952. CURLINFO_PRIVATE = CURLINFO_STRING + 21,
  953. CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22,
  954. CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23,
  955. CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24,
  956. /* Fill in new entries below here! */
  957. CURLINFO_LASTONE = 23
  958. } CURLINFO;
  959. /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
  960. CURLINFO_HTTP_CODE */
  961. #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
  962. typedef enum {
  963. CURLCLOSEPOLICY_NONE, /* first, never use this */
  964. CURLCLOSEPOLICY_OLDEST,
  965. CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
  966. CURLCLOSEPOLICY_LEAST_TRAFFIC,
  967. CURLCLOSEPOLICY_SLOWEST,
  968. CURLCLOSEPOLICY_CALLBACK,
  969. CURLCLOSEPOLICY_LAST /* last, never use this */
  970. } curl_closepolicy;
  971. #define CURL_GLOBAL_SSL (1<<0)
  972. #define CURL_GLOBAL_WIN32 (1<<1)
  973. #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
  974. #define CURL_GLOBAL_NOTHING 0
  975. #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
  976. /*****************************************************************************
  977. * Setup defines, protos etc for the sharing stuff.
  978. */
  979. /* Different data locks for a single share */
  980. typedef enum {
  981. CURL_LOCK_DATA_NONE = 0,
  982. /* CURL_LOCK_DATA_SHARE is used internaly to say that
  983. * the locking is just made to change the internal state of the share
  984. * itself.
  985. */
  986. CURL_LOCK_DATA_SHARE,
  987. CURL_LOCK_DATA_COOKIE,
  988. CURL_LOCK_DATA_DNS,
  989. CURL_LOCK_DATA_SSL_SESSION,
  990. CURL_LOCK_DATA_CONNECT,
  991. CURL_LOCK_DATA_LAST
  992. } curl_lock_data;
  993. /* Different lock access types */
  994. typedef enum {
  995. CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */
  996. CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
  997. CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
  998. CURL_LOCK_ACCESS_LAST /* never use */
  999. } curl_lock_access;
  1000. typedef void (*curl_lock_function)(CURL *handle,
  1001. curl_lock_data data,
  1002. curl_lock_access locktype,
  1003. void *userptr);
  1004. typedef void (*curl_unlock_function)(CURL *handle,
  1005. curl_lock_data data,
  1006. void *userptr);
  1007. typedef void CURLSH;
  1008. typedef enum {
  1009. CURLSHE_OK, /* all is fine */
  1010. CURLSHE_BAD_OPTION, /* 1 */
  1011. CURLSHE_IN_USE, /* 2 */
  1012. CURLSHE_INVALID, /* 3 */
  1013. CURLSHE_NOMEM, /* out of memory */
  1014. CURLSHE_LAST /* never use */
  1015. } CURLSHcode;
  1016. typedef enum {
  1017. CURLSHOPT_NONE, /* don't use */
  1018. CURLSHOPT_SHARE, /* specify a data type to share */
  1019. CURLSHOPT_UNSHARE, /* specify shich data type to stop sharing */
  1020. CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */
  1021. CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
  1022. CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock
  1023. callback functions */
  1024. CURLSHOPT_LAST /* never use */
  1025. } CURLSHoption;
  1026. CURLSH *curl_share_init(void);
  1027. CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
  1028. CURLSHcode curl_share_cleanup(CURLSH *);
  1029. /****************************************************************************
  1030. * Structures for querying information about the curl library at runtime.
  1031. */
  1032. typedef enum {
  1033. CURLVERSION_FIRST,
  1034. CURLVERSION_SECOND,
  1035. CURLVERSION_THIRD,
  1036. CURLVERSION_LAST /* never actually use this */
  1037. } CURLversion;
  1038. /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
  1039. basicly all programs ever, that want to get version information. It is
  1040. meant to be a built-in version number for what kind of struct the caller
  1041. expects. If the struct ever changes, we redfine the NOW to another enum
  1042. from above. */
  1043. #define CURLVERSION_NOW CURLVERSION_THIRD
  1044. typedef struct {
  1045. CURLversion age; /* age of the returned struct */
  1046. const char *version; /* LIBCURL_VERSION */
  1047. unsigned int version_num; /* LIBCURL_VERSION_NUM */
  1048. const char *host; /* OS/host/cpu/machine when configured */
  1049. int features; /* bitmask, see defines below */
  1050. char *ssl_version; /* human readable string */
  1051. long ssl_version_num; /* number */
  1052. const char *libz_version; /* human readable string */
  1053. /* protocols is terminated by an entry with a NULL protoname */
  1054. const char **protocols;
  1055. /* The fields below this were added in CURLVERSION_SECOND */
  1056. const char *ares;
  1057. int ares_num;
  1058. /* This field was aded in CURLVERSION_THIRD */
  1059. const char *libidn;
  1060. } curl_version_info_data;
  1061. #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */
  1062. #define CURL_VERSION_KERBEROS4 (1<<1) /* kerberos auth is supported */
  1063. #define CURL_VERSION_SSL (1<<2) /* SSL options are present */
  1064. #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */
  1065. #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */
  1066. #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */
  1067. #define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */
  1068. #define CURL_VERSION_ASYNCHDNS (1<<7) /* asynchronous dns resolves */
  1069. #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */
  1070. #define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */
  1071. #define CURL_VERSION_IDN (1<<10) /* International Domain Names support */
  1072. /*
  1073. * NAME curl_version_info()
  1074. *
  1075. * DESCRIPTION
  1076. *
  1077. * This function returns a pointer to a static copy of the version info
  1078. * struct. See above.
  1079. */
  1080. curl_version_info_data *curl_version_info(CURLversion);
  1081. /*
  1082. * NAME curl_easy_strerror()
  1083. *
  1084. * DESCRIPTION
  1085. *
  1086. * The curl_easy_strerror function may be used to turn a CURLcode value
  1087. * into the equivalent human readable error string. This is useful
  1088. * for printing meaningful error messages.
  1089. */
  1090. const char *curl_easy_strerror(CURLcode);
  1091. /*
  1092. * NAME curl_share_strerror()
  1093. *
  1094. * DESCRIPTION
  1095. *
  1096. * The curl_share_strerror function may be used to turn a CURLSHcode value
  1097. * into the equivalent human readable error string. This is useful
  1098. * for printing meaningful error messages.
  1099. */
  1100. const char *curl_share_strerror(CURLSHcode);
  1101. #ifdef __cplusplus
  1102. }
  1103. #endif
  1104. /* unfortunately, the easy.h and multi.h include files need options and info
  1105. stuff before they can be included! */
  1106. #include "easy.h" /* nothing in curl is fun without the easy stuff */
  1107. #include "multi.h"
  1108. #endif /* __CURL_CURL_H */