You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

curl.h 94KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551
  1. #ifndef __CURL_CURL_H
  2. #define __CURL_CURL_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2017, 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 https://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. ***************************************************************************/
  24. /*
  25. * If you have libcurl problems, all docs and details are found here:
  26. * https://curl.haxx.se/libcurl/
  27. *
  28. * curl-library mailing list subscription and unsubscription web interface:
  29. * https://cool.haxx.se/mailman/listinfo/curl-library/
  30. */
  31. #ifdef CURL_NO_OLDIES
  32. #define CURL_STRICTER
  33. #endif
  34. #include "curlver.h" /* libcurl version defines */
  35. #include "system.h" /* determine things run-time */
  36. /*
  37. * Define WIN32 when build target is Win32 API
  38. */
  39. #if (defined(_WIN32) || defined(__WIN32__)) && \
  40. !defined(WIN32) && !defined(__SYMBIAN32__)
  41. #define WIN32
  42. #endif
  43. #include <stdio.h>
  44. #include <limits.h>
  45. #if defined(__FreeBSD__) && (__FreeBSD__ >= 2)
  46. /* Needed for __FreeBSD_version symbol definition */
  47. #include <osreldate.h>
  48. #endif
  49. /* The include stuff here below is mainly for time_t! */
  50. #include <sys/types.h>
  51. #include <time.h>
  52. #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)
  53. #if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || \
  54. defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H))
  55. /* The check above prevents the winsock2 inclusion if winsock.h already was
  56. included, since they can't co-exist without problems */
  57. #include <winsock2.h>
  58. #include <ws2tcpip.h>
  59. #endif
  60. #endif
  61. /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
  62. libc5-based Linux systems. Only include it on systems that are known to
  63. require it! */
  64. #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
  65. defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
  66. defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \
  67. (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))
  68. #include <sys/select.h>
  69. #endif
  70. #if !defined(WIN32) && !defined(_WIN32_WCE)
  71. #include <sys/socket.h>
  72. #endif
  73. #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
  74. #include <sys/time.h>
  75. #endif
  76. #ifdef __BEOS__
  77. #include <support/SupportDefs.h>
  78. #endif
  79. #ifdef __cplusplus
  80. extern "C" {
  81. #endif
  82. #if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
  83. typedef struct Curl_easy CURL;
  84. typedef struct Curl_share CURLSH;
  85. #else
  86. typedef void CURL;
  87. typedef void CURLSH;
  88. #endif
  89. /*
  90. * libcurl external API function linkage decorations.
  91. */
  92. #ifdef CURL_STATICLIB
  93. # define CURL_EXTERN
  94. #elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
  95. # if defined(BUILDING_LIBCURL)
  96. # define CURL_EXTERN __declspec(dllexport)
  97. # else
  98. # define CURL_EXTERN __declspec(dllimport)
  99. # endif
  100. #elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS)
  101. # define CURL_EXTERN CURL_EXTERN_SYMBOL
  102. #else
  103. # define CURL_EXTERN
  104. #endif
  105. #ifndef curl_socket_typedef
  106. /* socket typedef */
  107. #if defined(WIN32) && !defined(__LWIP_OPT_H__) && !defined(LWIP_HDR_OPT_H)
  108. typedef SOCKET curl_socket_t;
  109. #define CURL_SOCKET_BAD INVALID_SOCKET
  110. #else
  111. typedef int curl_socket_t;
  112. #define CURL_SOCKET_BAD -1
  113. #endif
  114. #define curl_socket_typedef
  115. #endif /* curl_socket_typedef */
  116. struct curl_httppost {
  117. struct curl_httppost *next; /* next entry in the list */
  118. char *name; /* pointer to allocated name */
  119. long namelength; /* length of name length */
  120. char *contents; /* pointer to allocated data contents */
  121. long contentslength; /* length of contents field, see also
  122. CURL_HTTPPOST_LARGE */
  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. /* specified content is a file name */
  132. #define CURL_HTTPPOST_FILENAME (1<<0)
  133. /* specified content is a file name */
  134. #define CURL_HTTPPOST_READFILE (1<<1)
  135. /* name is only stored pointer do not free in formfree */
  136. #define CURL_HTTPPOST_PTRNAME (1<<2)
  137. /* contents is only stored pointer do not free in formfree */
  138. #define CURL_HTTPPOST_PTRCONTENTS (1<<3)
  139. /* upload file from buffer */
  140. #define CURL_HTTPPOST_BUFFER (1<<4)
  141. /* upload file from pointer contents */
  142. #define CURL_HTTPPOST_PTRBUFFER (1<<5)
  143. /* upload file contents by using the regular read callback to get the data and
  144. pass the given pointer as custom pointer */
  145. #define CURL_HTTPPOST_CALLBACK (1<<6)
  146. /* use size in 'contentlen', added in 7.46.0 */
  147. #define CURL_HTTPPOST_LARGE (1<<7)
  148. char *showfilename; /* The file name to show. If not set, the
  149. actual file name will be used (if this
  150. is a file part) */
  151. void *userp; /* custom pointer used for
  152. HTTPPOST_CALLBACK posts */
  153. curl_off_t contentlen; /* alternative length of contents
  154. field. Used if CURL_HTTPPOST_LARGE is
  155. set. Added in 7.46.0 */
  156. };
  157. /* This is the CURLOPT_PROGRESSFUNCTION callback proto. It is now considered
  158. deprecated but was the only choice up until 7.31.0 */
  159. typedef int (*curl_progress_callback)(void *clientp,
  160. double dltotal,
  161. double dlnow,
  162. double ultotal,
  163. double ulnow);
  164. /* This is the CURLOPT_XFERINFOFUNCTION callback proto. It was introduced in
  165. 7.32.0, it avoids floating point and provides more detailed information. */
  166. typedef int (*curl_xferinfo_callback)(void *clientp,
  167. curl_off_t dltotal,
  168. curl_off_t dlnow,
  169. curl_off_t ultotal,
  170. curl_off_t ulnow);
  171. #ifndef CURL_MAX_READ_SIZE
  172. /* The maximum receive buffer size configurable via CURLOPT_BUFFERSIZE. */
  173. #define CURL_MAX_READ_SIZE 524288
  174. #endif
  175. #ifndef CURL_MAX_WRITE_SIZE
  176. /* Tests have proven that 20K is a very bad buffer size for uploads on
  177. Windows, while 16K for some odd reason performed a lot better.
  178. We do the ifndef check to allow this value to easier be changed at build
  179. time for those who feel adventurous. The practical minimum is about
  180. 400 bytes since libcurl uses a buffer of this size as a scratch area
  181. (unrelated to network send operations). */
  182. #define CURL_MAX_WRITE_SIZE 16384
  183. #endif
  184. #ifndef CURL_MAX_HTTP_HEADER
  185. /* The only reason to have a max limit for this is to avoid the risk of a bad
  186. server feeding libcurl with a never-ending header that will cause reallocs
  187. infinitely */
  188. #define CURL_MAX_HTTP_HEADER (100*1024)
  189. #endif
  190. /* This is a magic return code for the write callback that, when returned,
  191. will signal libcurl to pause receiving on the current transfer. */
  192. #define CURL_WRITEFUNC_PAUSE 0x10000001
  193. typedef size_t (*curl_write_callback)(char *buffer,
  194. size_t size,
  195. size_t nitems,
  196. void *outstream);
  197. /* enumeration of file types */
  198. typedef enum {
  199. CURLFILETYPE_FILE = 0,
  200. CURLFILETYPE_DIRECTORY,
  201. CURLFILETYPE_SYMLINK,
  202. CURLFILETYPE_DEVICE_BLOCK,
  203. CURLFILETYPE_DEVICE_CHAR,
  204. CURLFILETYPE_NAMEDPIPE,
  205. CURLFILETYPE_SOCKET,
  206. CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */
  207. CURLFILETYPE_UNKNOWN /* should never occur */
  208. } curlfiletype;
  209. #define CURLFINFOFLAG_KNOWN_FILENAME (1<<0)
  210. #define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1)
  211. #define CURLFINFOFLAG_KNOWN_TIME (1<<2)
  212. #define CURLFINFOFLAG_KNOWN_PERM (1<<3)
  213. #define CURLFINFOFLAG_KNOWN_UID (1<<4)
  214. #define CURLFINFOFLAG_KNOWN_GID (1<<5)
  215. #define CURLFINFOFLAG_KNOWN_SIZE (1<<6)
  216. #define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7)
  217. /* Content of this structure depends on information which is known and is
  218. achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man
  219. page for callbacks returning this structure -- some fields are mandatory,
  220. some others are optional. The FLAG field has special meaning. */
  221. struct curl_fileinfo {
  222. char *filename;
  223. curlfiletype filetype;
  224. time_t time;
  225. unsigned int perm;
  226. int uid;
  227. int gid;
  228. curl_off_t size;
  229. long int hardlinks;
  230. struct {
  231. /* If some of these fields is not NULL, it is a pointer to b_data. */
  232. char *time;
  233. char *perm;
  234. char *user;
  235. char *group;
  236. char *target; /* pointer to the target filename of a symlink */
  237. } strings;
  238. unsigned int flags;
  239. /* used internally */
  240. char *b_data;
  241. size_t b_size;
  242. size_t b_used;
  243. };
  244. /* return codes for CURLOPT_CHUNK_BGN_FUNCTION */
  245. #define CURL_CHUNK_BGN_FUNC_OK 0
  246. #define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */
  247. #define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */
  248. /* if splitting of data transfer is enabled, this callback is called before
  249. download of an individual chunk started. Note that parameter "remains" works
  250. only for FTP wildcard downloading (for now), otherwise is not used */
  251. typedef long (*curl_chunk_bgn_callback)(const void *transfer_info,
  252. void *ptr,
  253. int remains);
  254. /* return codes for CURLOPT_CHUNK_END_FUNCTION */
  255. #define CURL_CHUNK_END_FUNC_OK 0
  256. #define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */
  257. /* If splitting of data transfer is enabled this callback is called after
  258. download of an individual chunk finished.
  259. Note! After this callback was set then it have to be called FOR ALL chunks.
  260. Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.
  261. This is the reason why we don't need "transfer_info" parameter in this
  262. callback and we are not interested in "remains" parameter too. */
  263. typedef long (*curl_chunk_end_callback)(void *ptr);
  264. /* return codes for FNMATCHFUNCTION */
  265. #define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */
  266. #define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */
  267. #define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */
  268. /* callback type for wildcard downloading pattern matching. If the
  269. string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */
  270. typedef int (*curl_fnmatch_callback)(void *ptr,
  271. const char *pattern,
  272. const char *string);
  273. /* These are the return codes for the seek callbacks */
  274. #define CURL_SEEKFUNC_OK 0
  275. #define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */
  276. #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so
  277. libcurl might try other means instead */
  278. typedef int (*curl_seek_callback)(void *instream,
  279. curl_off_t offset,
  280. int origin); /* 'whence' */
  281. /* This is a return code for the read callback that, when returned, will
  282. signal libcurl to immediately abort the current transfer. */
  283. #define CURL_READFUNC_ABORT 0x10000000
  284. /* This is a return code for the read callback that, when returned, will
  285. signal libcurl to pause sending data on the current transfer. */
  286. #define CURL_READFUNC_PAUSE 0x10000001
  287. typedef size_t (*curl_read_callback)(char *buffer,
  288. size_t size,
  289. size_t nitems,
  290. void *instream);
  291. typedef enum {
  292. CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
  293. CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */
  294. CURLSOCKTYPE_LAST /* never use */
  295. } curlsocktype;
  296. /* The return code from the sockopt_callback can signal information back
  297. to libcurl: */
  298. #define CURL_SOCKOPT_OK 0
  299. #define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return
  300. CURLE_ABORTED_BY_CALLBACK */
  301. #define CURL_SOCKOPT_ALREADY_CONNECTED 2
  302. typedef int (*curl_sockopt_callback)(void *clientp,
  303. curl_socket_t curlfd,
  304. curlsocktype purpose);
  305. struct curl_sockaddr {
  306. int family;
  307. int socktype;
  308. int protocol;
  309. unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it
  310. turned really ugly and painful on the systems that
  311. lack this type */
  312. struct sockaddr addr;
  313. };
  314. typedef curl_socket_t
  315. (*curl_opensocket_callback)(void *clientp,
  316. curlsocktype purpose,
  317. struct curl_sockaddr *address);
  318. typedef int
  319. (*curl_closesocket_callback)(void *clientp, curl_socket_t item);
  320. typedef enum {
  321. CURLIOE_OK, /* I/O operation successful */
  322. CURLIOE_UNKNOWNCMD, /* command was unknown to callback */
  323. CURLIOE_FAILRESTART, /* failed to restart the read */
  324. CURLIOE_LAST /* never use */
  325. } curlioerr;
  326. typedef enum {
  327. CURLIOCMD_NOP, /* no operation */
  328. CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
  329. CURLIOCMD_LAST /* never use */
  330. } curliocmd;
  331. typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
  332. int cmd,
  333. void *clientp);
  334. #ifndef CURL_DID_MEMORY_FUNC_TYPEDEFS
  335. /*
  336. * The following typedef's are signatures of malloc, free, realloc, strdup and
  337. * calloc respectively. Function pointers of these types can be passed to the
  338. * curl_global_init_mem() function to set user defined memory management
  339. * callback routines.
  340. */
  341. typedef void *(*curl_malloc_callback)(size_t size);
  342. typedef void (*curl_free_callback)(void *ptr);
  343. typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
  344. typedef char *(*curl_strdup_callback)(const char *str);
  345. typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
  346. #define CURL_DID_MEMORY_FUNC_TYPEDEFS
  347. #endif
  348. /* the kind of data that is passed to information_callback*/
  349. typedef enum {
  350. CURLINFO_TEXT = 0,
  351. CURLINFO_HEADER_IN, /* 1 */
  352. CURLINFO_HEADER_OUT, /* 2 */
  353. CURLINFO_DATA_IN, /* 3 */
  354. CURLINFO_DATA_OUT, /* 4 */
  355. CURLINFO_SSL_DATA_IN, /* 5 */
  356. CURLINFO_SSL_DATA_OUT, /* 6 */
  357. CURLINFO_END
  358. } curl_infotype;
  359. typedef int (*curl_debug_callback)
  360. (CURL *handle, /* the handle/transfer this concerns */
  361. curl_infotype type, /* what kind of data */
  362. char *data, /* points to the data */
  363. size_t size, /* size of the data pointed to */
  364. void *userptr); /* whatever the user please */
  365. /* All possible error codes from all sorts of curl functions. Future versions
  366. may return other values, stay prepared.
  367. Always add new return codes last. Never *EVER* remove any. The return
  368. codes must remain the same!
  369. */
  370. typedef enum {
  371. CURLE_OK = 0,
  372. CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
  373. CURLE_FAILED_INIT, /* 2 */
  374. CURLE_URL_MALFORMAT, /* 3 */
  375. CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for
  376. 7.17.0, reused in April 2011 for 7.21.5] */
  377. CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
  378. CURLE_COULDNT_RESOLVE_HOST, /* 6 */
  379. CURLE_COULDNT_CONNECT, /* 7 */
  380. CURLE_WEIRD_SERVER_REPLY, /* 8 */
  381. CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server
  382. due to lack of access - when login fails
  383. this is not returned. */
  384. CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for
  385. 7.15.4, reused in Dec 2011 for 7.24.0]*/
  386. CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
  387. CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server
  388. [was obsoleted in August 2007 for 7.17.0,
  389. reused in Dec 2011 for 7.24.0]*/
  390. CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
  391. CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
  392. CURLE_FTP_CANT_GET_HOST, /* 15 */
  393. CURLE_HTTP2, /* 16 - A problem in the http2 framing layer.
  394. [was obsoleted in August 2007 for 7.17.0,
  395. reused in July 2014 for 7.38.0] */
  396. CURLE_FTP_COULDNT_SET_TYPE, /* 17 */
  397. CURLE_PARTIAL_FILE, /* 18 */
  398. CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
  399. CURLE_OBSOLETE20, /* 20 - NOT USED */
  400. CURLE_QUOTE_ERROR, /* 21 - quote command failure */
  401. CURLE_HTTP_RETURNED_ERROR, /* 22 */
  402. CURLE_WRITE_ERROR, /* 23 */
  403. CURLE_OBSOLETE24, /* 24 - NOT USED */
  404. CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */
  405. CURLE_READ_ERROR, /* 26 - couldn't open/read from file */
  406. CURLE_OUT_OF_MEMORY, /* 27 */
  407. /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
  408. instead of a memory allocation error if CURL_DOES_CONVERSIONS
  409. is defined
  410. */
  411. CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */
  412. CURLE_OBSOLETE29, /* 29 - NOT USED */
  413. CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
  414. CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
  415. CURLE_OBSOLETE32, /* 32 - NOT USED */
  416. CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
  417. CURLE_HTTP_POST_ERROR, /* 34 */
  418. CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
  419. CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
  420. CURLE_FILE_COULDNT_READ_FILE, /* 37 */
  421. CURLE_LDAP_CANNOT_BIND, /* 38 */
  422. CURLE_LDAP_SEARCH_FAILED, /* 39 */
  423. CURLE_OBSOLETE40, /* 40 - NOT USED */
  424. CURLE_FUNCTION_NOT_FOUND, /* 41 - NOT USED starting with 7.53.0 */
  425. CURLE_ABORTED_BY_CALLBACK, /* 42 */
  426. CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
  427. CURLE_OBSOLETE44, /* 44 - NOT USED */
  428. CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
  429. CURLE_OBSOLETE46, /* 46 - NOT USED */
  430. CURLE_TOO_MANY_REDIRECTS, /* 47 - catch endless re-direct loops */
  431. CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */
  432. CURLE_TELNET_OPTION_SYNTAX, /* 49 - Malformed telnet option */
  433. CURLE_OBSOLETE50, /* 50 - NOT USED */
  434. CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
  435. wasn't verified fine */
  436. CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
  437. CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
  438. CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
  439. default */
  440. CURLE_SEND_ERROR, /* 55 - failed sending network data */
  441. CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
  442. CURLE_OBSOLETE57, /* 57 - NOT IN USE */
  443. CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
  444. CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
  445. CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
  446. CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */
  447. CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
  448. CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
  449. CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
  450. CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
  451. that failed */
  452. CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
  453. CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
  454. accepted and we failed to login */
  455. CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */
  456. CURLE_TFTP_PERM, /* 69 - permission problem on server */
  457. CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */
  458. CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */
  459. CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */
  460. CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */
  461. CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */
  462. CURLE_CONV_FAILED, /* 75 - conversion failed */
  463. CURLE_CONV_REQD, /* 76 - caller must register conversion
  464. callbacks using curl_easy_setopt options
  465. CURLOPT_CONV_FROM_NETWORK_FUNCTION,
  466. CURLOPT_CONV_TO_NETWORK_FUNCTION, and
  467. CURLOPT_CONV_FROM_UTF8_FUNCTION */
  468. CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing
  469. or wrong format */
  470. CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */
  471. CURLE_SSH, /* 79 - error from the SSH layer, somewhat
  472. generic so the error message will be of
  473. interest when this has happened */
  474. CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL
  475. connection */
  476. CURLE_AGAIN, /* 81 - socket is not ready for send/recv,
  477. wait till it's ready and try again (Added
  478. in 7.18.2) */
  479. CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or
  480. wrong format (Added in 7.19.0) */
  481. CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in
  482. 7.19.0) */
  483. CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */
  484. CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */
  485. CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */
  486. CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */
  487. CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */
  488. CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the
  489. session will be queued */
  490. CURLE_SSL_PINNEDPUBKEYNOTMATCH, /* 90 - specified pinned public key did not
  491. match */
  492. CURLE_SSL_INVALIDCERTSTATUS, /* 91 - invalid certificate status */
  493. CURLE_HTTP2_STREAM, /* 92 - stream error in HTTP/2 framing layer
  494. */
  495. CURL_LAST /* never use! */
  496. } CURLcode;
  497. #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
  498. the obsolete stuff removed! */
  499. /* Previously obsolete error code re-used in 7.38.0 */
  500. #define CURLE_OBSOLETE16 CURLE_HTTP2
  501. /* Previously obsolete error codes re-used in 7.24.0 */
  502. #define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED
  503. #define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT
  504. /* compatibility with older names */
  505. #define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING
  506. #define CURLE_FTP_WEIRD_SERVER_REPLY CURLE_WEIRD_SERVER_REPLY
  507. /* The following were added in 7.21.5, April 2011 */
  508. #define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION
  509. /* The following were added in 7.17.1 */
  510. /* These are scheduled to disappear by 2009 */
  511. #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION
  512. /* The following were added in 7.17.0 */
  513. /* These are scheduled to disappear by 2009 */
  514. #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */
  515. #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
  516. #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
  517. #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
  518. #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
  519. #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
  520. #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
  521. #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
  522. #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
  523. #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
  524. #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
  525. #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
  526. #define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN
  527. #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
  528. #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
  529. #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
  530. #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
  531. #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
  532. #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
  533. #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
  534. /* The following were added earlier */
  535. #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT
  536. #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
  537. #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
  538. #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
  539. #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
  540. #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
  541. /* This was the error code 50 in 7.7.3 and a few earlier versions, this
  542. is no longer used by libcurl but is instead #defined here only to not
  543. make programs break */
  544. #define CURLE_ALREADY_COMPLETE 99999
  545. /* Provide defines for really old option names */
  546. #define CURLOPT_FILE CURLOPT_WRITEDATA /* name changed in 7.9.7 */
  547. #define CURLOPT_INFILE CURLOPT_READDATA /* name changed in 7.9.7 */
  548. #define CURLOPT_WRITEHEADER CURLOPT_HEADERDATA
  549. /* Since long deprecated options with no code in the lib that does anything
  550. with them. */
  551. #define CURLOPT_WRITEINFO CURLOPT_OBSOLETE40
  552. #define CURLOPT_CLOSEPOLICY CURLOPT_OBSOLETE72
  553. #endif /*!CURL_NO_OLDIES*/
  554. /* This prototype applies to all conversion callbacks */
  555. typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
  556. typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
  557. void *ssl_ctx, /* actually an
  558. OpenSSL SSL_CTX */
  559. void *userptr);
  560. typedef enum {
  561. CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use
  562. CONNECT HTTP/1.1 */
  563. CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT
  564. HTTP/1.0 */
  565. CURLPROXY_HTTPS = 2, /* added in 7.52.0 */
  566. CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already
  567. in 7.10 */
  568. CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
  569. CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */
  570. CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the
  571. host name rather than the IP address. added
  572. in 7.18.0 */
  573. } curl_proxytype; /* this enum was added in 7.10 */
  574. /*
  575. * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:
  576. *
  577. * CURLAUTH_NONE - No HTTP authentication
  578. * CURLAUTH_BASIC - HTTP Basic authentication (default)
  579. * CURLAUTH_DIGEST - HTTP Digest authentication
  580. * CURLAUTH_NEGOTIATE - HTTP Negotiate (SPNEGO) authentication
  581. * CURLAUTH_GSSNEGOTIATE - Alias for CURLAUTH_NEGOTIATE (deprecated)
  582. * CURLAUTH_NTLM - HTTP NTLM authentication
  583. * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour
  584. * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper
  585. * CURLAUTH_ONLY - Use together with a single other type to force no
  586. * authentication or just that single type
  587. * CURLAUTH_ANY - All fine types set
  588. * CURLAUTH_ANYSAFE - All fine types except Basic
  589. */
  590. #define CURLAUTH_NONE ((unsigned long)0)
  591. #define CURLAUTH_BASIC (((unsigned long)1)<<0)
  592. #define CURLAUTH_DIGEST (((unsigned long)1)<<1)
  593. #define CURLAUTH_NEGOTIATE (((unsigned long)1)<<2)
  594. /* Deprecated since the advent of CURLAUTH_NEGOTIATE */
  595. #define CURLAUTH_GSSNEGOTIATE CURLAUTH_NEGOTIATE
  596. #define CURLAUTH_NTLM (((unsigned long)1)<<3)
  597. #define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4)
  598. #define CURLAUTH_NTLM_WB (((unsigned long)1)<<5)
  599. #define CURLAUTH_ONLY (((unsigned long)1)<<31)
  600. #define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)
  601. #define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
  602. #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */
  603. #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */
  604. #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
  605. #define CURLSSH_AUTH_PASSWORD (1<<1) /* password */
  606. #define CURLSSH_AUTH_HOST (1<<2) /* host key files */
  607. #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */
  608. #define CURLSSH_AUTH_AGENT (1<<4) /* agent (ssh-agent, pageant...) */
  609. #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
  610. #define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */
  611. #define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */
  612. #define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */
  613. #define CURL_ERROR_SIZE 256
  614. enum curl_khtype {
  615. CURLKHTYPE_UNKNOWN,
  616. CURLKHTYPE_RSA1,
  617. CURLKHTYPE_RSA,
  618. CURLKHTYPE_DSS
  619. };
  620. struct curl_khkey {
  621. const char *key; /* points to a zero-terminated string encoded with base64
  622. if len is zero, otherwise to the "raw" data */
  623. size_t len;
  624. enum curl_khtype keytype;
  625. };
  626. /* this is the set of return values expected from the curl_sshkeycallback
  627. callback */
  628. enum curl_khstat {
  629. CURLKHSTAT_FINE_ADD_TO_FILE,
  630. CURLKHSTAT_FINE,
  631. CURLKHSTAT_REJECT, /* reject the connection, return an error */
  632. CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so
  633. this causes a CURLE_DEFER error but otherwise the
  634. connection will be left intact etc */
  635. CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */
  636. };
  637. /* this is the set of status codes pass in to the callback */
  638. enum curl_khmatch {
  639. CURLKHMATCH_OK, /* match */
  640. CURLKHMATCH_MISMATCH, /* host found, key mismatch! */
  641. CURLKHMATCH_MISSING, /* no matching host/key found */
  642. CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */
  643. };
  644. typedef int
  645. (*curl_sshkeycallback) (CURL *easy, /* easy handle */
  646. const struct curl_khkey *knownkey, /* known */
  647. const struct curl_khkey *foundkey, /* found */
  648. enum curl_khmatch, /* libcurl's view on the keys */
  649. void *clientp); /* custom pointer passed from app */
  650. /* parameter for the CURLOPT_USE_SSL option */
  651. typedef enum {
  652. CURLUSESSL_NONE, /* do not attempt to use SSL */
  653. CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */
  654. CURLUSESSL_CONTROL, /* SSL for the control connection or fail */
  655. CURLUSESSL_ALL, /* SSL for all communication or fail */
  656. CURLUSESSL_LAST /* not an option, never use */
  657. } curl_usessl;
  658. /* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */
  659. /* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the
  660. name of improving interoperability with older servers. Some SSL libraries
  661. have introduced work-arounds for this flaw but those work-arounds sometimes
  662. make the SSL communication fail. To regain functionality with those broken
  663. servers, a user can this way allow the vulnerability back. */
  664. #define CURLSSLOPT_ALLOW_BEAST (1<<0)
  665. /* - NO_REVOKE tells libcurl to disable certificate revocation checks for those
  666. SSL backends where such behavior is present. */
  667. #define CURLSSLOPT_NO_REVOKE (1<<1)
  668. #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
  669. the obsolete stuff removed! */
  670. /* Backwards compatibility with older names */
  671. /* These are scheduled to disappear by 2009 */
  672. #define CURLFTPSSL_NONE CURLUSESSL_NONE
  673. #define CURLFTPSSL_TRY CURLUSESSL_TRY
  674. #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
  675. #define CURLFTPSSL_ALL CURLUSESSL_ALL
  676. #define CURLFTPSSL_LAST CURLUSESSL_LAST
  677. #define curl_ftpssl curl_usessl
  678. #endif /*!CURL_NO_OLDIES*/
  679. /* parameter for the CURLOPT_FTP_SSL_CCC option */
  680. typedef enum {
  681. CURLFTPSSL_CCC_NONE, /* do not send CCC */
  682. CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
  683. CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */
  684. CURLFTPSSL_CCC_LAST /* not an option, never use */
  685. } curl_ftpccc;
  686. /* parameter for the CURLOPT_FTPSSLAUTH option */
  687. typedef enum {
  688. CURLFTPAUTH_DEFAULT, /* let libcurl decide */
  689. CURLFTPAUTH_SSL, /* use "AUTH SSL" */
  690. CURLFTPAUTH_TLS, /* use "AUTH TLS" */
  691. CURLFTPAUTH_LAST /* not an option, never use */
  692. } curl_ftpauth;
  693. /* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
  694. typedef enum {
  695. CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */
  696. CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD
  697. again if MKD succeeded, for SFTP this does
  698. similar magic */
  699. CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
  700. again even if MKD failed! */
  701. CURLFTP_CREATE_DIR_LAST /* not an option, never use */
  702. } curl_ftpcreatedir;
  703. /* parameter for the CURLOPT_FTP_FILEMETHOD option */
  704. typedef enum {
  705. CURLFTPMETHOD_DEFAULT, /* let libcurl pick */
  706. CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */
  707. CURLFTPMETHOD_NOCWD, /* no CWD at all */
  708. CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
  709. CURLFTPMETHOD_LAST /* not an option, never use */
  710. } curl_ftpmethod;
  711. /* bitmask defines for CURLOPT_HEADEROPT */
  712. #define CURLHEADER_UNIFIED 0
  713. #define CURLHEADER_SEPARATE (1<<0)
  714. /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
  715. #define CURLPROTO_HTTP (1<<0)
  716. #define CURLPROTO_HTTPS (1<<1)
  717. #define CURLPROTO_FTP (1<<2)
  718. #define CURLPROTO_FTPS (1<<3)
  719. #define CURLPROTO_SCP (1<<4)
  720. #define CURLPROTO_SFTP (1<<5)
  721. #define CURLPROTO_TELNET (1<<6)
  722. #define CURLPROTO_LDAP (1<<7)
  723. #define CURLPROTO_LDAPS (1<<8)
  724. #define CURLPROTO_DICT (1<<9)
  725. #define CURLPROTO_FILE (1<<10)
  726. #define CURLPROTO_TFTP (1<<11)
  727. #define CURLPROTO_IMAP (1<<12)
  728. #define CURLPROTO_IMAPS (1<<13)
  729. #define CURLPROTO_POP3 (1<<14)
  730. #define CURLPROTO_POP3S (1<<15)
  731. #define CURLPROTO_SMTP (1<<16)
  732. #define CURLPROTO_SMTPS (1<<17)
  733. #define CURLPROTO_RTSP (1<<18)
  734. #define CURLPROTO_RTMP (1<<19)
  735. #define CURLPROTO_RTMPT (1<<20)
  736. #define CURLPROTO_RTMPE (1<<21)
  737. #define CURLPROTO_RTMPTE (1<<22)
  738. #define CURLPROTO_RTMPS (1<<23)
  739. #define CURLPROTO_RTMPTS (1<<24)
  740. #define CURLPROTO_GOPHER (1<<25)
  741. #define CURLPROTO_SMB (1<<26)
  742. #define CURLPROTO_SMBS (1<<27)
  743. #define CURLPROTO_ALL (~0) /* enable everything */
  744. /* long may be 32 or 64 bits, but we should never depend on anything else
  745. but 32 */
  746. #define CURLOPTTYPE_LONG 0
  747. #define CURLOPTTYPE_OBJECTPOINT 10000
  748. #define CURLOPTTYPE_STRINGPOINT 10000
  749. #define CURLOPTTYPE_FUNCTIONPOINT 20000
  750. #define CURLOPTTYPE_OFF_T 30000
  751. /* *STRINGPOINT is an alias for OBJECTPOINT to allow tools to extract the
  752. string options from the header file */
  753. /* name is uppercase CURLOPT_<name>,
  754. type is one of the defined CURLOPTTYPE_<type>
  755. number is unique identifier */
  756. #ifdef CINIT
  757. #undef CINIT
  758. #endif
  759. #ifdef CURL_ISOCPP
  760. #define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu
  761. #else
  762. /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
  763. #define LONG CURLOPTTYPE_LONG
  764. #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
  765. #define STRINGPOINT CURLOPTTYPE_OBJECTPOINT
  766. #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
  767. #define OFF_T CURLOPTTYPE_OFF_T
  768. #define CINIT(name,type,number) CURLOPT_/**/name = type + number
  769. #endif
  770. /*
  771. * This macro-mania below setups the CURLOPT_[what] enum, to be used with
  772. * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
  773. * word.
  774. */
  775. typedef enum {
  776. /* This is the FILE * or void * the regular output should be written to. */
  777. CINIT(WRITEDATA, OBJECTPOINT, 1),
  778. /* The full URL to get/put */
  779. CINIT(URL, STRINGPOINT, 2),
  780. /* Port number to connect to, if other than default. */
  781. CINIT(PORT, LONG, 3),
  782. /* Name of proxy to use. */
  783. CINIT(PROXY, STRINGPOINT, 4),
  784. /* "user:password;options" to use when fetching. */
  785. CINIT(USERPWD, STRINGPOINT, 5),
  786. /* "user:password" to use with proxy. */
  787. CINIT(PROXYUSERPWD, STRINGPOINT, 6),
  788. /* Range to get, specified as an ASCII string. */
  789. CINIT(RANGE, STRINGPOINT, 7),
  790. /* not used */
  791. /* Specified file stream to upload from (use as input): */
  792. CINIT(READDATA, OBJECTPOINT, 9),
  793. /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
  794. * bytes big. If this is not used, error messages go to stderr instead: */
  795. CINIT(ERRORBUFFER, OBJECTPOINT, 10),
  796. /* Function that will be called to store the output (instead of fwrite). The
  797. * parameters will use fwrite() syntax, make sure to follow them. */
  798. CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
  799. /* Function that will be called to read the input (instead of fread). The
  800. * parameters will use fread() syntax, make sure to follow them. */
  801. CINIT(READFUNCTION, FUNCTIONPOINT, 12),
  802. /* Time-out the read operation after this amount of seconds */
  803. CINIT(TIMEOUT, LONG, 13),
  804. /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
  805. * how large the file being sent really is. That allows better error
  806. * checking and better verifies that the upload was successful. -1 means
  807. * unknown size.
  808. *
  809. * For large file support, there is also a _LARGE version of the key
  810. * which takes an off_t type, allowing platforms with larger off_t
  811. * sizes to handle larger files. See below for INFILESIZE_LARGE.
  812. */
  813. CINIT(INFILESIZE, LONG, 14),
  814. /* POST static input fields. */
  815. CINIT(POSTFIELDS, OBJECTPOINT, 15),
  816. /* Set the referrer page (needed by some CGIs) */
  817. CINIT(REFERER, STRINGPOINT, 16),
  818. /* Set the FTP PORT string (interface name, named or numerical IP address)
  819. Use i.e '-' to use default address. */
  820. CINIT(FTPPORT, STRINGPOINT, 17),
  821. /* Set the User-Agent string (examined by some CGIs) */
  822. CINIT(USERAGENT, STRINGPOINT, 18),
  823. /* If the download receives less than "low speed limit" bytes/second
  824. * during "low speed time" seconds, the operations is aborted.
  825. * You could i.e if you have a pretty high speed connection, abort if
  826. * it is less than 2000 bytes/sec during 20 seconds.
  827. */
  828. /* Set the "low speed limit" */
  829. CINIT(LOW_SPEED_LIMIT, LONG, 19),
  830. /* Set the "low speed time" */
  831. CINIT(LOW_SPEED_TIME, LONG, 20),
  832. /* Set the continuation offset.
  833. *
  834. * Note there is also a _LARGE version of this key which uses
  835. * off_t types, allowing for large file offsets on platforms which
  836. * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
  837. */
  838. CINIT(RESUME_FROM, LONG, 21),
  839. /* Set cookie in request: */
  840. CINIT(COOKIE, STRINGPOINT, 22),
  841. /* This points to a linked list of headers, struct curl_slist kind. This
  842. list is also used for RTSP (in spite of its name) */
  843. CINIT(HTTPHEADER, OBJECTPOINT, 23),
  844. /* This points to a linked list of post entries, struct curl_httppost */
  845. CINIT(HTTPPOST, OBJECTPOINT, 24),
  846. /* name of the file keeping your private SSL-certificate */
  847. CINIT(SSLCERT, STRINGPOINT, 25),
  848. /* password for the SSL or SSH private key */
  849. CINIT(KEYPASSWD, STRINGPOINT, 26),
  850. /* send TYPE parameter? */
  851. CINIT(CRLF, LONG, 27),
  852. /* send linked-list of QUOTE commands */
  853. CINIT(QUOTE, OBJECTPOINT, 28),
  854. /* send FILE * or void * to store headers to, if you use a callback it
  855. is simply passed to the callback unmodified */
  856. CINIT(HEADERDATA, OBJECTPOINT, 29),
  857. /* point to a file to read the initial cookies from, also enables
  858. "cookie awareness" */
  859. CINIT(COOKIEFILE, STRINGPOINT, 31),
  860. /* What version to specifically try to use.
  861. See CURL_SSLVERSION defines below. */
  862. CINIT(SSLVERSION, LONG, 32),
  863. /* What kind of HTTP time condition to use, see defines */
  864. CINIT(TIMECONDITION, LONG, 33),
  865. /* Time to use with the above condition. Specified in number of seconds
  866. since 1 Jan 1970 */
  867. CINIT(TIMEVALUE, LONG, 34),
  868. /* 35 = OBSOLETE */
  869. /* Custom request, for customizing the get command like
  870. HTTP: DELETE, TRACE and others
  871. FTP: to use a different list command
  872. */
  873. CINIT(CUSTOMREQUEST, STRINGPOINT, 36),
  874. /* FILE handle to use instead of stderr */
  875. CINIT(STDERR, OBJECTPOINT, 37),
  876. /* 38 is not used */
  877. /* send linked-list of post-transfer QUOTE commands */
  878. CINIT(POSTQUOTE, OBJECTPOINT, 39),
  879. CINIT(OBSOLETE40, OBJECTPOINT, 40), /* OBSOLETE, do not use! */
  880. CINIT(VERBOSE, LONG, 41), /* talk a lot */
  881. CINIT(HEADER, LONG, 42), /* throw the header out too */
  882. CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */
  883. CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */
  884. CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 400 */
  885. CINIT(UPLOAD, LONG, 46), /* this is an upload */
  886. CINIT(POST, LONG, 47), /* HTTP POST method */
  887. CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */
  888. CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */
  889. /* Specify whether to read the user+password from the .netrc or the URL.
  890. * This must be one of the CURL_NETRC_* enums below. */
  891. CINIT(NETRC, LONG, 51),
  892. CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
  893. CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
  894. CINIT(PUT, LONG, 54), /* HTTP PUT */
  895. /* 55 = OBSOLETE */
  896. /* DEPRECATED
  897. * Function that will be called instead of the internal progress display
  898. * function. This function should be defined as the curl_progress_callback
  899. * prototype defines. */
  900. CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
  901. /* Data passed to the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION
  902. callbacks */
  903. CINIT(PROGRESSDATA, OBJECTPOINT, 57),
  904. #define CURLOPT_XFERINFODATA CURLOPT_PROGRESSDATA
  905. /* We want the referrer field set automatically when following locations */
  906. CINIT(AUTOREFERER, LONG, 58),
  907. /* Port of the proxy, can be set in the proxy string as well with:
  908. "[host]:[port]" */
  909. CINIT(PROXYPORT, LONG, 59),
  910. /* size of the POST input data, if strlen() is not good to use */
  911. CINIT(POSTFIELDSIZE, LONG, 60),
  912. /* tunnel non-http operations through a HTTP proxy */
  913. CINIT(HTTPPROXYTUNNEL, LONG, 61),
  914. /* Set the interface string to use as outgoing network interface */
  915. CINIT(INTERFACE, STRINGPOINT, 62),
  916. /* Set the krb4/5 security level, this also enables krb4/5 awareness. This
  917. * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
  918. * is set but doesn't match one of these, 'private' will be used. */
  919. CINIT(KRBLEVEL, STRINGPOINT, 63),
  920. /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
  921. CINIT(SSL_VERIFYPEER, LONG, 64),
  922. /* The CApath or CAfile used to validate the peer certificate
  923. this option is used only if SSL_VERIFYPEER is true */
  924. CINIT(CAINFO, STRINGPOINT, 65),
  925. /* 66 = OBSOLETE */
  926. /* 67 = OBSOLETE */
  927. /* Maximum number of http redirects to follow */
  928. CINIT(MAXREDIRS, LONG, 68),
  929. /* Pass a long set to 1 to get the date of the requested document (if
  930. possible)! Pass a zero to shut it off. */
  931. CINIT(FILETIME, LONG, 69),
  932. /* This points to a linked list of telnet options */
  933. CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
  934. /* Max amount of cached alive connections */
  935. CINIT(MAXCONNECTS, LONG, 71),
  936. CINIT(OBSOLETE72, LONG, 72), /* OBSOLETE, do not use! */
  937. /* 73 = OBSOLETE */
  938. /* Set to explicitly use a new connection for the upcoming transfer.
  939. Do not use this unless you're absolutely sure of this, as it makes the
  940. operation slower and is less friendly for the network. */
  941. CINIT(FRESH_CONNECT, LONG, 74),
  942. /* Set to explicitly forbid the upcoming transfer's connection to be re-used
  943. when done. Do not use this unless you're absolutely sure of this, as it
  944. makes the operation slower and is less friendly for the network. */
  945. CINIT(FORBID_REUSE, LONG, 75),
  946. /* Set to a file name that contains random data for libcurl to use to
  947. seed the random engine when doing SSL connects. */
  948. CINIT(RANDOM_FILE, STRINGPOINT, 76),
  949. /* Set to the Entropy Gathering Daemon socket pathname */
  950. CINIT(EGDSOCKET, STRINGPOINT, 77),
  951. /* Time-out connect operations after this amount of seconds, if connects are
  952. OK within this time, then fine... This only aborts the connect phase. */
  953. CINIT(CONNECTTIMEOUT, LONG, 78),
  954. /* Function that will be called to store headers (instead of fwrite). The
  955. * parameters will use fwrite() syntax, make sure to follow them. */
  956. CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
  957. /* Set this to force the HTTP request to get back to GET. Only really usable
  958. if POST, PUT or a custom request have been used first.
  959. */
  960. CINIT(HTTPGET, LONG, 80),
  961. /* Set if we should verify the Common name from the peer certificate in ssl
  962. * handshake, set 1 to check existence, 2 to ensure that it matches the
  963. * provided hostname. */
  964. CINIT(SSL_VERIFYHOST, LONG, 81),
  965. /* Specify which file name to write all known cookies in after completed
  966. operation. Set file name to "-" (dash) to make it go to stdout. */
  967. CINIT(COOKIEJAR, STRINGPOINT, 82),
  968. /* Specify which SSL ciphers to use */
  969. CINIT(SSL_CIPHER_LIST, STRINGPOINT, 83),
  970. /* Specify which HTTP version to use! This must be set to one of the
  971. CURL_HTTP_VERSION* enums set below. */
  972. CINIT(HTTP_VERSION, LONG, 84),
  973. /* Specifically switch on or off the FTP engine's use of the EPSV command. By
  974. default, that one will always be attempted before the more traditional
  975. PASV command. */
  976. CINIT(FTP_USE_EPSV, LONG, 85),
  977. /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
  978. CINIT(SSLCERTTYPE, STRINGPOINT, 86),
  979. /* name of the file keeping your private SSL-key */
  980. CINIT(SSLKEY, STRINGPOINT, 87),
  981. /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
  982. CINIT(SSLKEYTYPE, STRINGPOINT, 88),
  983. /* crypto engine for the SSL-sub system */
  984. CINIT(SSLENGINE, STRINGPOINT, 89),
  985. /* set the crypto engine for the SSL-sub system as default
  986. the param has no meaning...
  987. */
  988. CINIT(SSLENGINE_DEFAULT, LONG, 90),
  989. /* Non-zero value means to use the global dns cache */
  990. CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */
  991. /* DNS cache timeout */
  992. CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
  993. /* send linked-list of pre-transfer QUOTE commands */
  994. CINIT(PREQUOTE, OBJECTPOINT, 93),
  995. /* set the debug function */
  996. CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
  997. /* set the data for the debug function */
  998. CINIT(DEBUGDATA, OBJECTPOINT, 95),
  999. /* mark this as start of a cookie session */
  1000. CINIT(COOKIESESSION, LONG, 96),
  1001. /* The CApath directory used to validate the peer certificate
  1002. this option is used only if SSL_VERIFYPEER is true */
  1003. CINIT(CAPATH, STRINGPOINT, 97),
  1004. /* Instruct libcurl to use a smaller receive buffer */
  1005. CINIT(BUFFERSIZE, LONG, 98),
  1006. /* Instruct libcurl to not use any signal/alarm handlers, even when using
  1007. timeouts. This option is useful for multi-threaded applications.
  1008. See libcurl-the-guide for more background information. */
  1009. CINIT(NOSIGNAL, LONG, 99),
  1010. /* Provide a CURLShare for mutexing non-ts data */
  1011. CINIT(SHARE, OBJECTPOINT, 100),
  1012. /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
  1013. CURLPROXY_HTTPS, CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and
  1014. CURLPROXY_SOCKS5. */
  1015. CINIT(PROXYTYPE, LONG, 101),
  1016. /* Set the Accept-Encoding string. Use this to tell a server you would like
  1017. the response to be compressed. Before 7.21.6, this was known as
  1018. CURLOPT_ENCODING */
  1019. CINIT(ACCEPT_ENCODING, STRINGPOINT, 102),
  1020. /* Set pointer to private data */
  1021. CINIT(PRIVATE, OBJECTPOINT, 103),
  1022. /* Set aliases for HTTP 200 in the HTTP Response header */
  1023. CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
  1024. /* Continue to send authentication (user+password) when following locations,
  1025. even when hostname changed. This can potentially send off the name
  1026. and password to whatever host the server decides. */
  1027. CINIT(UNRESTRICTED_AUTH, LONG, 105),
  1028. /* Specifically switch on or off the FTP engine's use of the EPRT command (
  1029. it also disables the LPRT attempt). By default, those ones will always be
  1030. attempted before the good old traditional PORT command. */
  1031. CINIT(FTP_USE_EPRT, LONG, 106),
  1032. /* Set this to a bitmask value to enable the particular authentications
  1033. methods you like. Use this in combination with CURLOPT_USERPWD.
  1034. Note that setting multiple bits may cause extra network round-trips. */
  1035. CINIT(HTTPAUTH, LONG, 107),
  1036. /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
  1037. in second argument. The function must be matching the
  1038. curl_ssl_ctx_callback proto. */
  1039. CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
  1040. /* Set the userdata for the ssl context callback function's third
  1041. argument */
  1042. CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
  1043. /* FTP Option that causes missing dirs to be created on the remote server.
  1044. In 7.19.4 we introduced the convenience enums for this option using the
  1045. CURLFTP_CREATE_DIR prefix.
  1046. */
  1047. CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
  1048. /* Set this to a bitmask value to enable the particular authentications
  1049. methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
  1050. Note that setting multiple bits may cause extra network round-trips. */
  1051. CINIT(PROXYAUTH, LONG, 111),
  1052. /* FTP option that changes the timeout, in seconds, associated with
  1053. getting a response. This is different from transfer timeout time and
  1054. essentially places a demand on the FTP server to acknowledge commands
  1055. in a timely manner. */
  1056. CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
  1057. #define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT
  1058. /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
  1059. tell libcurl to resolve names to those IP versions only. This only has
  1060. affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
  1061. CINIT(IPRESOLVE, LONG, 113),
  1062. /* Set this option to limit the size of a file that will be downloaded from
  1063. an HTTP or FTP server.
  1064. Note there is also _LARGE version which adds large file support for
  1065. platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
  1066. CINIT(MAXFILESIZE, LONG, 114),
  1067. /* See the comment for INFILESIZE above, but in short, specifies
  1068. * the size of the file being uploaded. -1 means unknown.
  1069. */
  1070. CINIT(INFILESIZE_LARGE, OFF_T, 115),
  1071. /* Sets the continuation offset. There is also a LONG version of this;
  1072. * look above for RESUME_FROM.
  1073. */
  1074. CINIT(RESUME_FROM_LARGE, OFF_T, 116),
  1075. /* Sets the maximum size of data that will be downloaded from
  1076. * an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
  1077. */
  1078. CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
  1079. /* Set this option to the file name of your .netrc file you want libcurl
  1080. to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
  1081. a poor attempt to find the user's home directory and check for a .netrc
  1082. file in there. */
  1083. CINIT(NETRC_FILE, STRINGPOINT, 118),
  1084. /* Enable SSL/TLS for FTP, pick one of:
  1085. CURLUSESSL_TRY - try using SSL, proceed anyway otherwise
  1086. CURLUSESSL_CONTROL - SSL for the control connection or fail
  1087. CURLUSESSL_ALL - SSL for all communication or fail
  1088. */
  1089. CINIT(USE_SSL, LONG, 119),
  1090. /* The _LARGE version of the standard POSTFIELDSIZE option */
  1091. CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
  1092. /* Enable/disable the TCP Nagle algorithm */
  1093. CINIT(TCP_NODELAY, LONG, 121),
  1094. /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
  1095. /* 123 OBSOLETE. Gone in 7.16.0 */
  1096. /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
  1097. /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
  1098. /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
  1099. /* 127 OBSOLETE. Gone in 7.16.0 */
  1100. /* 128 OBSOLETE. Gone in 7.16.0 */
  1101. /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
  1102. can be used to change libcurl's default action which is to first try
  1103. "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
  1104. response has been received.
  1105. Available parameters are:
  1106. CURLFTPAUTH_DEFAULT - let libcurl decide
  1107. CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
  1108. CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
  1109. */
  1110. CINIT(FTPSSLAUTH, LONG, 129),
  1111. CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
  1112. CINIT(IOCTLDATA, OBJECTPOINT, 131),
  1113. /* 132 OBSOLETE. Gone in 7.16.0 */
  1114. /* 133 OBSOLETE. Gone in 7.16.0 */
  1115. /* zero terminated string for pass on to the FTP server when asked for
  1116. "account" info */
  1117. CINIT(FTP_ACCOUNT, STRINGPOINT, 134),
  1118. /* feed cookie into cookie engine */
  1119. CINIT(COOKIELIST, STRINGPOINT, 135),
  1120. /* ignore Content-Length */
  1121. CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
  1122. /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
  1123. response. Typically used for FTP-SSL purposes but is not restricted to
  1124. that. libcurl will then instead use the same IP address it used for the
  1125. control connection. */
  1126. CINIT(FTP_SKIP_PASV_IP, LONG, 137),
  1127. /* Select "file method" to use when doing FTP, see the curl_ftpmethod
  1128. above. */
  1129. CINIT(FTP_FILEMETHOD, LONG, 138),
  1130. /* Local port number to bind the socket to */
  1131. CINIT(LOCALPORT, LONG, 139),
  1132. /* Number of ports to try, including the first one set with LOCALPORT.
  1133. Thus, setting it to 1 will make no additional attempts but the first.
  1134. */
  1135. CINIT(LOCALPORTRANGE, LONG, 140),
  1136. /* no transfer, set up connection and let application use the socket by
  1137. extracting it with CURLINFO_LASTSOCKET */
  1138. CINIT(CONNECT_ONLY, LONG, 141),
  1139. /* Function that will be called to convert from the
  1140. network encoding (instead of using the iconv calls in libcurl) */
  1141. CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),
  1142. /* Function that will be called to convert to the
  1143. network encoding (instead of using the iconv calls in libcurl) */
  1144. CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),
  1145. /* Function that will be called to convert from UTF8
  1146. (instead of using the iconv calls in libcurl)
  1147. Note that this is used only for SSL certificate processing */
  1148. CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
  1149. /* if the connection proceeds too quickly then need to slow it down */
  1150. /* limit-rate: maximum number of bytes per second to send or receive */
  1151. CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
  1152. CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
  1153. /* Pointer to command string to send if USER/PASS fails. */
  1154. CINIT(FTP_ALTERNATIVE_TO_USER, STRINGPOINT, 147),
  1155. /* callback function for setting socket options */
  1156. CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
  1157. CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
  1158. /* set to 0 to disable session ID re-use for this transfer, default is
  1159. enabled (== 1) */
  1160. CINIT(SSL_SESSIONID_CACHE, LONG, 150),
  1161. /* allowed SSH authentication methods */
  1162. CINIT(SSH_AUTH_TYPES, LONG, 151),
  1163. /* Used by scp/sftp to do public/private key authentication */
  1164. CINIT(SSH_PUBLIC_KEYFILE, STRINGPOINT, 152),
  1165. CINIT(SSH_PRIVATE_KEYFILE, STRINGPOINT, 153),
  1166. /* Send CCC (Clear Command Channel) after authentication */
  1167. CINIT(FTP_SSL_CCC, LONG, 154),
  1168. /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
  1169. CINIT(TIMEOUT_MS, LONG, 155),
  1170. CINIT(CONNECTTIMEOUT_MS, LONG, 156),
  1171. /* set to zero to disable the libcurl's decoding and thus pass the raw body
  1172. data to the application even when it is encoded/compressed */
  1173. CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
  1174. CINIT(HTTP_CONTENT_DECODING, LONG, 158),
  1175. /* Permission used when creating new files and directories on the remote
  1176. server for protocols that support it, SFTP/SCP/FILE */
  1177. CINIT(NEW_FILE_PERMS, LONG, 159),
  1178. CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
  1179. /* Set the behaviour of POST when redirecting. Values must be set to one
  1180. of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
  1181. CINIT(POSTREDIR, LONG, 161),
  1182. /* used by scp/sftp to verify the host's public key */
  1183. CINIT(SSH_HOST_PUBLIC_KEY_MD5, STRINGPOINT, 162),
  1184. /* Callback function for opening socket (instead of socket(2)). Optionally,
  1185. callback is able change the address or refuse to connect returning
  1186. CURL_SOCKET_BAD. The callback should have type
  1187. curl_opensocket_callback */
  1188. CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
  1189. CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
  1190. /* POST volatile input fields. */
  1191. CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),
  1192. /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
  1193. CINIT(PROXY_TRANSFER_MODE, LONG, 166),
  1194. /* Callback function for seeking in the input stream */
  1195. CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
  1196. CINIT(SEEKDATA, OBJECTPOINT, 168),
  1197. /* CRL file */
  1198. CINIT(CRLFILE, STRINGPOINT, 169),
  1199. /* Issuer certificate */
  1200. CINIT(ISSUERCERT, STRINGPOINT, 170),
  1201. /* (IPv6) Address scope */
  1202. CINIT(ADDRESS_SCOPE, LONG, 171),
  1203. /* Collect certificate chain info and allow it to get retrievable with
  1204. CURLINFO_CERTINFO after the transfer is complete. */
  1205. CINIT(CERTINFO, LONG, 172),
  1206. /* "name" and "pwd" to use when fetching. */
  1207. CINIT(USERNAME, STRINGPOINT, 173),
  1208. CINIT(PASSWORD, STRINGPOINT, 174),
  1209. /* "name" and "pwd" to use with Proxy when fetching. */
  1210. CINIT(PROXYUSERNAME, STRINGPOINT, 175),
  1211. CINIT(PROXYPASSWORD, STRINGPOINT, 176),
  1212. /* Comma separated list of hostnames defining no-proxy zones. These should
  1213. match both hostnames directly, and hostnames within a domain. For
  1214. example, local.com will match local.com and www.local.com, but NOT
  1215. notlocal.com or www.notlocal.com. For compatibility with other
  1216. implementations of this, .local.com will be considered to be the same as
  1217. local.com. A single * is the only valid wildcard, and effectively
  1218. disables the use of proxy. */
  1219. CINIT(NOPROXY, STRINGPOINT, 177),
  1220. /* block size for TFTP transfers */
  1221. CINIT(TFTP_BLKSIZE, LONG, 178),
  1222. /* Socks Service */
  1223. CINIT(SOCKS5_GSSAPI_SERVICE, STRINGPOINT, 179), /* DEPRECATED, do not use! */
  1224. /* Socks Service */
  1225. CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
  1226. /* set the bitmask for the protocols that are allowed to be used for the
  1227. transfer, which thus helps the app which takes URLs from users or other
  1228. external inputs and want to restrict what protocol(s) to deal
  1229. with. Defaults to CURLPROTO_ALL. */
  1230. CINIT(PROTOCOLS, LONG, 181),
  1231. /* set the bitmask for the protocols that libcurl is allowed to follow to,
  1232. as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
  1233. to be set in both bitmasks to be allowed to get redirected to. Defaults
  1234. to all protocols except FILE and SCP. */
  1235. CINIT(REDIR_PROTOCOLS, LONG, 182),
  1236. /* set the SSH knownhost file name to use */
  1237. CINIT(SSH_KNOWNHOSTS, STRINGPOINT, 183),
  1238. /* set the SSH host key callback, must point to a curl_sshkeycallback
  1239. function */
  1240. CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),
  1241. /* set the SSH host key callback custom pointer */
  1242. CINIT(SSH_KEYDATA, OBJECTPOINT, 185),
  1243. /* set the SMTP mail originator */
  1244. CINIT(MAIL_FROM, STRINGPOINT, 186),
  1245. /* set the list of SMTP mail receiver(s) */
  1246. CINIT(MAIL_RCPT, OBJECTPOINT, 187),
  1247. /* FTP: send PRET before PASV */
  1248. CINIT(FTP_USE_PRET, LONG, 188),
  1249. /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */
  1250. CINIT(RTSP_REQUEST, LONG, 189),
  1251. /* The RTSP session identifier */
  1252. CINIT(RTSP_SESSION_ID, STRINGPOINT, 190),
  1253. /* The RTSP stream URI */
  1254. CINIT(RTSP_STREAM_URI, STRINGPOINT, 191),
  1255. /* The Transport: header to use in RTSP requests */
  1256. CINIT(RTSP_TRANSPORT, STRINGPOINT, 192),
  1257. /* Manually initialize the client RTSP CSeq for this handle */
  1258. CINIT(RTSP_CLIENT_CSEQ, LONG, 193),
  1259. /* Manually initialize the server RTSP CSeq for this handle */
  1260. CINIT(RTSP_SERVER_CSEQ, LONG, 194),
  1261. /* The stream to pass to INTERLEAVEFUNCTION. */
  1262. CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),
  1263. /* Let the application define a custom write method for RTP data */
  1264. CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),
  1265. /* Turn on wildcard matching */
  1266. CINIT(WILDCARDMATCH, LONG, 197),
  1267. /* Directory matching callback called before downloading of an
  1268. individual file (chunk) started */
  1269. CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),
  1270. /* Directory matching callback called after the file (chunk)
  1271. was downloaded, or skipped */
  1272. CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),
  1273. /* Change match (fnmatch-like) callback for wildcard matching */
  1274. CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),
  1275. /* Let the application define custom chunk data pointer */
  1276. CINIT(CHUNK_DATA, OBJECTPOINT, 201),
  1277. /* FNMATCH_FUNCTION user pointer */
  1278. CINIT(FNMATCH_DATA, OBJECTPOINT, 202),
  1279. /* send linked-list of name:port:address sets */
  1280. CINIT(RESOLVE, OBJECTPOINT, 203),
  1281. /* Set a username for authenticated TLS */
  1282. CINIT(TLSAUTH_USERNAME, STRINGPOINT, 204),
  1283. /* Set a password for authenticated TLS */
  1284. CINIT(TLSAUTH_PASSWORD, STRINGPOINT, 205),
  1285. /* Set authentication type for authenticated TLS */
  1286. CINIT(TLSAUTH_TYPE, STRINGPOINT, 206),
  1287. /* Set to 1 to enable the "TE:" header in HTTP requests to ask for
  1288. compressed transfer-encoded responses. Set to 0 to disable the use of TE:
  1289. in outgoing requests. The current default is 0, but it might change in a
  1290. future libcurl release.
  1291. libcurl will ask for the compressed methods it knows of, and if that
  1292. isn't any, it will not ask for transfer-encoding at all even if this
  1293. option is set to 1.
  1294. */
  1295. CINIT(TRANSFER_ENCODING, LONG, 207),
  1296. /* Callback function for closing socket (instead of close(2)). The callback
  1297. should have type curl_closesocket_callback */
  1298. CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),
  1299. CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),
  1300. /* allow GSSAPI credential delegation */
  1301. CINIT(GSSAPI_DELEGATION, LONG, 210),
  1302. /* Set the name servers to use for DNS resolution */
  1303. CINIT(DNS_SERVERS, STRINGPOINT, 211),
  1304. /* Time-out accept operations (currently for FTP only) after this amount
  1305. of milliseconds. */
  1306. CINIT(ACCEPTTIMEOUT_MS, LONG, 212),
  1307. /* Set TCP keepalive */
  1308. CINIT(TCP_KEEPALIVE, LONG, 213),
  1309. /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */
  1310. CINIT(TCP_KEEPIDLE, LONG, 214),
  1311. CINIT(TCP_KEEPINTVL, LONG, 215),
  1312. /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */
  1313. CINIT(SSL_OPTIONS, LONG, 216),
  1314. /* Set the SMTP auth originator */
  1315. CINIT(MAIL_AUTH, STRINGPOINT, 217),
  1316. /* Enable/disable SASL initial response */
  1317. CINIT(SASL_IR, LONG, 218),
  1318. /* Function that will be called instead of the internal progress display
  1319. * function. This function should be defined as the curl_xferinfo_callback
  1320. * prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */
  1321. CINIT(XFERINFOFUNCTION, FUNCTIONPOINT, 219),
  1322. /* The XOAUTH2 bearer token */
  1323. CINIT(XOAUTH2_BEARER, STRINGPOINT, 220),
  1324. /* Set the interface string to use as outgoing network
  1325. * interface for DNS requests.
  1326. * Only supported by the c-ares DNS backend */
  1327. CINIT(DNS_INTERFACE, STRINGPOINT, 221),
  1328. /* Set the local IPv4 address to use for outgoing DNS requests.
  1329. * Only supported by the c-ares DNS backend */
  1330. CINIT(DNS_LOCAL_IP4, STRINGPOINT, 222),
  1331. /* Set the local IPv4 address to use for outgoing DNS requests.
  1332. * Only supported by the c-ares DNS backend */
  1333. CINIT(DNS_LOCAL_IP6, STRINGPOINT, 223),
  1334. /* Set authentication options directly */
  1335. CINIT(LOGIN_OPTIONS, STRINGPOINT, 224),
  1336. /* Enable/disable TLS NPN extension (http2 over ssl might fail without) */
  1337. CINIT(SSL_ENABLE_NPN, LONG, 225),
  1338. /* Enable/disable TLS ALPN extension (http2 over ssl might fail without) */
  1339. CINIT(SSL_ENABLE_ALPN, LONG, 226),
  1340. /* Time to wait for a response to a HTTP request containing an
  1341. * Expect: 100-continue header before sending the data anyway. */
  1342. CINIT(EXPECT_100_TIMEOUT_MS, LONG, 227),
  1343. /* This points to a linked list of headers used for proxy requests only,
  1344. struct curl_slist kind */
  1345. CINIT(PROXYHEADER, OBJECTPOINT, 228),
  1346. /* Pass in a bitmask of "header options" */
  1347. CINIT(HEADEROPT, LONG, 229),
  1348. /* The public key in DER form used to validate the peer public key
  1349. this option is used only if SSL_VERIFYPEER is true */
  1350. CINIT(PINNEDPUBLICKEY, STRINGPOINT, 230),
  1351. /* Path to Unix domain socket */
  1352. CINIT(UNIX_SOCKET_PATH, STRINGPOINT, 231),
  1353. /* Set if we should verify the certificate status. */
  1354. CINIT(SSL_VERIFYSTATUS, LONG, 232),
  1355. /* Set if we should enable TLS false start. */
  1356. CINIT(SSL_FALSESTART, LONG, 233),
  1357. /* Do not squash dot-dot sequences */
  1358. CINIT(PATH_AS_IS, LONG, 234),
  1359. /* Proxy Service Name */
  1360. CINIT(PROXY_SERVICE_NAME, STRINGPOINT, 235),
  1361. /* Service Name */
  1362. CINIT(SERVICE_NAME, STRINGPOINT, 236),
  1363. /* Wait/don't wait for pipe/mutex to clarify */
  1364. CINIT(PIPEWAIT, LONG, 237),
  1365. /* Set the protocol used when curl is given a URL without a protocol */
  1366. CINIT(DEFAULT_PROTOCOL, STRINGPOINT, 238),
  1367. /* Set stream weight, 1 - 256 (default is 16) */
  1368. CINIT(STREAM_WEIGHT, LONG, 239),
  1369. /* Set stream dependency on another CURL handle */
  1370. CINIT(STREAM_DEPENDS, OBJECTPOINT, 240),
  1371. /* Set E-xclusive stream dependency on another CURL handle */
  1372. CINIT(STREAM_DEPENDS_E, OBJECTPOINT, 241),
  1373. /* Do not send any tftp option requests to the server */
  1374. CINIT(TFTP_NO_OPTIONS, LONG, 242),
  1375. /* Linked-list of host:port:connect-to-host:connect-to-port,
  1376. overrides the URL's host:port (only for the network layer) */
  1377. CINIT(CONNECT_TO, OBJECTPOINT, 243),
  1378. /* Set TCP Fast Open */
  1379. CINIT(TCP_FASTOPEN, LONG, 244),
  1380. /* Continue to send data if the server responds early with an
  1381. * HTTP status code >= 300 */
  1382. CINIT(KEEP_SENDING_ON_ERROR, LONG, 245),
  1383. /* The CApath or CAfile used to validate the proxy certificate
  1384. this option is used only if PROXY_SSL_VERIFYPEER is true */
  1385. CINIT(PROXY_CAINFO, STRINGPOINT, 246),
  1386. /* The CApath directory used to validate the proxy certificate
  1387. this option is used only if PROXY_SSL_VERIFYPEER is true */
  1388. CINIT(PROXY_CAPATH, STRINGPOINT, 247),
  1389. /* Set if we should verify the proxy in ssl handshake,
  1390. set 1 to verify. */
  1391. CINIT(PROXY_SSL_VERIFYPEER, LONG, 248),
  1392. /* Set if we should verify the Common name from the proxy certificate in ssl
  1393. * handshake, set 1 to check existence, 2 to ensure that it matches
  1394. * the provided hostname. */
  1395. CINIT(PROXY_SSL_VERIFYHOST, LONG, 249),
  1396. /* What version to specifically try to use for proxy.
  1397. See CURL_SSLVERSION defines below. */
  1398. CINIT(PROXY_SSLVERSION, LONG, 250),
  1399. /* Set a username for authenticated TLS for proxy */
  1400. CINIT(PROXY_TLSAUTH_USERNAME, STRINGPOINT, 251),
  1401. /* Set a password for authenticated TLS for proxy */
  1402. CINIT(PROXY_TLSAUTH_PASSWORD, STRINGPOINT, 252),
  1403. /* Set authentication type for authenticated TLS for proxy */
  1404. CINIT(PROXY_TLSAUTH_TYPE, STRINGPOINT, 253),
  1405. /* name of the file keeping your private SSL-certificate for proxy */
  1406. CINIT(PROXY_SSLCERT, STRINGPOINT, 254),
  1407. /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") for
  1408. proxy */
  1409. CINIT(PROXY_SSLCERTTYPE, STRINGPOINT, 255),
  1410. /* name of the file keeping your private SSL-key for proxy */
  1411. CINIT(PROXY_SSLKEY, STRINGPOINT, 256),
  1412. /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") for
  1413. proxy */
  1414. CINIT(PROXY_SSLKEYTYPE, STRINGPOINT, 257),
  1415. /* password for the SSL private key for proxy */
  1416. CINIT(PROXY_KEYPASSWD, STRINGPOINT, 258),
  1417. /* Specify which SSL ciphers to use for proxy */
  1418. CINIT(PROXY_SSL_CIPHER_LIST, STRINGPOINT, 259),
  1419. /* CRL file for proxy */
  1420. CINIT(PROXY_CRLFILE, STRINGPOINT, 260),
  1421. /* Enable/disable specific SSL features with a bitmask for proxy, see
  1422. CURLSSLOPT_* */
  1423. CINIT(PROXY_SSL_OPTIONS, LONG, 261),
  1424. /* Name of pre proxy to use. */
  1425. CINIT(PRE_PROXY, STRINGPOINT, 262),
  1426. /* The public key in DER form used to validate the proxy public key
  1427. this option is used only if PROXY_SSL_VERIFYPEER is true */
  1428. CINIT(PROXY_PINNEDPUBLICKEY, STRINGPOINT, 263),
  1429. /* Path to an abstract Unix domain socket */
  1430. CINIT(ABSTRACT_UNIX_SOCKET, STRINGPOINT, 264),
  1431. /* Suppress proxy CONNECT response headers from user callbacks */
  1432. CINIT(SUPPRESS_CONNECT_HEADERS, LONG, 265),
  1433. CURLOPT_LASTENTRY /* the last unused */
  1434. } CURLoption;
  1435. #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
  1436. the obsolete stuff removed! */
  1437. /* Backwards compatibility with older names */
  1438. /* These are scheduled to disappear by 2011 */
  1439. /* This was added in version 7.19.1 */
  1440. #define CURLOPT_POST301 CURLOPT_POSTREDIR
  1441. /* These are scheduled to disappear by 2009 */
  1442. /* The following were added in 7.17.0 */
  1443. #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
  1444. #define CURLOPT_FTPAPPEND CURLOPT_APPEND
  1445. #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
  1446. #define CURLOPT_FTP_SSL CURLOPT_USE_SSL
  1447. /* The following were added earlier */
  1448. #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
  1449. #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
  1450. #else
  1451. /* This is set if CURL_NO_OLDIES is defined at compile-time */
  1452. #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
  1453. #endif
  1454. /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
  1455. name resolves addresses using more than one IP protocol version, this
  1456. option might be handy to force libcurl to use a specific IP version. */
  1457. #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
  1458. versions that your system allows */
  1459. #define CURL_IPRESOLVE_V4 1 /* resolve to IPv4 addresses */
  1460. #define CURL_IPRESOLVE_V6 2 /* resolve to IPv6 addresses */
  1461. /* three convenient "aliases" that follow the name scheme better */
  1462. #define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER
  1463. /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
  1464. enum {
  1465. CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
  1466. like the library to choose the best possible
  1467. for us! */
  1468. CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */
  1469. CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */
  1470. CURL_HTTP_VERSION_2_0, /* please use HTTP 2 in the request */
  1471. CURL_HTTP_VERSION_2TLS, /* use version 2 for HTTPS, version 1.1 for HTTP */
  1472. CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE, /* please use HTTP 2 without HTTP/1.1
  1473. Upgrade */
  1474. CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
  1475. };
  1476. /* Convenience definition simple because the name of the version is HTTP/2 and
  1477. not 2.0. The 2_0 version of the enum name was set while the version was
  1478. still planned to be 2.0 and we stick to it for compatibility. */
  1479. #define CURL_HTTP_VERSION_2 CURL_HTTP_VERSION_2_0
  1480. /*
  1481. * Public API enums for RTSP requests
  1482. */
  1483. enum {
  1484. CURL_RTSPREQ_NONE, /* first in list */
  1485. CURL_RTSPREQ_OPTIONS,
  1486. CURL_RTSPREQ_DESCRIBE,
  1487. CURL_RTSPREQ_ANNOUNCE,
  1488. CURL_RTSPREQ_SETUP,
  1489. CURL_RTSPREQ_PLAY,
  1490. CURL_RTSPREQ_PAUSE,
  1491. CURL_RTSPREQ_TEARDOWN,
  1492. CURL_RTSPREQ_GET_PARAMETER,
  1493. CURL_RTSPREQ_SET_PARAMETER,
  1494. CURL_RTSPREQ_RECORD,
  1495. CURL_RTSPREQ_RECEIVE,
  1496. CURL_RTSPREQ_LAST /* last in list */
  1497. };
  1498. /* These enums are for use with the CURLOPT_NETRC option. */
  1499. enum CURL_NETRC_OPTION {
  1500. CURL_NETRC_IGNORED, /* The .netrc will never be read.
  1501. * This is the default. */
  1502. CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred
  1503. * to one in the .netrc. */
  1504. CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored.
  1505. * Unless one is set programmatically, the .netrc
  1506. * will be queried. */
  1507. CURL_NETRC_LAST
  1508. };
  1509. enum {
  1510. CURL_SSLVERSION_DEFAULT,
  1511. CURL_SSLVERSION_TLSv1, /* TLS 1.x */
  1512. CURL_SSLVERSION_SSLv2,
  1513. CURL_SSLVERSION_SSLv3,
  1514. CURL_SSLVERSION_TLSv1_0,
  1515. CURL_SSLVERSION_TLSv1_1,
  1516. CURL_SSLVERSION_TLSv1_2,
  1517. CURL_SSLVERSION_TLSv1_3,
  1518. CURL_SSLVERSION_LAST /* never use, keep last */
  1519. };
  1520. enum {
  1521. CURL_SSLVERSION_MAX_NONE = 0,
  1522. CURL_SSLVERSION_MAX_DEFAULT = (CURL_SSLVERSION_TLSv1 << 16),
  1523. CURL_SSLVERSION_MAX_TLSv1_0 = (CURL_SSLVERSION_TLSv1_0 << 16),
  1524. CURL_SSLVERSION_MAX_TLSv1_1 = (CURL_SSLVERSION_TLSv1_1 << 16),
  1525. CURL_SSLVERSION_MAX_TLSv1_2 = (CURL_SSLVERSION_TLSv1_2 << 16),
  1526. CURL_SSLVERSION_MAX_TLSv1_3 = (CURL_SSLVERSION_TLSv1_3 << 16),
  1527. /* never use, keep last */
  1528. CURL_SSLVERSION_MAX_LAST = (CURL_SSLVERSION_LAST << 16)
  1529. };
  1530. enum CURL_TLSAUTH {
  1531. CURL_TLSAUTH_NONE,
  1532. CURL_TLSAUTH_SRP,
  1533. CURL_TLSAUTH_LAST /* never use, keep last */
  1534. };
  1535. /* symbols to use with CURLOPT_POSTREDIR.
  1536. CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303
  1537. can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302
  1538. | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */
  1539. #define CURL_REDIR_GET_ALL 0
  1540. #define CURL_REDIR_POST_301 1
  1541. #define CURL_REDIR_POST_302 2
  1542. #define CURL_REDIR_POST_303 4
  1543. #define CURL_REDIR_POST_ALL \
  1544. (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)
  1545. typedef enum {
  1546. CURL_TIMECOND_NONE,
  1547. CURL_TIMECOND_IFMODSINCE,
  1548. CURL_TIMECOND_IFUNMODSINCE,
  1549. CURL_TIMECOND_LASTMOD,
  1550. CURL_TIMECOND_LAST
  1551. } curl_TimeCond;
  1552. /* curl_strequal() and curl_strnequal() are subject for removal in a future
  1553. libcurl, see lib/README.curlx for details
  1554. !checksrc! disable SPACEBEFOREPAREN 2
  1555. */
  1556. CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
  1557. CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
  1558. /* name is uppercase CURLFORM_<name> */
  1559. #ifdef CFINIT
  1560. #undef CFINIT
  1561. #endif
  1562. #ifdef CURL_ISOCPP
  1563. #define CFINIT(name) CURLFORM_ ## name
  1564. #else
  1565. /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
  1566. #define CFINIT(name) CURLFORM_/**/name
  1567. #endif
  1568. typedef enum {
  1569. CFINIT(NOTHING), /********* the first one is unused ************/
  1570. /* */
  1571. CFINIT(COPYNAME),
  1572. CFINIT(PTRNAME),
  1573. CFINIT(NAMELENGTH),
  1574. CFINIT(COPYCONTENTS),
  1575. CFINIT(PTRCONTENTS),
  1576. CFINIT(CONTENTSLENGTH),
  1577. CFINIT(FILECONTENT),
  1578. CFINIT(ARRAY),
  1579. CFINIT(OBSOLETE),
  1580. CFINIT(FILE),
  1581. CFINIT(BUFFER),
  1582. CFINIT(BUFFERPTR),
  1583. CFINIT(BUFFERLENGTH),
  1584. CFINIT(CONTENTTYPE),
  1585. CFINIT(CONTENTHEADER),
  1586. CFINIT(FILENAME),
  1587. CFINIT(END),
  1588. CFINIT(OBSOLETE2),
  1589. CFINIT(STREAM),
  1590. CFINIT(CONTENTLEN), /* added in 7.46.0, provide a curl_off_t length */
  1591. CURLFORM_LASTENTRY /* the last unused */
  1592. } CURLformoption;
  1593. #undef CFINIT /* done */
  1594. /* structure to be used as parameter for CURLFORM_ARRAY */
  1595. struct curl_forms {
  1596. CURLformoption option;
  1597. const char *value;
  1598. };
  1599. /* use this for multipart formpost building */
  1600. /* Returns code for curl_formadd()
  1601. *
  1602. * Returns:
  1603. * CURL_FORMADD_OK on success
  1604. * CURL_FORMADD_MEMORY if the FormInfo allocation fails
  1605. * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
  1606. * CURL_FORMADD_NULL if a null pointer was given for a char
  1607. * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
  1608. * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
  1609. * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
  1610. * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated
  1611. * CURL_FORMADD_MEMORY if some allocation for string copying failed.
  1612. * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
  1613. *
  1614. ***************************************************************************/
  1615. typedef enum {
  1616. CURL_FORMADD_OK, /* first, no error */
  1617. CURL_FORMADD_MEMORY,
  1618. CURL_FORMADD_OPTION_TWICE,
  1619. CURL_FORMADD_NULL,
  1620. CURL_FORMADD_UNKNOWN_OPTION,
  1621. CURL_FORMADD_INCOMPLETE,
  1622. CURL_FORMADD_ILLEGAL_ARRAY,
  1623. CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
  1624. CURL_FORMADD_LAST /* last */
  1625. } CURLFORMcode;
  1626. /*
  1627. * NAME curl_formadd()
  1628. *
  1629. * DESCRIPTION
  1630. *
  1631. * Pretty advanced function for building multi-part formposts. Each invoke
  1632. * adds one part that together construct a full post. Then use
  1633. * CURLOPT_HTTPPOST to send it off to libcurl.
  1634. */
  1635. CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
  1636. struct curl_httppost **last_post,
  1637. ...);
  1638. /*
  1639. * callback function for curl_formget()
  1640. * The void *arg pointer will be the one passed as second argument to
  1641. * curl_formget().
  1642. * The character buffer passed to it must not be freed.
  1643. * Should return the buffer length passed to it as the argument "len" on
  1644. * success.
  1645. */
  1646. typedef size_t (*curl_formget_callback)(void *arg, const char *buf,
  1647. size_t len);
  1648. /*
  1649. * NAME curl_formget()
  1650. *
  1651. * DESCRIPTION
  1652. *
  1653. * Serialize a curl_httppost struct built with curl_formadd().
  1654. * Accepts a void pointer as second argument which will be passed to
  1655. * the curl_formget_callback function.
  1656. * Returns 0 on success.
  1657. */
  1658. CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
  1659. curl_formget_callback append);
  1660. /*
  1661. * NAME curl_formfree()
  1662. *
  1663. * DESCRIPTION
  1664. *
  1665. * Free a multipart formpost previously built with curl_formadd().
  1666. */
  1667. CURL_EXTERN void curl_formfree(struct curl_httppost *form);
  1668. /*
  1669. * NAME curl_getenv()
  1670. *
  1671. * DESCRIPTION
  1672. *
  1673. * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
  1674. * complete. DEPRECATED - see lib/README.curlx
  1675. */
  1676. CURL_EXTERN char *curl_getenv(const char *variable);
  1677. /*
  1678. * NAME curl_version()
  1679. *
  1680. * DESCRIPTION
  1681. *
  1682. * Returns a static ascii string of the libcurl version.
  1683. */
  1684. CURL_EXTERN char *curl_version(void);
  1685. /*
  1686. * NAME curl_easy_escape()
  1687. *
  1688. * DESCRIPTION
  1689. *
  1690. * Escapes URL strings (converts all letters consider illegal in URLs to their
  1691. * %XX versions). This function returns a new allocated string or NULL if an
  1692. * error occurred.
  1693. */
  1694. CURL_EXTERN char *curl_easy_escape(CURL *handle,
  1695. const char *string,
  1696. int length);
  1697. /* the previous version: */
  1698. CURL_EXTERN char *curl_escape(const char *string,
  1699. int length);
  1700. /*
  1701. * NAME curl_easy_unescape()
  1702. *
  1703. * DESCRIPTION
  1704. *
  1705. * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
  1706. * versions). This function returns a new allocated string or NULL if an error
  1707. * occurred.
  1708. * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
  1709. * converted into the host encoding.
  1710. */
  1711. CURL_EXTERN char *curl_easy_unescape(CURL *handle,
  1712. const char *string,
  1713. int length,
  1714. int *outlength);
  1715. /* the previous version */
  1716. CURL_EXTERN char *curl_unescape(const char *string,
  1717. int length);
  1718. /*
  1719. * NAME curl_free()
  1720. *
  1721. * DESCRIPTION
  1722. *
  1723. * Provided for de-allocation in the same translation unit that did the
  1724. * allocation. Added in libcurl 7.10
  1725. */
  1726. CURL_EXTERN void curl_free(void *p);
  1727. /*
  1728. * NAME curl_global_init()
  1729. *
  1730. * DESCRIPTION
  1731. *
  1732. * curl_global_init() should be invoked exactly once for each application that
  1733. * uses libcurl and before any call of other libcurl functions.
  1734. *
  1735. * This function is not thread-safe!
  1736. */
  1737. CURL_EXTERN CURLcode curl_global_init(long flags);
  1738. /*
  1739. * NAME curl_global_init_mem()
  1740. *
  1741. * DESCRIPTION
  1742. *
  1743. * curl_global_init() or curl_global_init_mem() should be invoked exactly once
  1744. * for each application that uses libcurl. This function can be used to
  1745. * initialize libcurl and set user defined memory management callback
  1746. * functions. Users can implement memory management routines to check for
  1747. * memory leaks, check for mis-use of the curl library etc. User registered
  1748. * callback routines with be invoked by this library instead of the system
  1749. * memory management routines like malloc, free etc.
  1750. */
  1751. CURL_EXTERN CURLcode curl_global_init_mem(long flags,
  1752. curl_malloc_callback m,
  1753. curl_free_callback f,
  1754. curl_realloc_callback r,
  1755. curl_strdup_callback s,
  1756. curl_calloc_callback c);
  1757. /*
  1758. * NAME curl_global_cleanup()
  1759. *
  1760. * DESCRIPTION
  1761. *
  1762. * curl_global_cleanup() should be invoked exactly once for each application
  1763. * that uses libcurl
  1764. */
  1765. CURL_EXTERN void curl_global_cleanup(void);
  1766. /* linked-list structure for the CURLOPT_QUOTE option (and other) */
  1767. struct curl_slist {
  1768. char *data;
  1769. struct curl_slist *next;
  1770. };
  1771. /*
  1772. * NAME curl_slist_append()
  1773. *
  1774. * DESCRIPTION
  1775. *
  1776. * Appends a string to a linked list. If no list exists, it will be created
  1777. * first. Returns the new list, after appending.
  1778. */
  1779. CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
  1780. const char *);
  1781. /*
  1782. * NAME curl_slist_free_all()
  1783. *
  1784. * DESCRIPTION
  1785. *
  1786. * free a previously built curl_slist.
  1787. */
  1788. CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
  1789. /*
  1790. * NAME curl_getdate()
  1791. *
  1792. * DESCRIPTION
  1793. *
  1794. * Returns the time, in seconds since 1 Jan 1970 of the time string given in
  1795. * the first argument. The time argument in the second parameter is unused
  1796. * and should be set to NULL.
  1797. */
  1798. CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
  1799. /* info about the certificate chain, only for OpenSSL builds. Asked
  1800. for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
  1801. struct curl_certinfo {
  1802. int num_of_certs; /* number of certificates with information */
  1803. struct curl_slist **certinfo; /* for each index in this array, there's a
  1804. linked list with textual information in the
  1805. format "name: value" */
  1806. };
  1807. /* enum for the different supported SSL backends */
  1808. typedef enum {
  1809. CURLSSLBACKEND_NONE = 0,
  1810. CURLSSLBACKEND_OPENSSL = 1,
  1811. CURLSSLBACKEND_GNUTLS = 2,
  1812. CURLSSLBACKEND_NSS = 3,
  1813. CURLSSLBACKEND_OBSOLETE4 = 4, /* Was QSOSSL. */
  1814. CURLSSLBACKEND_GSKIT = 5,
  1815. CURLSSLBACKEND_POLARSSL = 6,
  1816. CURLSSLBACKEND_CYASSL = 7,
  1817. CURLSSLBACKEND_SCHANNEL = 8,
  1818. CURLSSLBACKEND_DARWINSSL = 9,
  1819. CURLSSLBACKEND_AXTLS = 10,
  1820. CURLSSLBACKEND_MBEDTLS = 11
  1821. } curl_sslbackend;
  1822. /* aliases for library clones and renames */
  1823. #define CURLSSLBACKEND_LIBRESSL 1
  1824. #define CURLSSLBACKEND_BORINGSSL 1
  1825. #define CURLSSLBACKEND_WOLFSSL 6
  1826. /* Information about the SSL library used and the respective internal SSL
  1827. handle, which can be used to obtain further information regarding the
  1828. connection. Asked for with CURLINFO_TLS_SSL_PTR or CURLINFO_TLS_SESSION. */
  1829. struct curl_tlssessioninfo {
  1830. curl_sslbackend backend;
  1831. void *internals;
  1832. };
  1833. #define CURLINFO_STRING 0x100000
  1834. #define CURLINFO_LONG 0x200000
  1835. #define CURLINFO_DOUBLE 0x300000
  1836. #define CURLINFO_SLIST 0x400000
  1837. #define CURLINFO_PTR 0x400000 /* same as SLIST */
  1838. #define CURLINFO_SOCKET 0x500000
  1839. #define CURLINFO_MASK 0x0fffff
  1840. #define CURLINFO_TYPEMASK 0xf00000
  1841. typedef enum {
  1842. CURLINFO_NONE, /* first, never use this */
  1843. CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1,
  1844. CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2,
  1845. CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3,
  1846. CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4,
  1847. CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5,
  1848. CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
  1849. CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7,
  1850. CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8,
  1851. CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9,
  1852. CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10,
  1853. CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11,
  1854. CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12,
  1855. CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13,
  1856. CURLINFO_FILETIME = CURLINFO_LONG + 14,
  1857. CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15,
  1858. CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16,
  1859. CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
  1860. CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18,
  1861. CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19,
  1862. CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20,
  1863. CURLINFO_PRIVATE = CURLINFO_STRING + 21,
  1864. CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22,
  1865. CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23,
  1866. CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24,
  1867. CURLINFO_OS_ERRNO = CURLINFO_LONG + 25,
  1868. CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26,
  1869. CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27,
  1870. CURLINFO_COOKIELIST = CURLINFO_SLIST + 28,
  1871. CURLINFO_LASTSOCKET = CURLINFO_LONG + 29,
  1872. CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30,
  1873. CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31,
  1874. CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32,
  1875. CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33,
  1876. CURLINFO_CERTINFO = CURLINFO_PTR + 34,
  1877. CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35,
  1878. CURLINFO_RTSP_SESSION_ID = CURLINFO_STRING + 36,
  1879. CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG + 37,
  1880. CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG + 38,
  1881. CURLINFO_RTSP_CSEQ_RECV = CURLINFO_LONG + 39,
  1882. CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40,
  1883. CURLINFO_LOCAL_IP = CURLINFO_STRING + 41,
  1884. CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42,
  1885. CURLINFO_TLS_SESSION = CURLINFO_PTR + 43,
  1886. CURLINFO_ACTIVESOCKET = CURLINFO_SOCKET + 44,
  1887. CURLINFO_TLS_SSL_PTR = CURLINFO_PTR + 45,
  1888. CURLINFO_HTTP_VERSION = CURLINFO_LONG + 46,
  1889. CURLINFO_PROXY_SSL_VERIFYRESULT = CURLINFO_LONG + 47,
  1890. CURLINFO_PROTOCOL = CURLINFO_LONG + 48,
  1891. CURLINFO_SCHEME = CURLINFO_STRING + 49,
  1892. /* Fill in new entries below here! */
  1893. CURLINFO_LASTONE = 49
  1894. } CURLINFO;
  1895. /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
  1896. CURLINFO_HTTP_CODE */
  1897. #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
  1898. typedef enum {
  1899. CURLCLOSEPOLICY_NONE, /* first, never use this */
  1900. CURLCLOSEPOLICY_OLDEST,
  1901. CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
  1902. CURLCLOSEPOLICY_LEAST_TRAFFIC,
  1903. CURLCLOSEPOLICY_SLOWEST,
  1904. CURLCLOSEPOLICY_CALLBACK,
  1905. CURLCLOSEPOLICY_LAST /* last, never use this */
  1906. } curl_closepolicy;
  1907. #define CURL_GLOBAL_SSL (1<<0)
  1908. #define CURL_GLOBAL_WIN32 (1<<1)
  1909. #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
  1910. #define CURL_GLOBAL_NOTHING 0
  1911. #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
  1912. #define CURL_GLOBAL_ACK_EINTR (1<<2)
  1913. /*****************************************************************************
  1914. * Setup defines, protos etc for the sharing stuff.
  1915. */
  1916. /* Different data locks for a single share */
  1917. typedef enum {
  1918. CURL_LOCK_DATA_NONE = 0,
  1919. /* CURL_LOCK_DATA_SHARE is used internally to say that
  1920. * the locking is just made to change the internal state of the share
  1921. * itself.
  1922. */
  1923. CURL_LOCK_DATA_SHARE,
  1924. CURL_LOCK_DATA_COOKIE,
  1925. CURL_LOCK_DATA_DNS,
  1926. CURL_LOCK_DATA_SSL_SESSION,
  1927. CURL_LOCK_DATA_CONNECT,
  1928. CURL_LOCK_DATA_LAST
  1929. } curl_lock_data;
  1930. /* Different lock access types */
  1931. typedef enum {
  1932. CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */
  1933. CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
  1934. CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
  1935. CURL_LOCK_ACCESS_LAST /* never use */
  1936. } curl_lock_access;
  1937. typedef void (*curl_lock_function)(CURL *handle,
  1938. curl_lock_data data,
  1939. curl_lock_access locktype,
  1940. void *userptr);
  1941. typedef void (*curl_unlock_function)(CURL *handle,
  1942. curl_lock_data data,
  1943. void *userptr);
  1944. typedef enum {
  1945. CURLSHE_OK, /* all is fine */
  1946. CURLSHE_BAD_OPTION, /* 1 */
  1947. CURLSHE_IN_USE, /* 2 */
  1948. CURLSHE_INVALID, /* 3 */
  1949. CURLSHE_NOMEM, /* 4 out of memory */
  1950. CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */
  1951. CURLSHE_LAST /* never use */
  1952. } CURLSHcode;
  1953. typedef enum {
  1954. CURLSHOPT_NONE, /* don't use */
  1955. CURLSHOPT_SHARE, /* specify a data type to share */
  1956. CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */
  1957. CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */
  1958. CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
  1959. CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock
  1960. callback functions */
  1961. CURLSHOPT_LAST /* never use */
  1962. } CURLSHoption;
  1963. CURL_EXTERN CURLSH *curl_share_init(void);
  1964. CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
  1965. CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
  1966. /****************************************************************************
  1967. * Structures for querying information about the curl library at runtime.
  1968. */
  1969. typedef enum {
  1970. CURLVERSION_FIRST,
  1971. CURLVERSION_SECOND,
  1972. CURLVERSION_THIRD,
  1973. CURLVERSION_FOURTH,
  1974. CURLVERSION_LAST /* never actually use this */
  1975. } CURLversion;
  1976. /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
  1977. basically all programs ever that want to get version information. It is
  1978. meant to be a built-in version number for what kind of struct the caller
  1979. expects. If the struct ever changes, we redefine the NOW to another enum
  1980. from above. */
  1981. #define CURLVERSION_NOW CURLVERSION_FOURTH
  1982. typedef struct {
  1983. CURLversion age; /* age of the returned struct */
  1984. const char *version; /* LIBCURL_VERSION */
  1985. unsigned int version_num; /* LIBCURL_VERSION_NUM */
  1986. const char *host; /* OS/host/cpu/machine when configured */
  1987. int features; /* bitmask, see defines below */
  1988. const char *ssl_version; /* human readable string */
  1989. long ssl_version_num; /* not used anymore, always 0 */
  1990. const char *libz_version; /* human readable string */
  1991. /* protocols is terminated by an entry with a NULL protoname */
  1992. const char * const *protocols;
  1993. /* The fields below this were added in CURLVERSION_SECOND */
  1994. const char *ares;
  1995. int ares_num;
  1996. /* This field was added in CURLVERSION_THIRD */
  1997. const char *libidn;
  1998. /* These field were added in CURLVERSION_FOURTH */
  1999. /* Same as '_libiconv_version' if built with HAVE_ICONV */
  2000. int iconv_ver_num;
  2001. const char *libssh_version; /* human readable string */
  2002. } curl_version_info_data;
  2003. #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */
  2004. #define CURL_VERSION_KERBEROS4 (1<<1) /* Kerberos V4 auth is supported
  2005. (deprecated) */
  2006. #define CURL_VERSION_SSL (1<<2) /* SSL options are present */
  2007. #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */
  2008. #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */
  2009. #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth is supported
  2010. (deprecated) */
  2011. #define CURL_VERSION_DEBUG (1<<6) /* Built with debug capabilities */
  2012. #define CURL_VERSION_ASYNCHDNS (1<<7) /* Asynchronous DNS resolves */
  2013. #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth is supported */
  2014. #define CURL_VERSION_LARGEFILE (1<<9) /* Supports files larger than 2GB */
  2015. #define CURL_VERSION_IDN (1<<10) /* Internationized Domain Names are
  2016. supported */
  2017. #define CURL_VERSION_SSPI (1<<11) /* Built against Windows SSPI */
  2018. #define CURL_VERSION_CONV (1<<12) /* Character conversions supported */
  2019. #define CURL_VERSION_CURLDEBUG (1<<13) /* Debug memory tracking supported */
  2020. #define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */
  2021. #define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegation to winbind helper
  2022. is supported */
  2023. #define CURL_VERSION_HTTP2 (1<<16) /* HTTP2 support built-in */
  2024. #define CURL_VERSION_GSSAPI (1<<17) /* Built against a GSS-API library */
  2025. #define CURL_VERSION_KERBEROS5 (1<<18) /* Kerberos V5 auth is supported */
  2026. #define CURL_VERSION_UNIX_SOCKETS (1<<19) /* Unix domain sockets support */
  2027. #define CURL_VERSION_PSL (1<<20) /* Mozilla's Public Suffix List, used
  2028. for cookie domain verification */
  2029. #define CURL_VERSION_HTTPS_PROXY (1<<21) /* HTTPS-proxy support built-in */
  2030. /*
  2031. * NAME curl_version_info()
  2032. *
  2033. * DESCRIPTION
  2034. *
  2035. * This function returns a pointer to a static copy of the version info
  2036. * struct. See above.
  2037. */
  2038. CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
  2039. /*
  2040. * NAME curl_easy_strerror()
  2041. *
  2042. * DESCRIPTION
  2043. *
  2044. * The curl_easy_strerror function may be used to turn a CURLcode value
  2045. * into the equivalent human readable error string. This is useful
  2046. * for printing meaningful error messages.
  2047. */
  2048. CURL_EXTERN const char *curl_easy_strerror(CURLcode);
  2049. /*
  2050. * NAME curl_share_strerror()
  2051. *
  2052. * DESCRIPTION
  2053. *
  2054. * The curl_share_strerror function may be used to turn a CURLSHcode value
  2055. * into the equivalent human readable error string. This is useful
  2056. * for printing meaningful error messages.
  2057. */
  2058. CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
  2059. /*
  2060. * NAME curl_easy_pause()
  2061. *
  2062. * DESCRIPTION
  2063. *
  2064. * The curl_easy_pause function pauses or unpauses transfers. Select the new
  2065. * state by setting the bitmask, use the convenience defines below.
  2066. *
  2067. */
  2068. CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
  2069. #define CURLPAUSE_RECV (1<<0)
  2070. #define CURLPAUSE_RECV_CONT (0)
  2071. #define CURLPAUSE_SEND (1<<2)
  2072. #define CURLPAUSE_SEND_CONT (0)
  2073. #define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND)
  2074. #define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)
  2075. #ifdef __cplusplus
  2076. }
  2077. #endif
  2078. /* unfortunately, the easy.h and multi.h include files need options and info
  2079. stuff before they can be included! */
  2080. #include "easy.h" /* nothing in curl is fun without the easy stuff */
  2081. #include "multi.h"
  2082. /* the typechecker doesn't work in C++ (yet) */
  2083. #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
  2084. ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
  2085. !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
  2086. #include "typecheck-gcc.h"
  2087. #else
  2088. #if defined(__STDC__) && (__STDC__ >= 1)
  2089. /* This preprocessor magic that replaces a call with the exact same call is
  2090. only done to make sure application authors pass exactly three arguments
  2091. to these functions. */
  2092. #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
  2093. #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
  2094. #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
  2095. #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
  2096. #endif /* __STDC__ >= 1 */
  2097. #endif /* gcc >= 4.3 && !__cplusplus */
  2098. #endif /* __CURL_CURL_H */