3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
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.
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.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 * $Id: curl.h,v 1.2 2008-09-29 19:47:46 hoffman Exp $
24 ***************************************************************************/
27 * If you have libcurl problems, all docs and details are found here:
28 * http://curl.haxx.se/libcurl/
30 * curl-library mailing list subscription and unsubscription web interface:
31 * http://cool.haxx.se/mailman/listinfo/curl-library/
34 #include "curlver.h" /* libcurl version defines */
35 #include "cmcurl-7.19.0/include/curl/curlbuild.h" /* libcurl build definitions */
36 #include "curlrules.h" /* libcurl rules enforcement */
39 * Define WIN32 when build target is Win32 API
42 #if (defined(_WIN32) || defined(__WIN32__)) && \
43 !defined(WIN32) && !defined(__SYMBIAN32__)
50 /* The include stuff here below is mainly for time_t! */
55 # include <sys/types.h>
57 #endif /* defined (vms) */
59 #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
60 !defined(__CYGWIN__) || defined(__MINGW32__)
61 #if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
62 /* The check above prevents the winsock2 inclusion if winsock.h already was
63 included, since they can't co-exist without problems */
69 /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
70 libc5-based Linux systems. Only include it on system that are known to
72 #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
73 defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY)
74 #include <sys/select.h>
78 #include <sys/socket.h>
80 #if !defined(WIN32) && !defined(__WATCOMC__)
83 #include <sys/types.h>
87 #include <support/SupportDefs.h>
97 * Decorate exportable functions for Win32 and Symbian OS DLL linking.
98 * This avoids using a .def file for building libcurl.dll.
100 #if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \
101 !defined(CURL_STATICLIB)
102 #if defined(BUILDING_LIBCURL)
103 #define CURL_EXTERN __declspec(dllexport)
105 #define CURL_EXTERN __declspec(dllimport)
109 #ifdef CURL_HIDDEN_SYMBOLS
111 * This definition is used to make external definitions visible in the
112 * shared library when symbols are hidden by default. It makes no
113 * difference when compiling applications whether this is set or not,
114 * only when compiling the library.
116 #define CURL_EXTERN CURL_EXTERN_SYMBOL
122 #ifndef curl_socket_typedef
125 typedef SOCKET curl_socket_t
;
126 #define CURL_SOCKET_BAD INVALID_SOCKET
128 typedef int curl_socket_t
;
129 #define CURL_SOCKET_BAD -1
131 #define curl_socket_typedef
132 #endif /* curl_socket_typedef */
134 struct curl_httppost
{
135 struct curl_httppost
*next
; /* next entry in the list */
136 char *name
; /* pointer to allocated name */
137 long namelength
; /* length of name length */
138 char *contents
; /* pointer to allocated data contents */
139 long contentslength
; /* length of contents field */
140 char *buffer
; /* pointer to allocated buffer contents */
141 long bufferlength
; /* length of buffer field */
142 char *contenttype
; /* Content-Type */
143 struct curl_slist
* contentheader
; /* list of extra headers for this form */
144 struct curl_httppost
*more
; /* if one field name has more than one
145 file, this link should link to following
147 long flags
; /* as defined below */
148 #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */
149 #define HTTPPOST_READFILE (1<<1) /* specified content is a file name */
150 #define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer
151 do not free in formfree */
152 #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
153 do not free in formfree */
154 #define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */
155 #define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */
156 #define HTTPPOST_CALLBACK (1<<6) /* upload file contents by using the
157 regular read callback to get the data
158 and pass the given pointer as custom
161 char *showfilename
; /* The file name to show. If not set, the
162 actual file name will be used (if this
164 void *userp
; /* custom pointer used for
165 HTTPPOST_CALLBACK posts */
168 typedef int (*curl_progress_callback
)(void *clientp
,
174 #ifndef CURL_MAX_WRITE_SIZE
175 /* Tests have proven that 20K is a very bad buffer size for uploads on
176 Windows, while 16K for some odd reason performed a lot better.
177 We do the ifndef check to allow this value to easier be changed at build
178 time for those who feel adventurous. */
179 #define CURL_MAX_WRITE_SIZE 16384
181 /* This is a magic return code for the write callback that, when returned,
182 will signal libcurl to pause receiving on the current transfer. */
183 #define CURL_WRITEFUNC_PAUSE 0x10000001
184 typedef size_t (*curl_write_callback
)(char *buffer
,
189 /* This is a return code for the read callback that, when returned, will
190 signal libcurl to immediately abort the current transfer. */
191 #define CURL_READFUNC_ABORT 0x10000000
192 /* This is a return code for the read callback that, when returned, will
193 signal libcurl to pause sending data on the current transfer. */
194 #define CURL_READFUNC_PAUSE 0x10000001
195 typedef int (*curl_seek_callback
)(void *instream
,
197 int origin
); /* 'whence' */
199 typedef size_t (*curl_read_callback
)(char *buffer
,
205 CURLSOCKTYPE_IPCXN
, /* socket created for a specific IP connection */
206 CURLSOCKTYPE_LAST
/* never use */
209 typedef int (*curl_sockopt_callback
)(void *clientp
,
210 curl_socket_t curlfd
,
211 curlsocktype purpose
);
213 struct curl_sockaddr
{
217 unsigned int addrlen
; /* addrlen was a socklen_t type before 7.18.0 but it
218 turned really ugly and painful on the systems that
220 struct sockaddr addr
;
223 typedef curl_socket_t
224 (*curl_opensocket_callback
)(void *clientp
,
225 curlsocktype purpose
,
226 struct curl_sockaddr
*address
);
228 #ifndef CURL_NO_OLDIES
229 /* not used since 7.10.8, will be removed in a future release */
230 typedef int (*curl_passwd_callback
)(void *clientp
,
237 CURLIOE_OK
, /* I/O operation successful */
238 CURLIOE_UNKNOWNCMD
, /* command was unknown to callback */
239 CURLIOE_FAILRESTART
, /* failed to restart the read */
240 CURLIOE_LAST
/* never use */
244 CURLIOCMD_NOP
, /* no operation */
245 CURLIOCMD_RESTARTREAD
, /* restart the read stream from start */
246 CURLIOCMD_LAST
/* never use */
249 typedef curlioerr (*curl_ioctl_callback
)(CURL
*handle
,
254 * The following typedef's are signatures of malloc, free, realloc, strdup and
255 * calloc respectively. Function pointers of these types can be passed to the
256 * curl_global_init_mem() function to set user defined memory management
259 typedef void *(*curl_malloc_callback
)(size_t size
);
260 typedef void (*curl_free_callback
)(void *ptr
);
261 typedef void *(*curl_realloc_callback
)(void *ptr
, size_t size
);
262 typedef char *(*curl_strdup_callback
)(const char *str
);
263 typedef void *(*curl_calloc_callback
)(size_t nmemb
, size_t size
);
265 /* the kind of data that is passed to information_callback*/
268 CURLINFO_HEADER_IN
, /* 1 */
269 CURLINFO_HEADER_OUT
, /* 2 */
270 CURLINFO_DATA_IN
, /* 3 */
271 CURLINFO_DATA_OUT
, /* 4 */
272 CURLINFO_SSL_DATA_IN
, /* 5 */
273 CURLINFO_SSL_DATA_OUT
, /* 6 */
277 typedef int (*curl_debug_callback
)
278 (CURL
*handle
, /* the handle/transfer this concerns */
279 curl_infotype type
, /* what kind of data */
280 char *data
, /* points to the data */
281 size_t size
, /* size of the data pointed to */
282 void *userptr
); /* whatever the user please */
284 /* All possible error codes from all sorts of curl functions. Future versions
285 may return other values, stay prepared.
287 Always add new return codes last. Never *EVER* remove any. The return
288 codes must remain the same!
293 CURLE_UNSUPPORTED_PROTOCOL
, /* 1 */
294 CURLE_FAILED_INIT
, /* 2 */
295 CURLE_URL_MALFORMAT
, /* 3 */
296 CURLE_OBSOLETE4
, /* 4 - NOT USED */
297 CURLE_COULDNT_RESOLVE_PROXY
, /* 5 */
298 CURLE_COULDNT_RESOLVE_HOST
, /* 6 */
299 CURLE_COULDNT_CONNECT
, /* 7 */
300 CURLE_FTP_WEIRD_SERVER_REPLY
, /* 8 */
301 CURLE_REMOTE_ACCESS_DENIED
, /* 9 a service was denied by the server
302 due to lack of access - when login fails
303 this is not returned. */
304 CURLE_OBSOLETE10
, /* 10 - NOT USED */
305 CURLE_FTP_WEIRD_PASS_REPLY
, /* 11 */
306 CURLE_OBSOLETE12
, /* 12 - NOT USED */
307 CURLE_FTP_WEIRD_PASV_REPLY
, /* 13 */
308 CURLE_FTP_WEIRD_227_FORMAT
, /* 14 */
309 CURLE_FTP_CANT_GET_HOST
, /* 15 */
310 CURLE_OBSOLETE16
, /* 16 - NOT USED */
311 CURLE_FTP_COULDNT_SET_TYPE
, /* 17 */
312 CURLE_PARTIAL_FILE
, /* 18 */
313 CURLE_FTP_COULDNT_RETR_FILE
, /* 19 */
314 CURLE_OBSOLETE20
, /* 20 - NOT USED */
315 CURLE_QUOTE_ERROR
, /* 21 - quote command failure */
316 CURLE_HTTP_RETURNED_ERROR
, /* 22 */
317 CURLE_WRITE_ERROR
, /* 23 */
318 CURLE_OBSOLETE24
, /* 24 - NOT USED */
319 CURLE_UPLOAD_FAILED
, /* 25 - failed upload "command" */
320 CURLE_READ_ERROR
, /* 26 - couldn't open/read from file */
321 CURLE_OUT_OF_MEMORY
, /* 27 */
322 /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
323 instead of a memory allocation error if CURL_DOES_CONVERSIONS
326 CURLE_OPERATION_TIMEDOUT
, /* 28 - the timeout time was reached */
327 CURLE_OBSOLETE29
, /* 29 - NOT USED */
328 CURLE_FTP_PORT_FAILED
, /* 30 - FTP PORT operation failed */
329 CURLE_FTP_COULDNT_USE_REST
, /* 31 - the REST command failed */
330 CURLE_OBSOLETE32
, /* 32 - NOT USED */
331 CURLE_RANGE_ERROR
, /* 33 - RANGE "command" didn't work */
332 CURLE_HTTP_POST_ERROR
, /* 34 */
333 CURLE_SSL_CONNECT_ERROR
, /* 35 - wrong when connecting with SSL */
334 CURLE_BAD_DOWNLOAD_RESUME
, /* 36 - couldn't resume download */
335 CURLE_FILE_COULDNT_READ_FILE
, /* 37 */
336 CURLE_LDAP_CANNOT_BIND
, /* 38 */
337 CURLE_LDAP_SEARCH_FAILED
, /* 39 */
338 CURLE_OBSOLETE40
, /* 40 - NOT USED */
339 CURLE_FUNCTION_NOT_FOUND
, /* 41 */
340 CURLE_ABORTED_BY_CALLBACK
, /* 42 */
341 CURLE_BAD_FUNCTION_ARGUMENT
, /* 43 */
342 CURLE_OBSOLETE44
, /* 44 - NOT USED */
343 CURLE_INTERFACE_FAILED
, /* 45 - CURLOPT_INTERFACE failed */
344 CURLE_OBSOLETE46
, /* 46 - NOT USED */
345 CURLE_TOO_MANY_REDIRECTS
, /* 47 - catch endless re-direct loops */
346 CURLE_UNKNOWN_TELNET_OPTION
, /* 48 - User specified an unknown option */
347 CURLE_TELNET_OPTION_SYNTAX
, /* 49 - Malformed telnet option */
348 CURLE_OBSOLETE50
, /* 50 - NOT USED */
349 CURLE_PEER_FAILED_VERIFICATION
, /* 51 - peer's certificate or fingerprint
350 wasn't verified fine */
351 CURLE_GOT_NOTHING
, /* 52 - when this is a specific error */
352 CURLE_SSL_ENGINE_NOTFOUND
, /* 53 - SSL crypto engine not found */
353 CURLE_SSL_ENGINE_SETFAILED
, /* 54 - can not set SSL crypto engine as
355 CURLE_SEND_ERROR
, /* 55 - failed sending network data */
356 CURLE_RECV_ERROR
, /* 56 - failure in receiving network data */
357 CURLE_OBSOLETE57
, /* 57 - NOT IN USE */
358 CURLE_SSL_CERTPROBLEM
, /* 58 - problem with the local certificate */
359 CURLE_SSL_CIPHER
, /* 59 - couldn't use specified cipher */
360 CURLE_SSL_CACERT
, /* 60 - problem with the CA cert (path?) */
361 CURLE_BAD_CONTENT_ENCODING
, /* 61 - Unrecognized transfer encoding */
362 CURLE_LDAP_INVALID_URL
, /* 62 - Invalid LDAP URL */
363 CURLE_FILESIZE_EXCEEDED
, /* 63 - Maximum file size exceeded */
364 CURLE_USE_SSL_FAILED
, /* 64 - Requested FTP SSL level failed */
365 CURLE_SEND_FAIL_REWIND
, /* 65 - Sending the data requires a rewind
367 CURLE_SSL_ENGINE_INITFAILED
, /* 66 - failed to initialise ENGINE */
368 CURLE_LOGIN_DENIED
, /* 67 - user, password or similar was not
369 accepted and we failed to login */
370 CURLE_TFTP_NOTFOUND
, /* 68 - file not found on server */
371 CURLE_TFTP_PERM
, /* 69 - permission problem on server */
372 CURLE_REMOTE_DISK_FULL
, /* 70 - out of disk space on server */
373 CURLE_TFTP_ILLEGAL
, /* 71 - Illegal TFTP operation */
374 CURLE_TFTP_UNKNOWNID
, /* 72 - Unknown transfer ID */
375 CURLE_REMOTE_FILE_EXISTS
, /* 73 - File already exists */
376 CURLE_TFTP_NOSUCHUSER
, /* 74 - No such user */
377 CURLE_CONV_FAILED
, /* 75 - conversion failed */
378 CURLE_CONV_REQD
, /* 76 - caller must register conversion
379 callbacks using curl_easy_setopt options
380 CURLOPT_CONV_FROM_NETWORK_FUNCTION,
381 CURLOPT_CONV_TO_NETWORK_FUNCTION, and
382 CURLOPT_CONV_FROM_UTF8_FUNCTION */
383 CURLE_SSL_CACERT_BADFILE
, /* 77 - could not load CACERT file, missing
385 CURLE_REMOTE_FILE_NOT_FOUND
, /* 78 - remote file not found */
386 CURLE_SSH
, /* 79 - error from the SSH layer, somewhat
387 generic so the error message will be of
388 interest when this has happened */
390 CURLE_SSL_SHUTDOWN_FAILED
, /* 80 - Failed to shut down the SSL
392 CURLE_AGAIN
, /* 81 - socket is not ready for send/recv,
393 wait till it's ready and try again (Added
395 CURLE_SSL_CRL_BADFILE
, /* 82 - could not load CRL file, missing or
396 wrong format (Added in 7.19.0) */
397 CURLE_SSL_ISSUER_ERROR
, /* 83 - Issuer check failed. (Added in
399 CURL_LAST
/* never use! */
402 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
403 the obsolete stuff removed! */
405 /* Backwards compatibility with older names */
407 /* The following were added in 7.17.1 */
408 /* These are scheduled to disappear by 2009 */
409 #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION
411 /* The following were added in 7.17.0 */
412 /* These are scheduled to disappear by 2009 */
413 #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* noone should be using this! */
414 #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
415 #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
416 #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
417 #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
418 #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
419 #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
420 #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
421 #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
422 #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
423 #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
424 #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
425 #define CURLE_URL_MALFORMAT_USER CURLE_OBSOLETE4
427 #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
428 #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
429 #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
430 #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
431 #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
432 #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
433 #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
435 /* The following were added earlier */
437 #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT
439 #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
440 #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
441 #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
443 #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
444 #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
446 /* This was the error code 50 in 7.7.3 and a few earlier versions, this
447 is no longer used by libcurl but is instead #defined here only to not
448 make programs break */
449 #define CURLE_ALREADY_COMPLETE 99999
451 #endif /*!CURL_NO_OLDIES*/
453 /* This prototype applies to all conversion callbacks */
454 typedef CURLcode (*curl_conv_callback
)(char *buffer
, size_t length
);
456 typedef CURLcode (*curl_ssl_ctx_callback
)(CURL
*curl
, /* easy handle */
457 void *ssl_ctx
, /* actually an
462 CURLPROXY_HTTP
= 0, /* added in 7.10 */
463 CURLPROXY_SOCKS4
= 4, /* support added in 7.15.2, enum existed already
465 CURLPROXY_SOCKS5
= 5, /* added in 7.10 */
466 CURLPROXY_SOCKS4A
= 6, /* added in 7.18.0 */
467 CURLPROXY_SOCKS5_HOSTNAME
= 7 /* Use the SOCKS5 protocol but pass along the
468 host name rather than the IP address. added
470 } curl_proxytype
; /* this enum was added in 7.10 */
472 #define CURLAUTH_NONE 0 /* nothing */
473 #define CURLAUTH_BASIC (1<<0) /* Basic (default) */
474 #define CURLAUTH_DIGEST (1<<1) /* Digest */
475 #define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */
476 #define CURLAUTH_NTLM (1<<3) /* NTLM */
477 #define CURLAUTH_ANY ~0 /* all types set */
478 #define CURLAUTH_ANYSAFE (~CURLAUTH_BASIC)
480 #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */
481 #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */
482 #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
483 #define CURLSSH_AUTH_PASSWORD (1<<1) /* password */
484 #define CURLSSH_AUTH_HOST (1<<2) /* host key files */
485 #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */
486 #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
488 #define CURL_ERROR_SIZE 256
490 /* parameter for the CURLOPT_USE_SSL option */
492 CURLUSESSL_NONE
, /* do not attempt to use SSL */
493 CURLUSESSL_TRY
, /* try using SSL, proceed anyway otherwise */
494 CURLUSESSL_CONTROL
, /* SSL for the control connection or fail */
495 CURLUSESSL_ALL
, /* SSL for all communication or fail */
496 CURLUSESSL_LAST
/* not an option, never use */
499 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
500 the obsolete stuff removed! */
502 /* Backwards compatibility with older names */
503 /* These are scheduled to disappear by 2009 */
505 #define CURLFTPSSL_NONE CURLUSESSL_NONE
506 #define CURLFTPSSL_TRY CURLUSESSL_TRY
507 #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
508 #define CURLFTPSSL_ALL CURLUSESSL_ALL
509 #define CURLFTPSSL_LAST CURLUSESSL_LAST
510 #define curl_ftpssl curl_usessl
511 #endif /*!CURL_NO_OLDIES*/
513 /* parameter for the CURLOPT_FTP_SSL_CCC option */
515 CURLFTPSSL_CCC_NONE
, /* do not send CCC */
516 CURLFTPSSL_CCC_PASSIVE
, /* Let the server initiate the shutdown */
517 CURLFTPSSL_CCC_ACTIVE
, /* Initiate the shutdown */
518 CURLFTPSSL_CCC_LAST
/* not an option, never use */
521 /* parameter for the CURLOPT_FTPSSLAUTH option */
523 CURLFTPAUTH_DEFAULT
, /* let libcurl decide */
524 CURLFTPAUTH_SSL
, /* use "AUTH SSL" */
525 CURLFTPAUTH_TLS
, /* use "AUTH TLS" */
526 CURLFTPAUTH_LAST
/* not an option, never use */
529 /* parameter for the CURLOPT_FTP_FILEMETHOD option */
531 CURLFTPMETHOD_DEFAULT
, /* let libcurl pick */
532 CURLFTPMETHOD_MULTICWD
, /* single CWD operation for each path part */
533 CURLFTPMETHOD_NOCWD
, /* no CWD at all */
534 CURLFTPMETHOD_SINGLECWD
, /* one CWD to full dir, then work on file */
535 CURLFTPMETHOD_LAST
/* not an option, never use */
538 /* long may be 32 or 64 bits, but we should never depend on anything else
540 #define CURLOPTTYPE_LONG 0
541 #define CURLOPTTYPE_OBJECTPOINT 10000
542 #define CURLOPTTYPE_FUNCTIONPOINT 20000
543 #define CURLOPTTYPE_OFF_T 30000
545 /* name is uppercase CURLOPT_<name>,
546 type is one of the defined CURLOPTTYPE_<type>
547 number is unique identifier */
553 #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
555 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
556 #define LONG CURLOPTTYPE_LONG
557 #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
558 #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
559 #define OFF_T CURLOPTTYPE_OFF_T
560 #define CINIT(name,type,number) CURLOPT_/**/name = type + number
564 * This macro-mania below setups the CURLOPT_[what] enum, to be used with
565 * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
570 /* This is the FILE * or void * the regular output should be written to. */
571 CINIT(FILE, OBJECTPOINT
, 1),
573 /* The full URL to get/put */
574 CINIT(URL
, OBJECTPOINT
, 2),
576 /* Port number to connect to, if other than default. */
577 CINIT(PORT
, LONG
, 3),
579 /* Name of proxy to use. */
580 CINIT(PROXY
, OBJECTPOINT
, 4),
582 /* "name:password" to use when fetching. */
583 CINIT(USERPWD
, OBJECTPOINT
, 5),
585 /* "name:password" to use with proxy. */
586 CINIT(PROXYUSERPWD
, OBJECTPOINT
, 6),
588 /* Range to get, specified as an ASCII string. */
589 CINIT(RANGE
, OBJECTPOINT
, 7),
593 /* Specified file stream to upload from (use as input): */
594 CINIT(INFILE
, OBJECTPOINT
, 9),
596 /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
597 * bytes big. If this is not used, error messages go to stderr instead: */
598 CINIT(ERRORBUFFER
, OBJECTPOINT
, 10),
600 /* Function that will be called to store the output (instead of fwrite). The
601 * parameters will use fwrite() syntax, make sure to follow them. */
602 CINIT(WRITEFUNCTION
, FUNCTIONPOINT
, 11),
604 /* Function that will be called to read the input (instead of fread). The
605 * parameters will use fread() syntax, make sure to follow them. */
606 CINIT(READFUNCTION
, FUNCTIONPOINT
, 12),
608 /* Time-out the read operation after this amount of seconds */
609 CINIT(TIMEOUT
, LONG
, 13),
611 /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
612 * how large the file being sent really is. That allows better error
613 * checking and better verifies that the upload was successful. -1 means
616 * For large file support, there is also a _LARGE version of the key
617 * which takes an off_t type, allowing platforms with larger off_t
618 * sizes to handle larger files. See below for INFILESIZE_LARGE.
620 CINIT(INFILESIZE
, LONG
, 14),
622 /* POST static input fields. */
623 CINIT(POSTFIELDS
, OBJECTPOINT
, 15),
625 /* Set the referrer page (needed by some CGIs) */
626 CINIT(REFERER
, OBJECTPOINT
, 16),
628 /* Set the FTP PORT string (interface name, named or numerical IP address)
629 Use i.e '-' to use default address. */
630 CINIT(FTPPORT
, OBJECTPOINT
, 17),
632 /* Set the User-Agent string (examined by some CGIs) */
633 CINIT(USERAGENT
, OBJECTPOINT
, 18),
635 /* If the download receives less than "low speed limit" bytes/second
636 * during "low speed time" seconds, the operations is aborted.
637 * You could i.e if you have a pretty high speed connection, abort if
638 * it is less than 2000 bytes/sec during 20 seconds.
641 /* Set the "low speed limit" */
642 CINIT(LOW_SPEED_LIMIT
, LONG
, 19),
644 /* Set the "low speed time" */
645 CINIT(LOW_SPEED_TIME
, LONG
, 20),
647 /* Set the continuation offset.
649 * Note there is also a _LARGE version of this key which uses
650 * off_t types, allowing for large file offsets on platforms which
651 * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
653 CINIT(RESUME_FROM
, LONG
, 21),
655 /* Set cookie in request: */
656 CINIT(COOKIE
, OBJECTPOINT
, 22),
658 /* This points to a linked list of headers, struct curl_slist kind */
659 CINIT(HTTPHEADER
, OBJECTPOINT
, 23),
661 /* This points to a linked list of post entries, struct curl_httppost */
662 CINIT(HTTPPOST
, OBJECTPOINT
, 24),
664 /* name of the file keeping your private SSL-certificate */
665 CINIT(SSLCERT
, OBJECTPOINT
, 25),
667 /* password for the SSL or SSH private key */
668 CINIT(KEYPASSWD
, OBJECTPOINT
, 26),
670 /* send TYPE parameter? */
671 CINIT(CRLF
, LONG
, 27),
673 /* send linked-list of QUOTE commands */
674 CINIT(QUOTE
, OBJECTPOINT
, 28),
676 /* send FILE * or void * to store headers to, if you use a callback it
677 is simply passed to the callback unmodified */
678 CINIT(WRITEHEADER
, OBJECTPOINT
, 29),
680 /* point to a file to read the initial cookies from, also enables
681 "cookie awareness" */
682 CINIT(COOKIEFILE
, OBJECTPOINT
, 31),
684 /* What version to specifically try to use.
685 See CURL_SSLVERSION defines below. */
686 CINIT(SSLVERSION
, LONG
, 32),
688 /* What kind of HTTP time condition to use, see defines */
689 CINIT(TIMECONDITION
, LONG
, 33),
691 /* Time to use with the above condition. Specified in number of seconds
693 CINIT(TIMEVALUE
, LONG
, 34),
697 /* Custom request, for customizing the get command like
698 HTTP: DELETE, TRACE and others
699 FTP: to use a different list command
701 CINIT(CUSTOMREQUEST
, OBJECTPOINT
, 36),
703 /* HTTP request, for odd commands like DELETE, TRACE and others */
704 CINIT(STDERR
, OBJECTPOINT
, 37),
708 /* send linked-list of post-transfer QUOTE commands */
709 CINIT(POSTQUOTE
, OBJECTPOINT
, 39),
711 /* Pass a pointer to string of the output using full variable-replacement
712 as described elsewhere. */
713 CINIT(WRITEINFO
, OBJECTPOINT
, 40),
715 CINIT(VERBOSE
, LONG
, 41), /* talk a lot */
716 CINIT(HEADER
, LONG
, 42), /* throw the header out too */
717 CINIT(NOPROGRESS
, LONG
, 43), /* shut off the progress meter */
718 CINIT(NOBODY
, LONG
, 44), /* use HEAD to get http document */
719 CINIT(FAILONERROR
, LONG
, 45), /* no output on http error codes >= 300 */
720 CINIT(UPLOAD
, LONG
, 46), /* this is an upload */
721 CINIT(POST
, LONG
, 47), /* HTTP POST method */
722 CINIT(DIRLISTONLY
, LONG
, 48), /* return bare names when listing directories */
724 CINIT(APPEND
, LONG
, 50), /* Append instead of overwrite on upload! */
726 /* Specify whether to read the user+password from the .netrc or the URL.
727 * This must be one of the CURL_NETRC_* enums below. */
728 CINIT(NETRC
, LONG
, 51),
730 CINIT(FOLLOWLOCATION
, LONG
, 52), /* use Location: Luke! */
732 CINIT(TRANSFERTEXT
, LONG
, 53), /* transfer data in text/ASCII format */
733 CINIT(PUT
, LONG
, 54), /* HTTP PUT */
737 /* Function that will be called instead of the internal progress display
738 * function. This function should be defined as the curl_progress_callback
739 * prototype defines. */
740 CINIT(PROGRESSFUNCTION
, FUNCTIONPOINT
, 56),
742 /* Data passed to the progress callback */
743 CINIT(PROGRESSDATA
, OBJECTPOINT
, 57),
745 /* We want the referrer field set automatically when following locations */
746 CINIT(AUTOREFERER
, LONG
, 58),
748 /* Port of the proxy, can be set in the proxy string as well with:
750 CINIT(PROXYPORT
, LONG
, 59),
752 /* size of the POST input data, if strlen() is not good to use */
753 CINIT(POSTFIELDSIZE
, LONG
, 60),
755 /* tunnel non-http operations through a HTTP proxy */
756 CINIT(HTTPPROXYTUNNEL
, LONG
, 61),
758 /* Set the interface string to use as outgoing network interface */
759 CINIT(INTERFACE
, OBJECTPOINT
, 62),
761 /* Set the krb4/5 security level, this also enables krb4/5 awareness. This
762 * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
763 * is set but doesn't match one of these, 'private' will be used. */
764 CINIT(KRBLEVEL
, OBJECTPOINT
, 63),
766 /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
767 CINIT(SSL_VERIFYPEER
, LONG
, 64),
769 /* The CApath or CAfile used to validate the peer certificate
770 this option is used only if SSL_VERIFYPEER is true */
771 CINIT(CAINFO
, OBJECTPOINT
, 65),
776 /* Maximum number of http redirects to follow */
777 CINIT(MAXREDIRS
, LONG
, 68),
779 /* Pass a long set to 1 to get the date of the requested document (if
780 possible)! Pass a zero to shut it off. */
781 CINIT(FILETIME
, LONG
, 69),
783 /* This points to a linked list of telnet options */
784 CINIT(TELNETOPTIONS
, OBJECTPOINT
, 70),
786 /* Max amount of cached alive connections */
787 CINIT(MAXCONNECTS
, LONG
, 71),
789 /* What policy to use when closing connections when the cache is filled
791 CINIT(CLOSEPOLICY
, LONG
, 72),
795 /* Set to explicitly use a new connection for the upcoming transfer.
796 Do not use this unless you're absolutely sure of this, as it makes the
797 operation slower and is less friendly for the network. */
798 CINIT(FRESH_CONNECT
, LONG
, 74),
800 /* Set to explicitly forbid the upcoming transfer's connection to be re-used
801 when done. Do not use this unless you're absolutely sure of this, as it
802 makes the operation slower and is less friendly for the network. */
803 CINIT(FORBID_REUSE
, LONG
, 75),
805 /* Set to a file name that contains random data for libcurl to use to
806 seed the random engine when doing SSL connects. */
807 CINIT(RANDOM_FILE
, OBJECTPOINT
, 76),
809 /* Set to the Entropy Gathering Daemon socket pathname */
810 CINIT(EGDSOCKET
, OBJECTPOINT
, 77),
812 /* Time-out connect operations after this amount of seconds, if connects
813 are OK within this time, then fine... This only aborts the connect
814 phase. [Only works on unix-style/SIGALRM operating systems] */
815 CINIT(CONNECTTIMEOUT
, LONG
, 78),
817 /* Function that will be called to store headers (instead of fwrite). The
818 * parameters will use fwrite() syntax, make sure to follow them. */
819 CINIT(HEADERFUNCTION
, FUNCTIONPOINT
, 79),
821 /* Set this to force the HTTP request to get back to GET. Only really usable
822 if POST, PUT or a custom request have been used first.
824 CINIT(HTTPGET
, LONG
, 80),
826 /* Set if we should verify the Common name from the peer certificate in ssl
827 * handshake, set 1 to check existence, 2 to ensure that it matches the
828 * provided hostname. */
829 CINIT(SSL_VERIFYHOST
, LONG
, 81),
831 /* Specify which file name to write all known cookies in after completed
832 operation. Set file name to "-" (dash) to make it go to stdout. */
833 CINIT(COOKIEJAR
, OBJECTPOINT
, 82),
835 /* Specify which SSL ciphers to use */
836 CINIT(SSL_CIPHER_LIST
, OBJECTPOINT
, 83),
838 /* Specify which HTTP version to use! This must be set to one of the
839 CURL_HTTP_VERSION* enums set below. */
840 CINIT(HTTP_VERSION
, LONG
, 84),
842 /* Specifically switch on or off the FTP engine's use of the EPSV command. By
843 default, that one will always be attempted before the more traditional
845 CINIT(FTP_USE_EPSV
, LONG
, 85),
847 /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
848 CINIT(SSLCERTTYPE
, OBJECTPOINT
, 86),
850 /* name of the file keeping your private SSL-key */
851 CINIT(SSLKEY
, OBJECTPOINT
, 87),
853 /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
854 CINIT(SSLKEYTYPE
, OBJECTPOINT
, 88),
856 /* crypto engine for the SSL-sub system */
857 CINIT(SSLENGINE
, OBJECTPOINT
, 89),
859 /* set the crypto engine for the SSL-sub system as default
860 the param has no meaning...
862 CINIT(SSLENGINE_DEFAULT
, LONG
, 90),
864 /* Non-zero value means to use the global dns cache */
865 CINIT(DNS_USE_GLOBAL_CACHE
, LONG
, 91), /* To become OBSOLETE soon */
867 /* DNS cache timeout */
868 CINIT(DNS_CACHE_TIMEOUT
, LONG
, 92),
870 /* send linked-list of pre-transfer QUOTE commands (Wesley Laxton)*/
871 CINIT(PREQUOTE
, OBJECTPOINT
, 93),
873 /* set the debug function */
874 CINIT(DEBUGFUNCTION
, FUNCTIONPOINT
, 94),
876 /* set the data for the debug function */
877 CINIT(DEBUGDATA
, OBJECTPOINT
, 95),
879 /* mark this as start of a cookie session */
880 CINIT(COOKIESESSION
, LONG
, 96),
882 /* The CApath directory used to validate the peer certificate
883 this option is used only if SSL_VERIFYPEER is true */
884 CINIT(CAPATH
, OBJECTPOINT
, 97),
886 /* Instruct libcurl to use a smaller receive buffer */
887 CINIT(BUFFERSIZE
, LONG
, 98),
889 /* Instruct libcurl to not use any signal/alarm handlers, even when using
890 timeouts. This option is useful for multi-threaded applications.
891 See libcurl-the-guide for more background information. */
892 CINIT(NOSIGNAL
, LONG
, 99),
894 /* Provide a CURLShare for mutexing non-ts data */
895 CINIT(SHARE
, OBJECTPOINT
, 100),
897 /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
898 CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
899 CINIT(PROXYTYPE
, LONG
, 101),
901 /* Set the Accept-Encoding string. Use this to tell a server you would like
902 the response to be compressed. */
903 CINIT(ENCODING
, OBJECTPOINT
, 102),
905 /* Set pointer to private data */
906 CINIT(PRIVATE
, OBJECTPOINT
, 103),
908 /* Set aliases for HTTP 200 in the HTTP Response header */
909 CINIT(HTTP200ALIASES
, OBJECTPOINT
, 104),
911 /* Continue to send authentication (user+password) when following locations,
912 even when hostname changed. This can potentially send off the name
913 and password to whatever host the server decides. */
914 CINIT(UNRESTRICTED_AUTH
, LONG
, 105),
916 /* Specifically switch on or off the FTP engine's use of the EPRT command ( it
917 also disables the LPRT attempt). By default, those ones will always be
918 attempted before the good old traditional PORT command. */
919 CINIT(FTP_USE_EPRT
, LONG
, 106),
921 /* Set this to a bitmask value to enable the particular authentications
922 methods you like. Use this in combination with CURLOPT_USERPWD.
923 Note that setting multiple bits may cause extra network round-trips. */
924 CINIT(HTTPAUTH
, LONG
, 107),
926 /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
927 in second argument. The function must be matching the
928 curl_ssl_ctx_callback proto. */
929 CINIT(SSL_CTX_FUNCTION
, FUNCTIONPOINT
, 108),
931 /* Set the userdata for the ssl context callback function's third
933 CINIT(SSL_CTX_DATA
, OBJECTPOINT
, 109),
935 /* FTP Option that causes missing dirs to be created on the remote server */
936 CINIT(FTP_CREATE_MISSING_DIRS
, LONG
, 110),
938 /* Set this to a bitmask value to enable the particular authentications
939 methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
940 Note that setting multiple bits may cause extra network round-trips. */
941 CINIT(PROXYAUTH
, LONG
, 111),
943 /* FTP option that changes the timeout, in seconds, associated with
944 getting a response. This is different from transfer timeout time and
945 essentially places a demand on the FTP server to acknowledge commands
946 in a timely manner. */
947 CINIT(FTP_RESPONSE_TIMEOUT
, LONG
, 112),
949 /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
950 tell libcurl to resolve names to those IP versions only. This only has
951 affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
952 CINIT(IPRESOLVE
, LONG
, 113),
954 /* Set this option to limit the size of a file that will be downloaded from
955 an HTTP or FTP server.
957 Note there is also _LARGE version which adds large file support for
958 platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
959 CINIT(MAXFILESIZE
, LONG
, 114),
961 /* See the comment for INFILESIZE above, but in short, specifies
962 * the size of the file being uploaded. -1 means unknown.
964 CINIT(INFILESIZE_LARGE
, OFF_T
, 115),
966 /* Sets the continuation offset. There is also a LONG version of this;
967 * look above for RESUME_FROM.
969 CINIT(RESUME_FROM_LARGE
, OFF_T
, 116),
971 /* Sets the maximum size of data that will be downloaded from
972 * an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
974 CINIT(MAXFILESIZE_LARGE
, OFF_T
, 117),
976 /* Set this option to the file name of your .netrc file you want libcurl
977 to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
978 a poor attempt to find the user's home directory and check for a .netrc
980 CINIT(NETRC_FILE
, OBJECTPOINT
, 118),
982 /* Enable SSL/TLS for FTP, pick one of:
983 CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise
984 CURLFTPSSL_CONTROL - SSL for the control connection or fail
985 CURLFTPSSL_ALL - SSL for all communication or fail
987 CINIT(USE_SSL
, LONG
, 119),
989 /* The _LARGE version of the standard POSTFIELDSIZE option */
990 CINIT(POSTFIELDSIZE_LARGE
, OFF_T
, 120),
992 /* Enable/disable the TCP Nagle algorithm */
993 CINIT(TCP_NODELAY
, LONG
, 121),
995 /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
996 /* 123 OBSOLETE. Gone in 7.16.0 */
997 /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
998 /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
999 /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1000 /* 127 OBSOLETE. Gone in 7.16.0 */
1001 /* 128 OBSOLETE. Gone in 7.16.0 */
1003 /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
1004 can be used to change libcurl's default action which is to first try
1005 "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
1006 response has been received.
1008 Available parameters are:
1009 CURLFTPAUTH_DEFAULT - let libcurl decide
1010 CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
1011 CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
1013 CINIT(FTPSSLAUTH
, LONG
, 129),
1015 CINIT(IOCTLFUNCTION
, FUNCTIONPOINT
, 130),
1016 CINIT(IOCTLDATA
, OBJECTPOINT
, 131),
1018 /* 132 OBSOLETE. Gone in 7.16.0 */
1019 /* 133 OBSOLETE. Gone in 7.16.0 */
1021 /* zero terminated string for pass on to the FTP server when asked for
1023 CINIT(FTP_ACCOUNT
, OBJECTPOINT
, 134),
1025 /* feed cookies into cookie engine */
1026 CINIT(COOKIELIST
, OBJECTPOINT
, 135),
1028 /* ignore Content-Length */
1029 CINIT(IGNORE_CONTENT_LENGTH
, LONG
, 136),
1031 /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
1032 response. Typically used for FTP-SSL purposes but is not restricted to
1033 that. libcurl will then instead use the same IP address it used for the
1034 control connection. */
1035 CINIT(FTP_SKIP_PASV_IP
, LONG
, 137),
1037 /* Select "file method" to use when doing FTP, see the curl_ftpmethod
1039 CINIT(FTP_FILEMETHOD
, LONG
, 138),
1041 /* Local port number to bind the socket to */
1042 CINIT(LOCALPORT
, LONG
, 139),
1044 /* Number of ports to try, including the first one set with LOCALPORT.
1045 Thus, setting it to 1 will make no additional attempts but the first.
1047 CINIT(LOCALPORTRANGE
, LONG
, 140),
1049 /* no transfer, set up connection and let application use the socket by
1050 extracting it with CURLINFO_LASTSOCKET */
1051 CINIT(CONNECT_ONLY
, LONG
, 141),
1053 /* Function that will be called to convert from the
1054 network encoding (instead of using the iconv calls in libcurl) */
1055 CINIT(CONV_FROM_NETWORK_FUNCTION
, FUNCTIONPOINT
, 142),
1057 /* Function that will be called to convert to the
1058 network encoding (instead of using the iconv calls in libcurl) */
1059 CINIT(CONV_TO_NETWORK_FUNCTION
, FUNCTIONPOINT
, 143),
1061 /* Function that will be called to convert from UTF8
1062 (instead of using the iconv calls in libcurl)
1063 Note that this is used only for SSL certificate processing */
1064 CINIT(CONV_FROM_UTF8_FUNCTION
, FUNCTIONPOINT
, 144),
1066 /* if the connection proceeds too quickly then need to slow it down */
1067 /* limit-rate: maximum number of bytes per second to send or receive */
1068 CINIT(MAX_SEND_SPEED_LARGE
, OFF_T
, 145),
1069 CINIT(MAX_RECV_SPEED_LARGE
, OFF_T
, 146),
1071 /* Pointer to command string to send if USER/PASS fails. */
1072 CINIT(FTP_ALTERNATIVE_TO_USER
, OBJECTPOINT
, 147),
1074 /* callback function for setting socket options */
1075 CINIT(SOCKOPTFUNCTION
, FUNCTIONPOINT
, 148),
1076 CINIT(SOCKOPTDATA
, OBJECTPOINT
, 149),
1078 /* set to 0 to disable session ID re-use for this transfer, default is
1080 CINIT(SSL_SESSIONID_CACHE
, LONG
, 150),
1082 /* allowed SSH authentication methods */
1083 CINIT(SSH_AUTH_TYPES
, LONG
, 151),
1085 /* Used by scp/sftp to do public/private key authentication */
1086 CINIT(SSH_PUBLIC_KEYFILE
, OBJECTPOINT
, 152),
1087 CINIT(SSH_PRIVATE_KEYFILE
, OBJECTPOINT
, 153),
1089 /* Send CCC (Clear Command Channel) after authentication */
1090 CINIT(FTP_SSL_CCC
, LONG
, 154),
1092 /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
1093 CINIT(TIMEOUT_MS
, LONG
, 155),
1094 CINIT(CONNECTTIMEOUT_MS
, LONG
, 156),
1096 /* set to zero to disable the libcurl's decoding and thus pass the raw body
1097 data to the application even when it is encoded/compressed */
1098 CINIT(HTTP_TRANSFER_DECODING
, LONG
, 157),
1099 CINIT(HTTP_CONTENT_DECODING
, LONG
, 158),
1101 /* Permission used when creating new files and directories on the remote
1102 server for protocols that support it, SFTP/SCP/FILE */
1103 CINIT(NEW_FILE_PERMS
, LONG
, 159),
1104 CINIT(NEW_DIRECTORY_PERMS
, LONG
, 160),
1106 /* Obey RFC 2616/10.3.2 and keep POSTs as POSTs after a 301 */
1107 CINIT(POST301
, LONG
, 161),
1109 /* used by scp/sftp to verify the host's public key */
1110 CINIT(SSH_HOST_PUBLIC_KEY_MD5
, OBJECTPOINT
, 162),
1112 /* Callback function for opening socket (instead of socket(2)). Optionally,
1113 callback is able change the address or refuse to connect returning
1114 CURL_SOCKET_BAD. The callback should have type
1115 curl_opensocket_callback */
1116 CINIT(OPENSOCKETFUNCTION
, FUNCTIONPOINT
, 163),
1117 CINIT(OPENSOCKETDATA
, OBJECTPOINT
, 164),
1119 /* POST volatile input fields. */
1120 CINIT(COPYPOSTFIELDS
, OBJECTPOINT
, 165),
1122 /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
1123 CINIT(PROXY_TRANSFER_MODE
, LONG
, 166),
1125 /* Callback function for seeking in the input stream */
1126 CINIT(SEEKFUNCTION
, FUNCTIONPOINT
, 167),
1127 CINIT(SEEKDATA
, OBJECTPOINT
, 168),
1130 CINIT(CRLFILE
, OBJECTPOINT
, 169),
1132 /* Issuer certificate */
1133 CINIT(ISSUERCERT
, OBJECTPOINT
, 170),
1135 /* (IPv6) Address scope */
1136 CINIT(ADDRESS_SCOPE
, LONG
, 171),
1138 CURLOPT_LASTENTRY
/* the last unused */
1141 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
1142 the obsolete stuff removed! */
1144 /* Backwards compatibility with older names */
1145 /* These are scheduled to disappear by 2009 */
1147 /* The following were added in 7.17.0 */
1148 #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
1149 #define CURLOPT_FTPAPPEND CURLOPT_APPEND
1150 #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
1151 #define CURLOPT_FTP_SSL CURLOPT_USE_SSL
1153 /* The following were added earlier */
1155 #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
1156 #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
1159 /* This is set if CURL_NO_OLDIES is defined at compile-time */
1160 #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
1164 /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
1165 name resolves addresses using more than one IP protocol version, this
1166 option might be handy to force libcurl to use a specific IP version. */
1167 #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
1168 versions that your system allows */
1169 #define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */
1170 #define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */
1172 /* three convenient "aliases" that follow the name scheme better */
1173 #define CURLOPT_WRITEDATA CURLOPT_FILE
1174 #define CURLOPT_READDATA CURLOPT_INFILE
1175 #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
1177 /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
1179 CURL_HTTP_VERSION_NONE
, /* setting this means we don't care, and that we'd
1180 like the library to choose the best possible
1182 CURL_HTTP_VERSION_1_0
, /* please use HTTP 1.0 in the request */
1183 CURL_HTTP_VERSION_1_1
, /* please use HTTP 1.1 in the request */
1185 CURL_HTTP_VERSION_LAST
/* *ILLEGAL* http version */
1188 /* These enums are for use with the CURLOPT_NETRC option. */
1189 enum CURL_NETRC_OPTION
{
1190 CURL_NETRC_IGNORED
, /* The .netrc will never be read.
1191 * This is the default. */
1192 CURL_NETRC_OPTIONAL
, /* A user:password in the URL will be preferred
1193 * to one in the .netrc. */
1194 CURL_NETRC_REQUIRED
, /* A user:password in the URL will be ignored.
1195 * Unless one is set programmatically, the .netrc
1196 * will be queried. */
1201 CURL_SSLVERSION_DEFAULT
,
1202 CURL_SSLVERSION_TLSv1
,
1203 CURL_SSLVERSION_SSLv2
,
1204 CURL_SSLVERSION_SSLv3
,
1206 CURL_SSLVERSION_LAST
/* never use, keep last */
1213 CURL_TIMECOND_IFMODSINCE
,
1214 CURL_TIMECOND_IFUNMODSINCE
,
1215 CURL_TIMECOND_LASTMOD
,
1221 /* curl_strequal() and curl_strnequal() are subject for removal in a future
1222 libcurl, see lib/README.curlx for details */
1223 CURL_EXTERN
int (curl_strequal
)(const char *s1
, const char *s2
);
1224 CURL_EXTERN
int (curl_strnequal
)(const char *s1
, const char *s2
, size_t n
);
1226 /* name is uppercase CURLFORM_<name> */
1232 #define CFINIT(name) CURLFORM_ ## name
1234 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
1235 #define CFINIT(name) CURLFORM_/**/name
1239 CFINIT(NOTHING
), /********* the first one is unused ************/
1245 CFINIT(COPYCONTENTS
),
1246 CFINIT(PTRCONTENTS
),
1247 CFINIT(CONTENTSLENGTH
),
1248 CFINIT(FILECONTENT
),
1255 CFINIT(BUFFERLENGTH
),
1257 CFINIT(CONTENTTYPE
),
1258 CFINIT(CONTENTHEADER
),
1265 CURLFORM_LASTENTRY
/* the last unused */
1268 #undef CFINIT /* done */
1270 /* structure to be used as parameter for CURLFORM_ARRAY */
1272 CURLformoption option
;
1276 /* use this for multipart formpost building */
1277 /* Returns code for curl_formadd()
1280 * CURL_FORMADD_OK on success
1281 * CURL_FORMADD_MEMORY if the FormInfo allocation fails
1282 * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
1283 * CURL_FORMADD_NULL if a null pointer was given for a char
1284 * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
1285 * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
1286 * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
1287 * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated
1288 * CURL_FORMADD_MEMORY if some allocation for string copying failed.
1289 * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
1291 ***************************************************************************/
1293 CURL_FORMADD_OK
, /* first, no error */
1295 CURL_FORMADD_MEMORY
,
1296 CURL_FORMADD_OPTION_TWICE
,
1298 CURL_FORMADD_UNKNOWN_OPTION
,
1299 CURL_FORMADD_INCOMPLETE
,
1300 CURL_FORMADD_ILLEGAL_ARRAY
,
1301 CURL_FORMADD_DISABLED
, /* libcurl was built with this disabled */
1303 CURL_FORMADD_LAST
/* last */
1307 * NAME curl_formadd()
1311 * Pretty advanced function for building multi-part formposts. Each invoke
1312 * adds one part that together construct a full post. Then use
1313 * CURLOPT_HTTPPOST to send it off to libcurl.
1315 CURL_EXTERN CURLFORMcode
curl_formadd(struct curl_httppost
**httppost
,
1316 struct curl_httppost
**last_post
,
1320 * callback function for curl_formget()
1321 * The void *arg pointer will be the one passed as second argument to
1323 * The character buffer passed to it must not be freed.
1324 * Should return the buffer length passed to it as the argument "len" on
1327 typedef size_t (*curl_formget_callback
)(void *arg
, const char *buf
, size_t len
);
1330 * NAME curl_formget()
1334 * Serialize a curl_httppost struct built with curl_formadd().
1335 * Accepts a void pointer as second argument which will be passed to
1336 * the curl_formget_callback function.
1337 * Returns 0 on success.
1339 CURL_EXTERN
int curl_formget(struct curl_httppost
*form
, void *arg
,
1340 curl_formget_callback append
);
1342 * NAME curl_formfree()
1346 * Free a multipart formpost previously built with curl_formadd().
1348 CURL_EXTERN
void curl_formfree(struct curl_httppost
*form
);
1351 * NAME curl_getenv()
1355 * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
1356 * complete. DEPRECATED - see lib/README.curlx
1358 CURL_EXTERN
char *curl_getenv(const char *variable
);
1361 * NAME curl_version()
1365 * Returns a static ascii string of the libcurl version.
1367 CURL_EXTERN
char *curl_version(void);
1370 * NAME curl_easy_escape()
1374 * Escapes URL strings (converts all letters consider illegal in URLs to their
1375 * %XX versions). This function returns a new allocated string or NULL if an
1378 CURL_EXTERN
char *curl_easy_escape(CURL
*handle
,
1382 /* the previous version: */
1383 CURL_EXTERN
char *curl_escape(const char *string
,
1388 * NAME curl_easy_unescape()
1392 * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
1393 * versions). This function returns a new allocated string or NULL if an error
1395 * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
1396 * converted into the host encoding.
1398 CURL_EXTERN
char *curl_easy_unescape(CURL
*handle
,
1403 /* the previous version */
1404 CURL_EXTERN
char *curl_unescape(const char *string
,
1412 * Provided for de-allocation in the same translation unit that did the
1413 * allocation. Added in libcurl 7.10
1415 CURL_EXTERN
void curl_free(void *p
);
1418 * NAME curl_global_init()
1422 * curl_global_init() should be invoked exactly once for each application that
1425 CURL_EXTERN CURLcode
curl_global_init(long flags
);
1428 * NAME curl_global_init_mem()
1432 * curl_global_init() or curl_global_init_mem() should be invoked exactly once
1433 * for each application that uses libcurl. This function can be used to
1434 * initialize libcurl and set user defined memory management callback
1435 * functions. Users can implement memory management routines to check for
1436 * memory leaks, check for mis-use of the curl library etc. User registered
1437 * callback routines with be invoked by this library instead of the system
1438 * memory management routines like malloc, free etc.
1440 CURL_EXTERN CURLcode
curl_global_init_mem(long flags
,
1441 curl_malloc_callback m
,
1442 curl_free_callback f
,
1443 curl_realloc_callback r
,
1444 curl_strdup_callback s
,
1445 curl_calloc_callback c
);
1448 * NAME curl_global_cleanup()
1452 * curl_global_cleanup() should be invoked exactly once for each application
1455 CURL_EXTERN
void curl_global_cleanup(void);
1457 /* linked-list structure for the CURLOPT_QUOTE option (and other) */
1460 struct curl_slist
*next
;
1464 * NAME curl_slist_append()
1468 * Appends a string to a linked list. If no list exists, it will be created
1469 * first. Returns the new list, after appending.
1471 CURL_EXTERN
struct curl_slist
*curl_slist_append(struct curl_slist
*,
1475 * NAME curl_slist_free_all()
1479 * free a previously built curl_slist.
1481 CURL_EXTERN
void curl_slist_free_all(struct curl_slist
*);
1484 * NAME curl_getdate()
1488 * Returns the time, in seconds since 1 Jan 1970 of the time string given in
1489 * the first argument. The time argument in the second parameter is unused
1490 * and should be set to NULL.
1492 CURL_EXTERN
time_t curl_getdate(const char *p
, const time_t *unused
);
1494 #define CURLINFO_STRING 0x100000
1495 #define CURLINFO_LONG 0x200000
1496 #define CURLINFO_DOUBLE 0x300000
1497 #define CURLINFO_SLIST 0x400000
1498 #define CURLINFO_MASK 0x0fffff
1499 #define CURLINFO_TYPEMASK 0xf00000
1502 CURLINFO_NONE
, /* first, never use this */
1503 CURLINFO_EFFECTIVE_URL
= CURLINFO_STRING
+ 1,
1504 CURLINFO_RESPONSE_CODE
= CURLINFO_LONG
+ 2,
1505 CURLINFO_TOTAL_TIME
= CURLINFO_DOUBLE
+ 3,
1506 CURLINFO_NAMELOOKUP_TIME
= CURLINFO_DOUBLE
+ 4,
1507 CURLINFO_CONNECT_TIME
= CURLINFO_DOUBLE
+ 5,
1508 CURLINFO_PRETRANSFER_TIME
= CURLINFO_DOUBLE
+ 6,
1509 CURLINFO_SIZE_UPLOAD
= CURLINFO_DOUBLE
+ 7,
1510 CURLINFO_SIZE_DOWNLOAD
= CURLINFO_DOUBLE
+ 8,
1511 CURLINFO_SPEED_DOWNLOAD
= CURLINFO_DOUBLE
+ 9,
1512 CURLINFO_SPEED_UPLOAD
= CURLINFO_DOUBLE
+ 10,
1513 CURLINFO_HEADER_SIZE
= CURLINFO_LONG
+ 11,
1514 CURLINFO_REQUEST_SIZE
= CURLINFO_LONG
+ 12,
1515 CURLINFO_SSL_VERIFYRESULT
= CURLINFO_LONG
+ 13,
1516 CURLINFO_FILETIME
= CURLINFO_LONG
+ 14,
1517 CURLINFO_CONTENT_LENGTH_DOWNLOAD
= CURLINFO_DOUBLE
+ 15,
1518 CURLINFO_CONTENT_LENGTH_UPLOAD
= CURLINFO_DOUBLE
+ 16,
1519 CURLINFO_STARTTRANSFER_TIME
= CURLINFO_DOUBLE
+ 17,
1520 CURLINFO_CONTENT_TYPE
= CURLINFO_STRING
+ 18,
1521 CURLINFO_REDIRECT_TIME
= CURLINFO_DOUBLE
+ 19,
1522 CURLINFO_REDIRECT_COUNT
= CURLINFO_LONG
+ 20,
1523 CURLINFO_PRIVATE
= CURLINFO_STRING
+ 21,
1524 CURLINFO_HTTP_CONNECTCODE
= CURLINFO_LONG
+ 22,
1525 CURLINFO_HTTPAUTH_AVAIL
= CURLINFO_LONG
+ 23,
1526 CURLINFO_PROXYAUTH_AVAIL
= CURLINFO_LONG
+ 24,
1527 CURLINFO_OS_ERRNO
= CURLINFO_LONG
+ 25,
1528 CURLINFO_NUM_CONNECTS
= CURLINFO_LONG
+ 26,
1529 CURLINFO_SSL_ENGINES
= CURLINFO_SLIST
+ 27,
1530 CURLINFO_COOKIELIST
= CURLINFO_SLIST
+ 28,
1531 CURLINFO_LASTSOCKET
= CURLINFO_LONG
+ 29,
1532 CURLINFO_FTP_ENTRY_PATH
= CURLINFO_STRING
+ 30,
1533 CURLINFO_REDIRECT_URL
= CURLINFO_STRING
+ 31,
1534 CURLINFO_PRIMARY_IP
= CURLINFO_STRING
+ 32,
1535 CURLINFO_APPCONNECT_TIME
= CURLINFO_DOUBLE
+ 33,
1536 /* Fill in new entries below here! */
1538 CURLINFO_LASTONE
= 33
1541 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
1542 CURLINFO_HTTP_CODE */
1543 #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
1546 CURLCLOSEPOLICY_NONE
, /* first, never use this */
1548 CURLCLOSEPOLICY_OLDEST
,
1549 CURLCLOSEPOLICY_LEAST_RECENTLY_USED
,
1550 CURLCLOSEPOLICY_LEAST_TRAFFIC
,
1551 CURLCLOSEPOLICY_SLOWEST
,
1552 CURLCLOSEPOLICY_CALLBACK
,
1554 CURLCLOSEPOLICY_LAST
/* last, never use this */
1557 #define CURL_GLOBAL_SSL (1<<0)
1558 #define CURL_GLOBAL_WIN32 (1<<1)
1559 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
1560 #define CURL_GLOBAL_NOTHING 0
1561 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
1564 /*****************************************************************************
1565 * Setup defines, protos etc for the sharing stuff.
1568 /* Different data locks for a single share */
1570 CURL_LOCK_DATA_NONE
= 0,
1571 /* CURL_LOCK_DATA_SHARE is used internally to say that
1572 * the locking is just made to change the internal state of the share
1575 CURL_LOCK_DATA_SHARE
,
1576 CURL_LOCK_DATA_COOKIE
,
1578 CURL_LOCK_DATA_SSL_SESSION
,
1579 CURL_LOCK_DATA_CONNECT
,
1583 /* Different lock access types */
1585 CURL_LOCK_ACCESS_NONE
= 0, /* unspecified action */
1586 CURL_LOCK_ACCESS_SHARED
= 1, /* for read perhaps */
1587 CURL_LOCK_ACCESS_SINGLE
= 2, /* for write perhaps */
1588 CURL_LOCK_ACCESS_LAST
/* never use */
1591 typedef void (*curl_lock_function
)(CURL
*handle
,
1592 curl_lock_data data
,
1593 curl_lock_access locktype
,
1595 typedef void (*curl_unlock_function
)(CURL
*handle
,
1596 curl_lock_data data
,
1599 typedef void CURLSH
;
1602 CURLSHE_OK
, /* all is fine */
1603 CURLSHE_BAD_OPTION
, /* 1 */
1604 CURLSHE_IN_USE
, /* 2 */
1605 CURLSHE_INVALID
, /* 3 */
1606 CURLSHE_NOMEM
, /* out of memory */
1607 CURLSHE_LAST
/* never use */
1611 CURLSHOPT_NONE
, /* don't use */
1612 CURLSHOPT_SHARE
, /* specify a data type to share */
1613 CURLSHOPT_UNSHARE
, /* specify which data type to stop sharing */
1614 CURLSHOPT_LOCKFUNC
, /* pass in a 'curl_lock_function' pointer */
1615 CURLSHOPT_UNLOCKFUNC
, /* pass in a 'curl_unlock_function' pointer */
1616 CURLSHOPT_USERDATA
, /* pass in a user data pointer used in the lock/unlock
1617 callback functions */
1618 CURLSHOPT_LAST
/* never use */
1621 CURL_EXTERN CURLSH
*curl_share_init(void);
1622 CURL_EXTERN CURLSHcode
curl_share_setopt(CURLSH
*, CURLSHoption option
, ...);
1623 CURL_EXTERN CURLSHcode
curl_share_cleanup(CURLSH
*);
1625 /****************************************************************************
1626 * Structures for querying information about the curl library at runtime.
1634 CURLVERSION_LAST
/* never actually use this */
1637 /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
1638 basically all programs ever that want to get version information. It is
1639 meant to be a built-in version number for what kind of struct the caller
1640 expects. If the struct ever changes, we redefine the NOW to another enum
1642 #define CURLVERSION_NOW CURLVERSION_FOURTH
1645 CURLversion age
; /* age of the returned struct */
1646 const char *version
; /* LIBCURL_VERSION */
1647 unsigned int version_num
; /* LIBCURL_VERSION_NUM */
1648 const char *host
; /* OS/host/cpu/machine when configured */
1649 int features
; /* bitmask, see defines below */
1650 const char *ssl_version
; /* human readable string */
1651 long ssl_version_num
; /* not used anymore, always 0 */
1652 const char *libz_version
; /* human readable string */
1653 /* protocols is terminated by an entry with a NULL protoname */
1654 const char * const *protocols
;
1656 /* The fields below this were added in CURLVERSION_SECOND */
1660 /* This field was added in CURLVERSION_THIRD */
1663 /* These field were added in CURLVERSION_FOURTH */
1665 /* Same as '_libiconv_version' if built with HAVE_ICONV */
1668 const char *libssh_version
; /* human readable string */
1670 } curl_version_info_data
;
1672 #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */
1673 #define CURL_VERSION_KERBEROS4 (1<<1) /* kerberos auth is supported */
1674 #define CURL_VERSION_SSL (1<<2) /* SSL options are present */
1675 #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */
1676 #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */
1677 #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */
1678 #define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */
1679 #define CURL_VERSION_ASYNCHDNS (1<<7) /* asynchronous dns resolves */
1680 #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */
1681 #define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */
1682 #define CURL_VERSION_IDN (1<<10) /* International Domain Names support */
1683 #define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */
1684 #define CURL_VERSION_CONV (1<<12) /* character conversions are
1688 * NAME curl_version_info()
1692 * This function returns a pointer to a static copy of the version info
1693 * struct. See above.
1695 CURL_EXTERN curl_version_info_data
*curl_version_info(CURLversion
);
1698 * NAME curl_easy_strerror()
1702 * The curl_easy_strerror function may be used to turn a CURLcode value
1703 * into the equivalent human readable error string. This is useful
1704 * for printing meaningful error messages.
1706 CURL_EXTERN
const char *curl_easy_strerror(CURLcode
);
1709 * NAME curl_share_strerror()
1713 * The curl_share_strerror function may be used to turn a CURLSHcode value
1714 * into the equivalent human readable error string. This is useful
1715 * for printing meaningful error messages.
1717 CURL_EXTERN
const char *curl_share_strerror(CURLSHcode
);
1720 * NAME curl_easy_pause()
1724 * The curl_easy_pause function pauses or unpauses transfers. Select the new
1725 * state by setting the bitmask, use the convenience defines below.
1728 CURL_EXTERN CURLcode
curl_easy_pause(CURL
*handle
, int bitmask
);
1730 #define CURLPAUSE_RECV (1<<0)
1731 #define CURLPAUSE_RECV_CONT (0)
1733 #define CURLPAUSE_SEND (1<<2)
1734 #define CURLPAUSE_SEND_CONT (0)
1736 #define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND)
1737 #define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)
1743 /* unfortunately, the easy.h and multi.h include files need options and info
1744 stuff before they can be included! */
1745 #include "easy.h" /* nothing in curl is fun without the easy stuff */
1748 /* the typechecker doesn't work in C++ (yet) */
1749 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
1750 !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
1751 #include "typecheck-gcc.h"
1753 #if defined(__STDC__) && (__STDC__ >= 1)
1754 /* This preprocessor magic that replaces a call with the exact same call is
1755 only done to make sure application authors pass exactly three arguments
1756 to these functions. */
1757 #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
1758 #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
1759 #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
1760 #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
1761 #endif /* __STDC__ >= 1 */
1762 #endif /* gcc >= 4.3 && !__cplusplus */
1764 #endif /* __CURL_CURL_H */