curl.h 72 KB

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