curl.h 102 KB

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