curl.h 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947
  1. #ifndef __CURL_CURL_H
  2. #define __CURL_CURL_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, 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: curl.h,v 1.396 2009-10-16 13:30:31 yangtse Exp $
  24. ***************************************************************************/
  25. /*
  26. * If you have libcurl problems, all docs and details are found here:
  27. * http://curl.haxx.se/libcurl/
  28. *
  29. * curl-library mailing list subscription and unsubscription web interface:
  30. * http://cool.haxx.se/mailman/listinfo/curl-library/
  31. */
  32. /*
  33. * Leading 'curl' path on the 'curlbuild.h' include statement is
  34. * required to properly allow building outside of the source tree,
  35. * due to the fact that in this case 'curlbuild.h' is generated in
  36. * a subdirectory of the build tree while 'curl.h actually remains
  37. * in a subdirectory of the source tree.
  38. */
  39. #include "curlver.h" /* libcurl version defines */
  40. #include "curl/curlbuild.h" /* libcurl build definitions */
  41. #include "curlrules.h" /* libcurl rules enforcement */
  42. /*
  43. * Define WIN32 when build target is Win32 API
  44. */
  45. #if (defined(_WIN32) || defined(__WIN32__)) && \
  46. !defined(WIN32) && !defined(__SYMBIAN32__)
  47. #define WIN32
  48. #endif
  49. #include <stdio.h>
  50. #include <limits.h>
  51. /* The include stuff here below is mainly for time_t! */
  52. #include <sys/types.h>
  53. #include <time.h>
  54. #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
  55. !defined(__CYGWIN__) || defined(__MINGW32__)
  56. #if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
  57. /* The check above prevents the winsock2 inclusion if winsock.h already was
  58. included, since they can't co-exist without problems */
  59. #include <winsock2.h>
  60. #include <ws2tcpip.h>
  61. #endif
  62. #else
  63. /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
  64. libc5-based Linux systems. Only include it on system that are known to
  65. require it! */
  66. #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
  67. defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
  68. defined(ANDROID)
  69. #include <sys/select.h>
  70. #endif
  71. #ifndef _WIN32_WCE
  72. #include <sys/socket.h>
  73. #endif
  74. #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
  75. #include <sys/time.h>
  76. #endif
  77. #include <sys/types.h>
  78. #endif
  79. #ifdef __BEOS__
  80. #include <support/SupportDefs.h>
  81. #endif
  82. #ifdef __cplusplus
  83. extern "C" {
  84. #endif
  85. typedef void CURL;
  86. /*
  87. * Decorate exportable functions for Win32 and Symbian OS DLL linking.
  88. * This avoids using a .def file for building libcurl.dll.
  89. */
  90. #if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \
  91. !defined(CURL_STATICLIB)
  92. #if defined(BUILDING_LIBCURL)
  93. #define CURL_EXTERN __declspec(dllexport)
  94. #else
  95. #define CURL_EXTERN __declspec(dllimport)
  96. #endif
  97. #else
  98. #ifdef CURL_HIDDEN_SYMBOLS
  99. /*
  100. * This definition is used to make external definitions visible in the
  101. * shared library when symbols are hidden by default. It makes no
  102. * difference when compiling applications whether this is set or not,
  103. * only when compiling the library.
  104. */
  105. #define CURL_EXTERN CURL_EXTERN_SYMBOL
  106. #else
  107. #define CURL_EXTERN
  108. #endif
  109. #endif
  110. #ifndef curl_socket_typedef
  111. /* socket typedef */
  112. #ifdef WIN32
  113. typedef SOCKET curl_socket_t;
  114. #define CURL_SOCKET_BAD INVALID_SOCKET
  115. #else
  116. typedef int curl_socket_t;
  117. #define CURL_SOCKET_BAD -1
  118. #endif
  119. #define curl_socket_typedef
  120. #endif /* curl_socket_typedef */
  121. struct curl_httppost {
  122. struct curl_httppost *next; /* next entry in the list */
  123. char *name; /* pointer to allocated name */
  124. long namelength; /* length of name length */
  125. char *contents; /* pointer to allocated data contents */
  126. long contentslength; /* length of contents field */
  127. char *buffer; /* pointer to allocated buffer contents */
  128. long bufferlength; /* length of buffer field */
  129. char *contenttype; /* Content-Type */
  130. struct curl_slist* contentheader; /* list of extra headers for this form */
  131. struct curl_httppost *more; /* if one field name has more than one
  132. file, this link should link to following
  133. files */
  134. long flags; /* as defined below */
  135. #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */
  136. #define HTTPPOST_READFILE (1<<1) /* specified content is a file name */
  137. #define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer
  138. do not free in formfree */
  139. #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
  140. do not free in formfree */
  141. #define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */
  142. #define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */
  143. #define HTTPPOST_CALLBACK (1<<6) /* upload file contents by using the
  144. regular read callback to get the data
  145. and pass the given pointer as custom
  146. pointer */
  147. char *showfilename; /* The file name to show. If not set, the
  148. actual file name will be used (if this
  149. is a file part) */
  150. void *userp; /* custom pointer used for
  151. HTTPPOST_CALLBACK posts */
  152. };
  153. typedef int (*curl_progress_callback)(void *clientp,
  154. double dltotal,
  155. double dlnow,
  156. double ultotal,
  157. double ulnow);
  158. #ifndef CURL_MAX_WRITE_SIZE
  159. /* Tests have proven that 20K is a very bad buffer size for uploads on
  160. Windows, while 16K for some odd reason performed a lot better.
  161. We do the ifndef check to allow this value to easier be changed at build
  162. time for those who feel adventurous. */
  163. #define CURL_MAX_WRITE_SIZE 16384
  164. #endif
  165. #ifndef CURL_MAX_HTTP_HEADER
  166. /* The only reason to have a max limit for this is to avoid the risk of a bad
  167. server feeding libcurl with a never-ending header that will cause reallocs
  168. infinitely */
  169. #define CURL_MAX_HTTP_HEADER (100*1024)
  170. #endif
  171. /* This is a magic return code for the write callback that, when returned,
  172. will signal libcurl to pause receiving on the current transfer. */
  173. #define CURL_WRITEFUNC_PAUSE 0x10000001
  174. typedef size_t (*curl_write_callback)(char *buffer,
  175. size_t size,
  176. size_t nitems,
  177. void *outstream);
  178. /* These are the return codes for the seek callbacks */
  179. #define CURL_SEEKFUNC_OK 0
  180. #define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */
  181. #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so
  182. libcurl might try other means instead */
  183. typedef int (*curl_seek_callback)(void *instream,
  184. curl_off_t offset,
  185. int origin); /* 'whence' */
  186. /* This is a return code for the read callback that, when returned, will
  187. signal libcurl to immediately abort the current transfer. */
  188. #define CURL_READFUNC_ABORT 0x10000000
  189. /* This is a return code for the read callback that, when returned, will
  190. signal libcurl to pause sending data on the current transfer. */
  191. #define CURL_READFUNC_PAUSE 0x10000001
  192. typedef size_t (*curl_read_callback)(char *buffer,
  193. size_t size,
  194. size_t nitems,
  195. void *instream);
  196. typedef enum {
  197. CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
  198. CURLSOCKTYPE_LAST /* never use */
  199. } curlsocktype;
  200. typedef int (*curl_sockopt_callback)(void *clientp,
  201. curl_socket_t curlfd,
  202. curlsocktype purpose);
  203. struct curl_sockaddr {
  204. int family;
  205. int socktype;
  206. int protocol;
  207. unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it
  208. turned really ugly and painful on the systems that
  209. lack this type */
  210. struct sockaddr addr;
  211. };
  212. typedef curl_socket_t
  213. (*curl_opensocket_callback)(void *clientp,
  214. curlsocktype purpose,
  215. struct curl_sockaddr *address);
  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_OBSOLETE4, /* 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_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server
  281. due to lack of access - when login fails
  282. this is not returned. */
  283. CURLE_OBSOLETE10, /* 10 - NOT USED */
  284. CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
  285. CURLE_OBSOLETE12, /* 12 - NOT USED */
  286. CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
  287. CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
  288. CURLE_FTP_CANT_GET_HOST, /* 15 */
  289. CURLE_OBSOLETE16, /* 16 - NOT USED */
  290. CURLE_FTP_COULDNT_SET_TYPE, /* 17 */
  291. CURLE_PARTIAL_FILE, /* 18 */
  292. CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
  293. CURLE_OBSOLETE20, /* 20 - NOT USED */
  294. CURLE_QUOTE_ERROR, /* 21 - quote command failure */
  295. CURLE_HTTP_RETURNED_ERROR, /* 22 */
  296. CURLE_WRITE_ERROR, /* 23 */
  297. CURLE_OBSOLETE24, /* 24 - NOT USED */
  298. CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */
  299. CURLE_READ_ERROR, /* 26 - couldn't 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_TIMEDOUT, /* 28 - the timeout time was reached */
  306. CURLE_OBSOLETE29, /* 29 - NOT USED */
  307. CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
  308. CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
  309. CURLE_OBSOLETE32, /* 32 - NOT USED */
  310. CURLE_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_OBSOLETE40, /* 40 - NOT USED */
  318. CURLE_FUNCTION_NOT_FOUND, /* 41 */
  319. CURLE_ABORTED_BY_CALLBACK, /* 42 */
  320. CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
  321. CURLE_OBSOLETE44, /* 44 - NOT USED */
  322. CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
  323. CURLE_OBSOLETE46, /* 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_OBSOLETE50, /* 50 - NOT USED */
  328. CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
  329. wasn't verified fine */
  330. CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
  331. CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
  332. CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
  333. default */
  334. CURLE_SEND_ERROR, /* 55 - failed sending network data */
  335. CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
  336. CURLE_OBSOLETE57, /* 57 - NOT IN USE */
  337. CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
  338. CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
  339. CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
  340. CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */
  341. CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
  342. CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
  343. CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
  344. CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
  345. that failed */
  346. CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
  347. CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
  348. accepted and we failed to login */
  349. CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */
  350. CURLE_TFTP_PERM, /* 69 - permission problem on server */
  351. CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */
  352. CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */
  353. CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */
  354. CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */
  355. CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */
  356. CURLE_CONV_FAILED, /* 75 - conversion failed */
  357. CURLE_CONV_REQD, /* 76 - caller must register conversion
  358. callbacks using curl_easy_setopt options
  359. CURLOPT_CONV_FROM_NETWORK_FUNCTION,
  360. CURLOPT_CONV_TO_NETWORK_FUNCTION, and
  361. CURLOPT_CONV_FROM_UTF8_FUNCTION */
  362. CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing
  363. or wrong format */
  364. CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */
  365. CURLE_SSH, /* 79 - error from the SSH layer, somewhat
  366. generic so the error message will be of
  367. interest when this has happened */
  368. CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL
  369. connection */
  370. CURLE_AGAIN, /* 81 - socket is not ready for send/recv,
  371. wait till it's ready and try again (Added
  372. in 7.18.2) */
  373. CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or
  374. wrong format (Added in 7.19.0) */
  375. CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in
  376. 7.19.0) */
  377. CURL_LAST /* never use! */
  378. } CURLcode;
  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. /* The following were added in 7.17.1 */
  383. /* These are scheduled to disappear by 2009 */
  384. #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION
  385. /* The following were added in 7.17.0 */
  386. /* These are scheduled to disappear by 2009 */
  387. #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* noone should be using this! */
  388. #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
  389. #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
  390. #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
  391. #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
  392. #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
  393. #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
  394. #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
  395. #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
  396. #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
  397. #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
  398. #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
  399. #define CURLE_URL_MALFORMAT_USER CURLE_OBSOLETE4
  400. #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
  401. #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
  402. #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
  403. #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
  404. #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
  405. #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
  406. #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
  407. /* The following were added earlier */
  408. #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT
  409. #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
  410. #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
  411. #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
  412. #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
  413. #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
  414. /* This was the error code 50 in 7.7.3 and a few earlier versions, this
  415. is no longer used by libcurl but is instead #defined here only to not
  416. make programs break */
  417. #define CURLE_ALREADY_COMPLETE 99999
  418. #endif /*!CURL_NO_OLDIES*/
  419. /* This prototype applies to all conversion callbacks */
  420. typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
  421. typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
  422. void *ssl_ctx, /* actually an
  423. OpenSSL SSL_CTX */
  424. void *userptr);
  425. typedef enum {
  426. CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use
  427. CONNECT HTTP/1.1 */
  428. CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT
  429. HTTP/1.0 */
  430. CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already
  431. in 7.10 */
  432. CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
  433. CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */
  434. CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the
  435. host name rather than the IP address. added
  436. in 7.18.0 */
  437. } curl_proxytype; /* this enum was added in 7.10 */
  438. #define CURLAUTH_NONE 0 /* nothing */
  439. #define CURLAUTH_BASIC (1<<0) /* Basic (default) */
  440. #define CURLAUTH_DIGEST (1<<1) /* Digest */
  441. #define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */
  442. #define CURLAUTH_NTLM (1<<3) /* NTLM */
  443. #define CURLAUTH_DIGEST_IE (1<<4) /* Digest with IE flavour */
  444. #define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) /* all fine types set */
  445. #define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
  446. #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */
  447. #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */
  448. #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
  449. #define CURLSSH_AUTH_PASSWORD (1<<1) /* password */
  450. #define CURLSSH_AUTH_HOST (1<<2) /* host key files */
  451. #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */
  452. #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
  453. #define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */
  454. #define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */
  455. #define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */
  456. #define CURL_ERROR_SIZE 256
  457. struct curl_khkey {
  458. const char *key; /* points to a zero-terminated string encoded with base64
  459. if len is zero, otherwise to the "raw" data */
  460. size_t len;
  461. enum type {
  462. CURLKHTYPE_UNKNOWN,
  463. CURLKHTYPE_RSA1,
  464. CURLKHTYPE_RSA,
  465. CURLKHTYPE_DSS
  466. } keytype;
  467. };
  468. /* this is the set of return values expected from the curl_sshkeycallback
  469. callback */
  470. enum curl_khstat {
  471. CURLKHSTAT_FINE_ADD_TO_FILE,
  472. CURLKHSTAT_FINE,
  473. CURLKHSTAT_REJECT, /* reject the connection, return an error */
  474. CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so
  475. this causes a CURLE_DEFER error but otherwise the
  476. connection will be left intact etc */
  477. CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */
  478. };
  479. /* this is the set of status codes pass in to the callback */
  480. enum curl_khmatch {
  481. CURLKHMATCH_OK, /* match */
  482. CURLKHMATCH_MISMATCH, /* host found, key mismatch! */
  483. CURLKHMATCH_MISSING, /* no matching host/key found */
  484. CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */
  485. };
  486. typedef int
  487. (*curl_sshkeycallback) (CURL *easy, /* easy handle */
  488. const struct curl_khkey *knownkey, /* known */
  489. const struct curl_khkey *foundkey, /* found */
  490. enum curl_khmatch, /* libcurl's view on the keys */
  491. void *clientp); /* custom pointer passed from app */
  492. /* parameter for the CURLOPT_USE_SSL option */
  493. typedef enum {
  494. CURLUSESSL_NONE, /* do not attempt to use SSL */
  495. CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */
  496. CURLUSESSL_CONTROL, /* SSL for the control connection or fail */
  497. CURLUSESSL_ALL, /* SSL for all communication or fail */
  498. CURLUSESSL_LAST /* not an option, never use */
  499. } curl_usessl;
  500. #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
  501. the obsolete stuff removed! */
  502. /* Backwards compatibility with older names */
  503. /* These are scheduled to disappear by 2009 */
  504. #define CURLFTPSSL_NONE CURLUSESSL_NONE
  505. #define CURLFTPSSL_TRY CURLUSESSL_TRY
  506. #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
  507. #define CURLFTPSSL_ALL CURLUSESSL_ALL
  508. #define CURLFTPSSL_LAST CURLUSESSL_LAST
  509. #define curl_ftpssl curl_usessl
  510. #endif /*!CURL_NO_OLDIES*/
  511. /* parameter for the CURLOPT_FTP_SSL_CCC option */
  512. typedef enum {
  513. CURLFTPSSL_CCC_NONE, /* do not send CCC */
  514. CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
  515. CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */
  516. CURLFTPSSL_CCC_LAST /* not an option, never use */
  517. } curl_ftpccc;
  518. /* parameter for the CURLOPT_FTPSSLAUTH option */
  519. typedef enum {
  520. CURLFTPAUTH_DEFAULT, /* let libcurl decide */
  521. CURLFTPAUTH_SSL, /* use "AUTH SSL" */
  522. CURLFTPAUTH_TLS, /* use "AUTH TLS" */
  523. CURLFTPAUTH_LAST /* not an option, never use */
  524. } curl_ftpauth;
  525. /* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
  526. typedef enum {
  527. CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */
  528. CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD
  529. again if MKD succeeded, for SFTP this does
  530. similar magic */
  531. CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
  532. again even if MKD failed! */
  533. CURLFTP_CREATE_DIR_LAST /* not an option, never use */
  534. } curl_ftpcreatedir;
  535. /* parameter for the CURLOPT_FTP_FILEMETHOD option */
  536. typedef enum {
  537. CURLFTPMETHOD_DEFAULT, /* let libcurl pick */
  538. CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */
  539. CURLFTPMETHOD_NOCWD, /* no CWD at all */
  540. CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
  541. CURLFTPMETHOD_LAST /* not an option, never use */
  542. } curl_ftpmethod;
  543. /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
  544. #define CURLPROTO_HTTP (1<<0)
  545. #define CURLPROTO_HTTPS (1<<1)
  546. #define CURLPROTO_FTP (1<<2)
  547. #define CURLPROTO_FTPS (1<<3)
  548. #define CURLPROTO_SCP (1<<4)
  549. #define CURLPROTO_SFTP (1<<5)
  550. #define CURLPROTO_TELNET (1<<6)
  551. #define CURLPROTO_LDAP (1<<7)
  552. #define CURLPROTO_LDAPS (1<<8)
  553. #define CURLPROTO_DICT (1<<9)
  554. #define CURLPROTO_FILE (1<<10)
  555. #define CURLPROTO_TFTP (1<<11)
  556. #define CURLPROTO_ALL (~0) /* enable everything */
  557. /* long may be 32 or 64 bits, but we should never depend on anything else
  558. but 32 */
  559. #define CURLOPTTYPE_LONG 0
  560. #define CURLOPTTYPE_OBJECTPOINT 10000
  561. #define CURLOPTTYPE_FUNCTIONPOINT 20000
  562. #define CURLOPTTYPE_OFF_T 30000
  563. /* name is uppercase CURLOPT_<name>,
  564. type is one of the defined CURLOPTTYPE_<type>
  565. number is unique identifier */
  566. #ifdef CINIT
  567. #undef CINIT
  568. #endif
  569. #ifdef CURL_ISOCPP
  570. #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
  571. #else
  572. /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
  573. #define LONG CURLOPTTYPE_LONG
  574. #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
  575. #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
  576. #define OFF_T CURLOPTTYPE_OFF_T
  577. #define CINIT(name,type,number) CURLOPT_/**/name = type + number
  578. #endif
  579. /*
  580. * This macro-mania below setups the CURLOPT_[what] enum, to be used with
  581. * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
  582. * word.
  583. */
  584. typedef enum {
  585. /* This is the FILE * or void * the regular output should be written to. */
  586. CINIT(FILE, OBJECTPOINT, 1),
  587. /* The full URL to get/put */
  588. CINIT(URL, OBJECTPOINT, 2),
  589. /* Port number to connect to, if other than default. */
  590. CINIT(PORT, LONG, 3),
  591. /* Name of proxy to use. */
  592. CINIT(PROXY, OBJECTPOINT, 4),
  593. /* "name:password" to use when fetching. */
  594. CINIT(USERPWD, OBJECTPOINT, 5),
  595. /* "name:password" to use with proxy. */
  596. CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
  597. /* Range to get, specified as an ASCII string. */
  598. CINIT(RANGE, OBJECTPOINT, 7),
  599. /* not used */
  600. /* Specified file stream to upload from (use as input): */
  601. CINIT(INFILE, OBJECTPOINT, 9),
  602. /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
  603. * bytes big. If this is not used, error messages go to stderr instead: */
  604. CINIT(ERRORBUFFER, OBJECTPOINT, 10),
  605. /* Function that will be called to store the output (instead of fwrite). The
  606. * parameters will use fwrite() syntax, make sure to follow them. */
  607. CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
  608. /* Function that will be called to read the input (instead of fread). The
  609. * parameters will use fread() syntax, make sure to follow them. */
  610. CINIT(READFUNCTION, FUNCTIONPOINT, 12),
  611. /* Time-out the read operation after this amount of seconds */
  612. CINIT(TIMEOUT, LONG, 13),
  613. /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
  614. * how large the file being sent really is. That allows better error
  615. * checking and better verifies that the upload was successful. -1 means
  616. * unknown size.
  617. *
  618. * For large file support, there is also a _LARGE version of the key
  619. * which takes an off_t type, allowing platforms with larger off_t
  620. * sizes to handle larger files. See below for INFILESIZE_LARGE.
  621. */
  622. CINIT(INFILESIZE, LONG, 14),
  623. /* POST static input fields. */
  624. CINIT(POSTFIELDS, OBJECTPOINT, 15),
  625. /* Set the referrer page (needed by some CGIs) */
  626. CINIT(REFERER, OBJECTPOINT, 16),
  627. /* Set the FTP PORT string (interface name, named or numerical IP address)
  628. Use i.e '-' to use default address. */
  629. CINIT(FTPPORT, OBJECTPOINT, 17),
  630. /* Set the User-Agent string (examined by some CGIs) */
  631. CINIT(USERAGENT, OBJECTPOINT, 18),
  632. /* If the download receives less than "low speed limit" bytes/second
  633. * during "low speed time" seconds, the operations is aborted.
  634. * You could i.e if you have a pretty high speed connection, abort if
  635. * it is less than 2000 bytes/sec during 20 seconds.
  636. */
  637. /* Set the "low speed limit" */
  638. CINIT(LOW_SPEED_LIMIT, LONG, 19),
  639. /* Set the "low speed time" */
  640. CINIT(LOW_SPEED_TIME, LONG, 20),
  641. /* Set the continuation offset.
  642. *
  643. * Note there is also a _LARGE version of this key which uses
  644. * off_t types, allowing for large file offsets on platforms which
  645. * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
  646. */
  647. CINIT(RESUME_FROM, LONG, 21),
  648. /* Set cookie in request: */
  649. CINIT(COOKIE, OBJECTPOINT, 22),
  650. /* This points to a linked list of headers, struct curl_slist kind */
  651. CINIT(HTTPHEADER, OBJECTPOINT, 23),
  652. /* This points to a linked list of post entries, struct curl_httppost */
  653. CINIT(HTTPPOST, OBJECTPOINT, 24),
  654. /* name of the file keeping your private SSL-certificate */
  655. CINIT(SSLCERT, OBJECTPOINT, 25),
  656. /* password for the SSL or SSH private key */
  657. CINIT(KEYPASSWD, OBJECTPOINT, 26),
  658. /* send TYPE parameter? */
  659. CINIT(CRLF, LONG, 27),
  660. /* send linked-list of QUOTE commands */
  661. CINIT(QUOTE, OBJECTPOINT, 28),
  662. /* send FILE * or void * to store headers to, if you use a callback it
  663. is simply passed to the callback unmodified */
  664. CINIT(WRITEHEADER, OBJECTPOINT, 29),
  665. /* point to a file to read the initial cookies from, also enables
  666. "cookie awareness" */
  667. CINIT(COOKIEFILE, OBJECTPOINT, 31),
  668. /* What version to specifically try to use.
  669. See CURL_SSLVERSION defines below. */
  670. CINIT(SSLVERSION, LONG, 32),
  671. /* What kind of HTTP time condition to use, see defines */
  672. CINIT(TIMECONDITION, LONG, 33),
  673. /* Time to use with the above condition. Specified in number of seconds
  674. since 1 Jan 1970 */
  675. CINIT(TIMEVALUE, LONG, 34),
  676. /* 35 = OBSOLETE */
  677. /* Custom request, for customizing the get command like
  678. HTTP: DELETE, TRACE and others
  679. FTP: to use a different list command
  680. */
  681. CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
  682. /* HTTP request, for odd commands like DELETE, TRACE and others */
  683. CINIT(STDERR, OBJECTPOINT, 37),
  684. /* 38 is not used */
  685. /* send linked-list of post-transfer QUOTE commands */
  686. CINIT(POSTQUOTE, OBJECTPOINT, 39),
  687. /* Pass a pointer to string of the output using full variable-replacement
  688. as described elsewhere. */
  689. CINIT(WRITEINFO, OBJECTPOINT, 40),
  690. CINIT(VERBOSE, LONG, 41), /* talk a lot */
  691. CINIT(HEADER, LONG, 42), /* throw the header out too */
  692. CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */
  693. CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */
  694. CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */
  695. CINIT(UPLOAD, LONG, 46), /* this is an upload */
  696. CINIT(POST, LONG, 47), /* HTTP POST method */
  697. CINIT(DIRLISTONLY, LONG, 48), /* return bare names when listing directories */
  698. CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */
  699. /* Specify whether to read the user+password from the .netrc or the URL.
  700. * This must be one of the CURL_NETRC_* enums below. */
  701. CINIT(NETRC, LONG, 51),
  702. CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
  703. CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
  704. CINIT(PUT, LONG, 54), /* HTTP PUT */
  705. /* 55 = OBSOLETE */
  706. /* Function that will be called instead of the internal progress display
  707. * function. This function should be defined as the curl_progress_callback
  708. * prototype defines. */
  709. CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
  710. /* Data passed to the progress callback */
  711. CINIT(PROGRESSDATA, OBJECTPOINT, 57),
  712. /* We want the referrer field set automatically when following locations */
  713. CINIT(AUTOREFERER, LONG, 58),
  714. /* Port of the proxy, can be set in the proxy string as well with:
  715. "[host]:[port]" */
  716. CINIT(PROXYPORT, LONG, 59),
  717. /* size of the POST input data, if strlen() is not good to use */
  718. CINIT(POSTFIELDSIZE, LONG, 60),
  719. /* tunnel non-http operations through a HTTP proxy */
  720. CINIT(HTTPPROXYTUNNEL, LONG, 61),
  721. /* Set the interface string to use as outgoing network interface */
  722. CINIT(INTERFACE, OBJECTPOINT, 62),
  723. /* Set the krb4/5 security level, this also enables krb4/5 awareness. This
  724. * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
  725. * is set but doesn't match one of these, 'private' will be used. */
  726. CINIT(KRBLEVEL, OBJECTPOINT, 63),
  727. /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
  728. CINIT(SSL_VERIFYPEER, LONG, 64),
  729. /* The CApath or CAfile used to validate the peer certificate
  730. this option is used only if SSL_VERIFYPEER is true */
  731. CINIT(CAINFO, OBJECTPOINT, 65),
  732. /* 66 = OBSOLETE */
  733. /* 67 = OBSOLETE */
  734. /* Maximum number of http redirects to follow */
  735. CINIT(MAXREDIRS, LONG, 68),
  736. /* Pass a long set to 1 to get the date of the requested document (if
  737. possible)! Pass a zero to shut it off. */
  738. CINIT(FILETIME, LONG, 69),
  739. /* This points to a linked list of telnet options */
  740. CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
  741. /* Max amount of cached alive connections */
  742. CINIT(MAXCONNECTS, LONG, 71),
  743. /* What policy to use when closing connections when the cache is filled
  744. up */
  745. CINIT(CLOSEPOLICY, LONG, 72),
  746. /* 73 = OBSOLETE */
  747. /* Set to explicitly use a new connection for the upcoming transfer.
  748. Do not use this unless you're absolutely sure of this, as it makes the
  749. operation slower and is less friendly for the network. */
  750. CINIT(FRESH_CONNECT, LONG, 74),
  751. /* Set to explicitly forbid the upcoming transfer's connection to be re-used
  752. when done. Do not use this unless you're absolutely sure of this, as it
  753. makes the operation slower and is less friendly for the network. */
  754. CINIT(FORBID_REUSE, LONG, 75),
  755. /* Set to a file name that contains random data for libcurl to use to
  756. seed the random engine when doing SSL connects. */
  757. CINIT(RANDOM_FILE, OBJECTPOINT, 76),
  758. /* Set to the Entropy Gathering Daemon socket pathname */
  759. CINIT(EGDSOCKET, OBJECTPOINT, 77),
  760. /* Time-out connect operations after this amount of seconds, if connects
  761. are OK within this time, then fine... This only aborts the connect
  762. phase. [Only works on unix-style/SIGALRM operating systems] */
  763. CINIT(CONNECTTIMEOUT, LONG, 78),
  764. /* Function that will be called to store headers (instead of fwrite). The
  765. * parameters will use fwrite() syntax, make sure to follow them. */
  766. CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
  767. /* Set this to force the HTTP request to get back to GET. Only really usable
  768. if POST, PUT or a custom request have been used first.
  769. */
  770. CINIT(HTTPGET, LONG, 80),
  771. /* Set if we should verify the Common name from the peer certificate in ssl
  772. * handshake, set 1 to check existence, 2 to ensure that it matches the
  773. * provided hostname. */
  774. CINIT(SSL_VERIFYHOST, LONG, 81),
  775. /* Specify which file name to write all known cookies in after completed
  776. operation. Set file name to "-" (dash) to make it go to stdout. */
  777. CINIT(COOKIEJAR, OBJECTPOINT, 82),
  778. /* Specify which SSL ciphers to use */
  779. CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),
  780. /* Specify which HTTP version to use! This must be set to one of the
  781. CURL_HTTP_VERSION* enums set below. */
  782. CINIT(HTTP_VERSION, LONG, 84),
  783. /* Specifically switch on or off the FTP engine's use of the EPSV command. By
  784. default, that one will always be attempted before the more traditional
  785. PASV command. */
  786. CINIT(FTP_USE_EPSV, LONG, 85),
  787. /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
  788. CINIT(SSLCERTTYPE, OBJECTPOINT, 86),
  789. /* name of the file keeping your private SSL-key */
  790. CINIT(SSLKEY, OBJECTPOINT, 87),
  791. /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
  792. CINIT(SSLKEYTYPE, OBJECTPOINT, 88),
  793. /* crypto engine for the SSL-sub system */
  794. CINIT(SSLENGINE, OBJECTPOINT, 89),
  795. /* set the crypto engine for the SSL-sub system as default
  796. the param has no meaning...
  797. */
  798. CINIT(SSLENGINE_DEFAULT, LONG, 90),
  799. /* Non-zero value means to use the global dns cache */
  800. CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */
  801. /* DNS cache timeout */
  802. CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
  803. /* send linked-list of pre-transfer QUOTE commands */
  804. CINIT(PREQUOTE, OBJECTPOINT, 93),
  805. /* set the debug function */
  806. CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
  807. /* set the data for the debug function */
  808. CINIT(DEBUGDATA, OBJECTPOINT, 95),
  809. /* mark this as start of a cookie session */
  810. CINIT(COOKIESESSION, LONG, 96),
  811. /* The CApath directory used to validate the peer certificate
  812. this option is used only if SSL_VERIFYPEER is true */
  813. CINIT(CAPATH, OBJECTPOINT, 97),
  814. /* Instruct libcurl to use a smaller receive buffer */
  815. CINIT(BUFFERSIZE, LONG, 98),
  816. /* Instruct libcurl to not use any signal/alarm handlers, even when using
  817. timeouts. This option is useful for multi-threaded applications.
  818. See libcurl-the-guide for more background information. */
  819. CINIT(NOSIGNAL, LONG, 99),
  820. /* Provide a CURLShare for mutexing non-ts data */
  821. CINIT(SHARE, OBJECTPOINT, 100),
  822. /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
  823. CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
  824. CINIT(PROXYTYPE, LONG, 101),
  825. /* Set the Accept-Encoding string. Use this to tell a server you would like
  826. the response to be compressed. */
  827. CINIT(ENCODING, OBJECTPOINT, 102),
  828. /* Set pointer to private data */
  829. CINIT(PRIVATE, OBJECTPOINT, 103),
  830. /* Set aliases for HTTP 200 in the HTTP Response header */
  831. CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
  832. /* Continue to send authentication (user+password) when following locations,
  833. even when hostname changed. This can potentially send off the name
  834. and password to whatever host the server decides. */
  835. CINIT(UNRESTRICTED_AUTH, LONG, 105),
  836. /* Specifically switch on or off the FTP engine's use of the EPRT command ( it
  837. also disables the LPRT attempt). By default, those ones will always be
  838. attempted before the good old traditional PORT command. */
  839. CINIT(FTP_USE_EPRT, LONG, 106),
  840. /* Set this to a bitmask value to enable the particular authentications
  841. methods you like. Use this in combination with CURLOPT_USERPWD.
  842. Note that setting multiple bits may cause extra network round-trips. */
  843. CINIT(HTTPAUTH, LONG, 107),
  844. /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
  845. in second argument. The function must be matching the
  846. curl_ssl_ctx_callback proto. */
  847. CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
  848. /* Set the userdata for the ssl context callback function's third
  849. argument */
  850. CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
  851. /* FTP Option that causes missing dirs to be created on the remote server.
  852. In 7.19.4 we introduced the convenience enums for this option using the
  853. CURLFTP_CREATE_DIR prefix.
  854. */
  855. CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
  856. /* Set this to a bitmask value to enable the particular authentications
  857. methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
  858. Note that setting multiple bits may cause extra network round-trips. */
  859. CINIT(PROXYAUTH, LONG, 111),
  860. /* FTP option that changes the timeout, in seconds, associated with
  861. getting a response. This is different from transfer timeout time and
  862. essentially places a demand on the FTP server to acknowledge commands
  863. in a timely manner. */
  864. CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
  865. /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
  866. tell libcurl to resolve names to those IP versions only. This only has
  867. affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
  868. CINIT(IPRESOLVE, LONG, 113),
  869. /* Set this option to limit the size of a file that will be downloaded from
  870. an HTTP or FTP server.
  871. Note there is also _LARGE version which adds large file support for
  872. platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
  873. CINIT(MAXFILESIZE, LONG, 114),
  874. /* See the comment for INFILESIZE above, but in short, specifies
  875. * the size of the file being uploaded. -1 means unknown.
  876. */
  877. CINIT(INFILESIZE_LARGE, OFF_T, 115),
  878. /* Sets the continuation offset. There is also a LONG version of this;
  879. * look above for RESUME_FROM.
  880. */
  881. CINIT(RESUME_FROM_LARGE, OFF_T, 116),
  882. /* Sets the maximum size of data that will be downloaded from
  883. * an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
  884. */
  885. CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
  886. /* Set this option to the file name of your .netrc file you want libcurl
  887. to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
  888. a poor attempt to find the user's home directory and check for a .netrc
  889. file in there. */
  890. CINIT(NETRC_FILE, OBJECTPOINT, 118),
  891. /* Enable SSL/TLS for FTP, pick one of:
  892. CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise
  893. CURLFTPSSL_CONTROL - SSL for the control connection or fail
  894. CURLFTPSSL_ALL - SSL for all communication or fail
  895. */
  896. CINIT(USE_SSL, LONG, 119),
  897. /* The _LARGE version of the standard POSTFIELDSIZE option */
  898. CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
  899. /* Enable/disable the TCP Nagle algorithm */
  900. CINIT(TCP_NODELAY, LONG, 121),
  901. /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
  902. /* 123 OBSOLETE. Gone in 7.16.0 */
  903. /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
  904. /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
  905. /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
  906. /* 127 OBSOLETE. Gone in 7.16.0 */
  907. /* 128 OBSOLETE. Gone in 7.16.0 */
  908. /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
  909. can be used to change libcurl's default action which is to first try
  910. "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
  911. response has been received.
  912. Available parameters are:
  913. CURLFTPAUTH_DEFAULT - let libcurl decide
  914. CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
  915. CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
  916. */
  917. CINIT(FTPSSLAUTH, LONG, 129),
  918. CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
  919. CINIT(IOCTLDATA, OBJECTPOINT, 131),
  920. /* 132 OBSOLETE. Gone in 7.16.0 */
  921. /* 133 OBSOLETE. Gone in 7.16.0 */
  922. /* zero terminated string for pass on to the FTP server when asked for
  923. "account" info */
  924. CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
  925. /* feed cookies into cookie engine */
  926. CINIT(COOKIELIST, OBJECTPOINT, 135),
  927. /* ignore Content-Length */
  928. CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
  929. /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
  930. response. Typically used for FTP-SSL purposes but is not restricted to
  931. that. libcurl will then instead use the same IP address it used for the
  932. control connection. */
  933. CINIT(FTP_SKIP_PASV_IP, LONG, 137),
  934. /* Select "file method" to use when doing FTP, see the curl_ftpmethod
  935. above. */
  936. CINIT(FTP_FILEMETHOD, LONG, 138),
  937. /* Local port number to bind the socket to */
  938. CINIT(LOCALPORT, LONG, 139),
  939. /* Number of ports to try, including the first one set with LOCALPORT.
  940. Thus, setting it to 1 will make no additional attempts but the first.
  941. */
  942. CINIT(LOCALPORTRANGE, LONG, 140),
  943. /* no transfer, set up connection and let application use the socket by
  944. extracting it with CURLINFO_LASTSOCKET */
  945. CINIT(CONNECT_ONLY, LONG, 141),
  946. /* Function that will be called to convert from the
  947. network encoding (instead of using the iconv calls in libcurl) */
  948. CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),
  949. /* Function that will be called to convert to the
  950. network encoding (instead of using the iconv calls in libcurl) */
  951. CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),
  952. /* Function that will be called to convert from UTF8
  953. (instead of using the iconv calls in libcurl)
  954. Note that this is used only for SSL certificate processing */
  955. CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
  956. /* if the connection proceeds too quickly then need to slow it down */
  957. /* limit-rate: maximum number of bytes per second to send or receive */
  958. CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
  959. CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
  960. /* Pointer to command string to send if USER/PASS fails. */
  961. CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),
  962. /* callback function for setting socket options */
  963. CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
  964. CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
  965. /* set to 0 to disable session ID re-use for this transfer, default is
  966. enabled (== 1) */
  967. CINIT(SSL_SESSIONID_CACHE, LONG, 150),
  968. /* allowed SSH authentication methods */
  969. CINIT(SSH_AUTH_TYPES, LONG, 151),
  970. /* Used by scp/sftp to do public/private key authentication */
  971. CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),
  972. CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),
  973. /* Send CCC (Clear Command Channel) after authentication */
  974. CINIT(FTP_SSL_CCC, LONG, 154),
  975. /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
  976. CINIT(TIMEOUT_MS, LONG, 155),
  977. CINIT(CONNECTTIMEOUT_MS, LONG, 156),
  978. /* set to zero to disable the libcurl's decoding and thus pass the raw body
  979. data to the application even when it is encoded/compressed */
  980. CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
  981. CINIT(HTTP_CONTENT_DECODING, LONG, 158),
  982. /* Permission used when creating new files and directories on the remote
  983. server for protocols that support it, SFTP/SCP/FILE */
  984. CINIT(NEW_FILE_PERMS, LONG, 159),
  985. CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
  986. /* Set the behaviour of POST when redirecting. Values must be set to one
  987. of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
  988. CINIT(POSTREDIR, LONG, 161),
  989. /* used by scp/sftp to verify the host's public key */
  990. CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),
  991. /* Callback function for opening socket (instead of socket(2)). Optionally,
  992. callback is able change the address or refuse to connect returning
  993. CURL_SOCKET_BAD. The callback should have type
  994. curl_opensocket_callback */
  995. CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
  996. CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
  997. /* POST volatile input fields. */
  998. CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),
  999. /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
  1000. CINIT(PROXY_TRANSFER_MODE, LONG, 166),
  1001. /* Callback function for seeking in the input stream */
  1002. CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
  1003. CINIT(SEEKDATA, OBJECTPOINT, 168),
  1004. /* CRL file */
  1005. CINIT(CRLFILE, OBJECTPOINT, 169),
  1006. /* Issuer certificate */
  1007. CINIT(ISSUERCERT, OBJECTPOINT, 170),
  1008. /* (IPv6) Address scope */
  1009. CINIT(ADDRESS_SCOPE, LONG, 171),
  1010. /* Collect certificate chain info and allow it to get retrievable with
  1011. CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only
  1012. working with OpenSSL-powered builds. */
  1013. CINIT(CERTINFO, LONG, 172),
  1014. /* "name" and "pwd" to use when fetching. */
  1015. CINIT(USERNAME, OBJECTPOINT, 173),
  1016. CINIT(PASSWORD, OBJECTPOINT, 174),
  1017. /* "name" and "pwd" to use with Proxy when fetching. */
  1018. CINIT(PROXYUSERNAME, OBJECTPOINT, 175),
  1019. CINIT(PROXYPASSWORD, OBJECTPOINT, 176),
  1020. /* Comma separated list of hostnames defining no-proxy zones. These should
  1021. match both hostnames directly, and hostnames within a domain. For
  1022. example, local.com will match local.com and www.local.com, but NOT
  1023. notlocal.com or www.notlocal.com. For compatibility with other
  1024. implementations of this, .local.com will be considered to be the same as
  1025. local.com. A single * is the only valid wildcard, and effectively
  1026. disables the use of proxy. */
  1027. CINIT(NOPROXY, OBJECTPOINT, 177),
  1028. /* block size for TFTP transfers */
  1029. CINIT(TFTP_BLKSIZE, LONG, 178),
  1030. /* Socks Service */
  1031. CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),
  1032. /* Socks Service */
  1033. CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
  1034. /* set the bitmask for the protocols that are allowed to be used for the
  1035. transfer, which thus helps the app which takes URLs from users or other
  1036. external inputs and want to restrict what protocol(s) to deal
  1037. with. Defaults to CURLPROTO_ALL. */
  1038. CINIT(PROTOCOLS, LONG, 181),
  1039. /* set the bitmask for the protocols that libcurl is allowed to follow to,
  1040. as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
  1041. to be set in both bitmasks to be allowed to get redirected to. Defaults
  1042. to all protocols except FILE and SCP. */
  1043. CINIT(REDIR_PROTOCOLS, LONG, 182),
  1044. /* set the SSH knownhost file name to use */
  1045. CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),
  1046. /* set the SSH host key callback, must point to a curl_sshkeycallback
  1047. function */
  1048. CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),
  1049. /* set the SSH host key callback custom pointer */
  1050. CINIT(SSH_KEYDATA, OBJECTPOINT, 185),
  1051. /* allow GSSAPI credential delegation */
  1052. CINIT(GSSAPI_DELEGATION, LONG, 210),
  1053. CURLOPT_LASTENTRY /* the last unused */
  1054. } CURLoption;
  1055. #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
  1056. the obsolete stuff removed! */
  1057. /* Backwards compatibility with older names */
  1058. /* These are scheduled to disappear by 2011 */
  1059. /* This was added in version 7.19.1 */
  1060. #define CURLOPT_POST301 CURLOPT_POSTREDIR
  1061. /* These are scheduled to disappear by 2009 */
  1062. /* The following were added in 7.17.0 */
  1063. #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
  1064. #define CURLOPT_FTPAPPEND CURLOPT_APPEND
  1065. #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
  1066. #define CURLOPT_FTP_SSL CURLOPT_USE_SSL
  1067. /* The following were added earlier */
  1068. #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
  1069. #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
  1070. #else
  1071. /* This is set if CURL_NO_OLDIES is defined at compile-time */
  1072. #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
  1073. #endif
  1074. /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
  1075. name resolves addresses using more than one IP protocol version, this
  1076. option might be handy to force libcurl to use a specific IP version. */
  1077. #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
  1078. versions that your system allows */
  1079. #define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */
  1080. #define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */
  1081. /* three convenient "aliases" that follow the name scheme better */
  1082. #define CURLOPT_WRITEDATA CURLOPT_FILE
  1083. #define CURLOPT_READDATA CURLOPT_INFILE
  1084. #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
  1085. /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
  1086. enum {
  1087. CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
  1088. like the library to choose the best possible
  1089. for us! */
  1090. CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */
  1091. CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */
  1092. CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
  1093. };
  1094. /* These enums are for use with the CURLOPT_NETRC option. */
  1095. enum CURL_NETRC_OPTION {
  1096. CURL_NETRC_IGNORED, /* The .netrc will never be read.
  1097. * This is the default. */
  1098. CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred
  1099. * to one in the .netrc. */
  1100. CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored.
  1101. * Unless one is set programmatically, the .netrc
  1102. * will be queried. */
  1103. CURL_NETRC_LAST
  1104. };
  1105. enum {
  1106. CURL_SSLVERSION_DEFAULT,
  1107. CURL_SSLVERSION_TLSv1, /* TLS 1.x */
  1108. CURL_SSLVERSION_SSLv2,
  1109. CURL_SSLVERSION_SSLv3,
  1110. CURL_SSLVERSION_TLSv1_0,
  1111. CURL_SSLVERSION_TLSv1_1,
  1112. CURL_SSLVERSION_TLSv1_2,
  1113. CURL_SSLVERSION_LAST /* never use, keep last */
  1114. };
  1115. /* symbols to use with CURLOPT_POSTREDIR.
  1116. CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that
  1117. CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */
  1118. #define CURL_REDIR_GET_ALL 0
  1119. #define CURL_REDIR_POST_301 1
  1120. #define CURL_REDIR_POST_302 2
  1121. #define CURL_REDIR_POST_ALL (CURL_REDIR_POST_301|CURL_REDIR_POST_302)
  1122. typedef enum {
  1123. CURL_TIMECOND_NONE,
  1124. CURL_TIMECOND_IFMODSINCE,
  1125. CURL_TIMECOND_IFUNMODSINCE,
  1126. CURL_TIMECOND_LASTMOD,
  1127. CURL_TIMECOND_LAST
  1128. } curl_TimeCond;
  1129. /* curl_strequal() and curl_strnequal() are subject for removal in a future
  1130. libcurl, see lib/README.curlx for details */
  1131. CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
  1132. CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
  1133. /* name is uppercase CURLFORM_<name> */
  1134. #ifdef CFINIT
  1135. #undef CFINIT
  1136. #endif
  1137. #ifdef CURL_ISOCPP
  1138. #define CFINIT(name) CURLFORM_ ## name
  1139. #else
  1140. /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
  1141. #define CFINIT(name) CURLFORM_/**/name
  1142. #endif
  1143. typedef enum {
  1144. CFINIT(NOTHING), /********* the first one is unused ************/
  1145. /* */
  1146. CFINIT(COPYNAME),
  1147. CFINIT(PTRNAME),
  1148. CFINIT(NAMELENGTH),
  1149. CFINIT(COPYCONTENTS),
  1150. CFINIT(PTRCONTENTS),
  1151. CFINIT(CONTENTSLENGTH),
  1152. CFINIT(FILECONTENT),
  1153. CFINIT(ARRAY),
  1154. CFINIT(OBSOLETE),
  1155. CFINIT(FILE),
  1156. CFINIT(BUFFER),
  1157. CFINIT(BUFFERPTR),
  1158. CFINIT(BUFFERLENGTH),
  1159. CFINIT(CONTENTTYPE),
  1160. CFINIT(CONTENTHEADER),
  1161. CFINIT(FILENAME),
  1162. CFINIT(END),
  1163. CFINIT(OBSOLETE2),
  1164. CFINIT(STREAM),
  1165. CURLFORM_LASTENTRY /* the last unused */
  1166. } CURLformoption;
  1167. #undef CFINIT /* done */
  1168. /* structure to be used as parameter for CURLFORM_ARRAY */
  1169. struct curl_forms {
  1170. CURLformoption option;
  1171. const char *value;
  1172. };
  1173. /* use this for multipart formpost building */
  1174. /* Returns code for curl_formadd()
  1175. *
  1176. * Returns:
  1177. * CURL_FORMADD_OK on success
  1178. * CURL_FORMADD_MEMORY if the FormInfo allocation fails
  1179. * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
  1180. * CURL_FORMADD_NULL if a null pointer was given for a char
  1181. * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
  1182. * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
  1183. * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
  1184. * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated
  1185. * CURL_FORMADD_MEMORY if some allocation for string copying failed.
  1186. * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
  1187. *
  1188. ***************************************************************************/
  1189. typedef enum {
  1190. CURL_FORMADD_OK, /* first, no error */
  1191. CURL_FORMADD_MEMORY,
  1192. CURL_FORMADD_OPTION_TWICE,
  1193. CURL_FORMADD_NULL,
  1194. CURL_FORMADD_UNKNOWN_OPTION,
  1195. CURL_FORMADD_INCOMPLETE,
  1196. CURL_FORMADD_ILLEGAL_ARRAY,
  1197. CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
  1198. CURL_FORMADD_LAST /* last */
  1199. } CURLFORMcode;
  1200. /*
  1201. * NAME curl_formadd()
  1202. *
  1203. * DESCRIPTION
  1204. *
  1205. * Pretty advanced function for building multi-part formposts. Each invoke
  1206. * adds one part that together construct a full post. Then use
  1207. * CURLOPT_HTTPPOST to send it off to libcurl.
  1208. */
  1209. CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
  1210. struct curl_httppost **last_post,
  1211. ...);
  1212. /*
  1213. * callback function for curl_formget()
  1214. * The void *arg pointer will be the one passed as second argument to
  1215. * curl_formget().
  1216. * The character buffer passed to it must not be freed.
  1217. * Should return the buffer length passed to it as the argument "len" on
  1218. * success.
  1219. */
  1220. typedef size_t (*curl_formget_callback)(void *arg, const char *buf, size_t len);
  1221. /*
  1222. * NAME curl_formget()
  1223. *
  1224. * DESCRIPTION
  1225. *
  1226. * Serialize a curl_httppost struct built with curl_formadd().
  1227. * Accepts a void pointer as second argument which will be passed to
  1228. * the curl_formget_callback function.
  1229. * Returns 0 on success.
  1230. */
  1231. CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
  1232. curl_formget_callback append);
  1233. /*
  1234. * NAME curl_formfree()
  1235. *
  1236. * DESCRIPTION
  1237. *
  1238. * Free a multipart formpost previously built with curl_formadd().
  1239. */
  1240. CURL_EXTERN void curl_formfree(struct curl_httppost *form);
  1241. /*
  1242. * NAME curl_getenv()
  1243. *
  1244. * DESCRIPTION
  1245. *
  1246. * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
  1247. * complete. DEPRECATED - see lib/README.curlx
  1248. */
  1249. CURL_EXTERN char *curl_getenv(const char *variable);
  1250. /*
  1251. * NAME curl_version()
  1252. *
  1253. * DESCRIPTION
  1254. *
  1255. * Returns a static ascii string of the libcurl version.
  1256. */
  1257. CURL_EXTERN char *curl_version(void);
  1258. /*
  1259. * NAME curl_easy_escape()
  1260. *
  1261. * DESCRIPTION
  1262. *
  1263. * Escapes URL strings (converts all letters consider illegal in URLs to their
  1264. * %XX versions). This function returns a new allocated string or NULL if an
  1265. * error occurred.
  1266. */
  1267. CURL_EXTERN char *curl_easy_escape(CURL *handle,
  1268. const char *string,
  1269. int length);
  1270. /* the previous version: */
  1271. CURL_EXTERN char *curl_escape(const char *string,
  1272. int length);
  1273. /*
  1274. * NAME curl_easy_unescape()
  1275. *
  1276. * DESCRIPTION
  1277. *
  1278. * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
  1279. * versions). This function returns a new allocated string or NULL if an error
  1280. * occurred.
  1281. * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
  1282. * converted into the host encoding.
  1283. */
  1284. CURL_EXTERN char *curl_easy_unescape(CURL *handle,
  1285. const char *string,
  1286. int length,
  1287. int *outlength);
  1288. /* the previous version */
  1289. CURL_EXTERN char *curl_unescape(const char *string,
  1290. int length);
  1291. /*
  1292. * NAME curl_free()
  1293. *
  1294. * DESCRIPTION
  1295. *
  1296. * Provided for de-allocation in the same translation unit that did the
  1297. * allocation. Added in libcurl 7.10
  1298. */
  1299. CURL_EXTERN void curl_free(void *p);
  1300. /*
  1301. * NAME curl_global_init()
  1302. *
  1303. * DESCRIPTION
  1304. *
  1305. * curl_global_init() should be invoked exactly once for each application that
  1306. * uses libcurl and before any call of other libcurl functions.
  1307. *
  1308. * This function is not thread-safe!
  1309. */
  1310. CURL_EXTERN CURLcode curl_global_init(long flags);
  1311. /*
  1312. * NAME curl_global_init_mem()
  1313. *
  1314. * DESCRIPTION
  1315. *
  1316. * curl_global_init() or curl_global_init_mem() should be invoked exactly once
  1317. * for each application that uses libcurl. This function can be used to
  1318. * initialize libcurl and set user defined memory management callback
  1319. * functions. Users can implement memory management routines to check for
  1320. * memory leaks, check for mis-use of the curl library etc. User registered
  1321. * callback routines with be invoked by this library instead of the system
  1322. * memory management routines like malloc, free etc.
  1323. */
  1324. CURL_EXTERN CURLcode curl_global_init_mem(long flags,
  1325. curl_malloc_callback m,
  1326. curl_free_callback f,
  1327. curl_realloc_callback r,
  1328. curl_strdup_callback s,
  1329. curl_calloc_callback c);
  1330. /*
  1331. * NAME curl_global_cleanup()
  1332. *
  1333. * DESCRIPTION
  1334. *
  1335. * curl_global_cleanup() should be invoked exactly once for each application
  1336. * that uses libcurl
  1337. */
  1338. CURL_EXTERN void curl_global_cleanup(void);
  1339. /* linked-list structure for the CURLOPT_QUOTE option (and other) */
  1340. struct curl_slist {
  1341. char *data;
  1342. struct curl_slist *next;
  1343. };
  1344. /*
  1345. * NAME curl_slist_append()
  1346. *
  1347. * DESCRIPTION
  1348. *
  1349. * Appends a string to a linked list. If no list exists, it will be created
  1350. * first. Returns the new list, after appending.
  1351. */
  1352. CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
  1353. const char *);
  1354. /*
  1355. * NAME curl_slist_free_all()
  1356. *
  1357. * DESCRIPTION
  1358. *
  1359. * free a previously built curl_slist.
  1360. */
  1361. CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
  1362. /*
  1363. * NAME curl_getdate()
  1364. *
  1365. * DESCRIPTION
  1366. *
  1367. * Returns the time, in seconds since 1 Jan 1970 of the time string given in
  1368. * the first argument. The time argument in the second parameter is unused
  1369. * and should be set to NULL.
  1370. */
  1371. CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
  1372. /* info about the certificate chain, only for OpenSSL builds. Asked
  1373. for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
  1374. struct curl_certinfo {
  1375. int num_of_certs; /* number of certificates with information */
  1376. struct curl_slist **certinfo; /* for each index in this array, there's a
  1377. linked list with textual information in the
  1378. format "name: value" */
  1379. };
  1380. #define CURLINFO_STRING 0x100000
  1381. #define CURLINFO_LONG 0x200000
  1382. #define CURLINFO_DOUBLE 0x300000
  1383. #define CURLINFO_SLIST 0x400000
  1384. #define CURLINFO_MASK 0x0fffff
  1385. #define CURLINFO_TYPEMASK 0xf00000
  1386. typedef enum {
  1387. CURLINFO_NONE, /* first, never use this */
  1388. CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1,
  1389. CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2,
  1390. CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3,
  1391. CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4,
  1392. CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5,
  1393. CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
  1394. CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7,
  1395. CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8,
  1396. CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9,
  1397. CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10,
  1398. CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11,
  1399. CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12,
  1400. CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13,
  1401. CURLINFO_FILETIME = CURLINFO_LONG + 14,
  1402. CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15,
  1403. CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16,
  1404. CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
  1405. CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18,
  1406. CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19,
  1407. CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20,
  1408. CURLINFO_PRIVATE = CURLINFO_STRING + 21,
  1409. CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22,
  1410. CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23,
  1411. CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24,
  1412. CURLINFO_OS_ERRNO = CURLINFO_LONG + 25,
  1413. CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26,
  1414. CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27,
  1415. CURLINFO_COOKIELIST = CURLINFO_SLIST + 28,
  1416. CURLINFO_LASTSOCKET = CURLINFO_LONG + 29,
  1417. CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30,
  1418. CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31,
  1419. CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32,
  1420. CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33,
  1421. CURLINFO_CERTINFO = CURLINFO_SLIST + 34,
  1422. CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35,
  1423. /* Fill in new entries below here! */
  1424. CURLINFO_LASTONE = 35
  1425. } CURLINFO;
  1426. /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
  1427. CURLINFO_HTTP_CODE */
  1428. #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
  1429. typedef enum {
  1430. CURLCLOSEPOLICY_NONE, /* first, never use this */
  1431. CURLCLOSEPOLICY_OLDEST,
  1432. CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
  1433. CURLCLOSEPOLICY_LEAST_TRAFFIC,
  1434. CURLCLOSEPOLICY_SLOWEST,
  1435. CURLCLOSEPOLICY_CALLBACK,
  1436. CURLCLOSEPOLICY_LAST /* last, never use this */
  1437. } curl_closepolicy;
  1438. #define CURL_GLOBAL_SSL (1<<0)
  1439. #define CURL_GLOBAL_WIN32 (1<<1)
  1440. #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
  1441. #define CURL_GLOBAL_NOTHING 0
  1442. #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
  1443. /*****************************************************************************
  1444. * Setup defines, protos etc for the sharing stuff.
  1445. */
  1446. /* Different data locks for a single share */
  1447. typedef enum {
  1448. CURL_LOCK_DATA_NONE = 0,
  1449. /* CURL_LOCK_DATA_SHARE is used internally to say that
  1450. * the locking is just made to change the internal state of the share
  1451. * itself.
  1452. */
  1453. CURL_LOCK_DATA_SHARE,
  1454. CURL_LOCK_DATA_COOKIE,
  1455. CURL_LOCK_DATA_DNS,
  1456. CURL_LOCK_DATA_SSL_SESSION,
  1457. CURL_LOCK_DATA_CONNECT,
  1458. CURL_LOCK_DATA_LAST
  1459. } curl_lock_data;
  1460. /* Different lock access types */
  1461. typedef enum {
  1462. CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */
  1463. CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
  1464. CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
  1465. CURL_LOCK_ACCESS_LAST /* never use */
  1466. } curl_lock_access;
  1467. typedef void (*curl_lock_function)(CURL *handle,
  1468. curl_lock_data data,
  1469. curl_lock_access locktype,
  1470. void *userptr);
  1471. typedef void (*curl_unlock_function)(CURL *handle,
  1472. curl_lock_data data,
  1473. void *userptr);
  1474. typedef void CURLSH;
  1475. typedef enum {
  1476. CURLSHE_OK, /* all is fine */
  1477. CURLSHE_BAD_OPTION, /* 1 */
  1478. CURLSHE_IN_USE, /* 2 */
  1479. CURLSHE_INVALID, /* 3 */
  1480. CURLSHE_NOMEM, /* out of memory */
  1481. CURLSHE_LAST /* never use */
  1482. } CURLSHcode;
  1483. typedef enum {
  1484. CURLSHOPT_NONE, /* don't use */
  1485. CURLSHOPT_SHARE, /* specify a data type to share */
  1486. CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */
  1487. CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */
  1488. CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
  1489. CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock
  1490. callback functions */
  1491. CURLSHOPT_LAST /* never use */
  1492. } CURLSHoption;
  1493. CURL_EXTERN CURLSH *curl_share_init(void);
  1494. CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
  1495. CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
  1496. /****************************************************************************
  1497. * Structures for querying information about the curl library at runtime.
  1498. */
  1499. typedef enum {
  1500. CURLVERSION_FIRST,
  1501. CURLVERSION_SECOND,
  1502. CURLVERSION_THIRD,
  1503. CURLVERSION_FOURTH,
  1504. CURLVERSION_LAST /* never actually use this */
  1505. } CURLversion;
  1506. /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
  1507. basically all programs ever that want to get version information. It is
  1508. meant to be a built-in version number for what kind of struct the caller
  1509. expects. If the struct ever changes, we redefine the NOW to another enum
  1510. from above. */
  1511. #define CURLVERSION_NOW CURLVERSION_FOURTH
  1512. typedef struct {
  1513. CURLversion age; /* age of the returned struct */
  1514. const char *version; /* LIBCURL_VERSION */
  1515. unsigned int version_num; /* LIBCURL_VERSION_NUM */
  1516. const char *host; /* OS/host/cpu/machine when configured */
  1517. int features; /* bitmask, see defines below */
  1518. const char *ssl_version; /* human readable string */
  1519. long ssl_version_num; /* not used anymore, always 0 */
  1520. const char *libz_version; /* human readable string */
  1521. /* protocols is terminated by an entry with a NULL protoname */
  1522. const char * const *protocols;
  1523. /* The fields below this were added in CURLVERSION_SECOND */
  1524. const char *ares;
  1525. int ares_num;
  1526. /* This field was added in CURLVERSION_THIRD */
  1527. const char *libidn;
  1528. /* These field were added in CURLVERSION_FOURTH */
  1529. /* Same as '_libiconv_version' if built with HAVE_ICONV */
  1530. int iconv_ver_num;
  1531. const char *libssh_version; /* human readable string */
  1532. } curl_version_info_data;
  1533. #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */
  1534. #define CURL_VERSION_KERBEROS4 (1<<1) /* kerberos auth is supported */
  1535. #define CURL_VERSION_SSL (1<<2) /* SSL options are present */
  1536. #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */
  1537. #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */
  1538. #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */
  1539. #define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */
  1540. #define CURL_VERSION_ASYNCHDNS (1<<7) /* asynchronous dns resolves */
  1541. #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */
  1542. #define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */
  1543. #define CURL_VERSION_IDN (1<<10) /* International Domain Names support */
  1544. #define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */
  1545. #define CURL_VERSION_CONV (1<<12) /* character conversions supported */
  1546. #define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */
  1547. /*
  1548. * NAME curl_version_info()
  1549. *
  1550. * DESCRIPTION
  1551. *
  1552. * This function returns a pointer to a static copy of the version info
  1553. * struct. See above.
  1554. */
  1555. CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
  1556. /*
  1557. * NAME curl_easy_strerror()
  1558. *
  1559. * DESCRIPTION
  1560. *
  1561. * The curl_easy_strerror function may be used to turn a CURLcode value
  1562. * into the equivalent human readable error string. This is useful
  1563. * for printing meaningful error messages.
  1564. */
  1565. CURL_EXTERN const char *curl_easy_strerror(CURLcode);
  1566. /*
  1567. * NAME curl_share_strerror()
  1568. *
  1569. * DESCRIPTION
  1570. *
  1571. * The curl_share_strerror function may be used to turn a CURLSHcode value
  1572. * into the equivalent human readable error string. This is useful
  1573. * for printing meaningful error messages.
  1574. */
  1575. CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
  1576. /*
  1577. * NAME curl_easy_pause()
  1578. *
  1579. * DESCRIPTION
  1580. *
  1581. * The curl_easy_pause function pauses or unpauses transfers. Select the new
  1582. * state by setting the bitmask, use the convenience defines below.
  1583. *
  1584. */
  1585. CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
  1586. #define CURLPAUSE_RECV (1<<0)
  1587. #define CURLPAUSE_RECV_CONT (0)
  1588. #define CURLPAUSE_SEND (1<<2)
  1589. #define CURLPAUSE_SEND_CONT (0)
  1590. #define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND)
  1591. #define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)
  1592. #ifdef __cplusplus
  1593. }
  1594. #endif
  1595. /* unfortunately, the easy.h and multi.h include files need options and info
  1596. stuff before they can be included! */
  1597. #include "easy.h" /* nothing in curl is fun without the easy stuff */
  1598. #include "multi.h"
  1599. /* the typechecker doesn't work in C++ (yet) */
  1600. #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
  1601. ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
  1602. !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
  1603. #include "typecheck-gcc.h"
  1604. #else
  1605. #if defined(__STDC__) && (__STDC__ >= 1)
  1606. /* This preprocessor magic that replaces a call with the exact same call is
  1607. only done to make sure application authors pass exactly three arguments
  1608. to these functions. */
  1609. #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
  1610. #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
  1611. #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
  1612. #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
  1613. #endif /* __STDC__ >= 1 */
  1614. #endif /* gcc >= 4.3 && !__cplusplus */
  1615. #endif /* __CURL_CURL_H */