1
0

curl.h 59 KB

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