Fork me on GitHub

source: svn/trunk/Utilities/FROG/Includes/CURL/curl.h@ 196

Last change on this file since 196 was 95, checked in by severine ovyn, 16 years ago

first commit frog

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