Planeshift

curl.h

Go to the documentation of this file.
00001 #ifndef __CURL_CURL_H
00002 #define __CURL_CURL_H
00003 /***************************************************************************
00004  *                                  _   _ ____  _
00005  *  Project                     ___| | | |  _ \| |
00006  *                             / __| | | | |_) | |
00007  *                            | (__| |_| |  _ <| |___
00008  *                             \___|\___/|_| \_\_____|
00009  *
00010  * Copyright (C) 1998 - 2009, Daniel Stenberg, <[email protected]>, et al.
00011  *
00012  * This software is licensed as described in the file COPYING, which
00013  * you should have received as part of this distribution. The terms
00014  * are also available at http://curl.haxx.se/docs/copyright.html.
00015  *
00016  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
00017  * copies of the Software, and permit persons to whom the Software is
00018  * furnished to do so, under the terms of the COPYING file.
00019  *
00020  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
00021  * KIND, either express or implied.
00022  *
00023  * $Id: curl.h 8795 2013-09-14 06:15:05Z joelyon $
00024  ***************************************************************************/
00025 
00026 /*
00027  * If you have libcurl problems, all docs and details are found here:
00028  *   http://curl.haxx.se/libcurl/
00029  *
00030  * curl-library mailing list subscription and unsubscription web interface:
00031  *   http://cool.haxx.se/mailman/listinfo/curl-library/
00032  */
00033 
00034 /*
00035  * Leading 'curl' path on the 'curlbuild.h' include statement is
00036  * required to properly allow building outside of the source tree,
00037  * due to the fact that in this case 'curlbuild.h' is generated in
00038  * a subdirectory of the build tree while 'curl.h actually remains
00039  * in a subdirectory of the source tree.
00040  */
00041 
00042 #include "third_party/curl/curlver.h"         /* libcurl version defines   */
00043 #include "third_party/curl/curlbuild.h"       /* libcurl build definitions */
00044 #include "third_party/curl/curlrules.h"       /* libcurl rules enforcement */
00045 
00046 /*
00047  * Define WIN32 when build target is Win32 API
00048  */
00049 
00050 #if (defined(_WIN32) || defined(__WIN32__)) && \
00051      !defined(WIN32) && !defined(__SYMBIAN32__)
00052 #define WIN32
00053 #endif
00054 
00055 #include <stdio.h>
00056 #include <limits.h>
00057 
00058 /* The include stuff here below is mainly for time_t! */
00059 #include <sys/types.h>
00060 #include <time.h>
00061 
00062 #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \
00063   !defined(__CYGWIN__) || defined(__MINGW32__)
00064 #if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H))
00065 /* The check above prevents the winsock2 inclusion if winsock.h already was
00066    included, since they can't co-exist without problems */
00067 #include <winsock2.h>
00068 #include <ws2tcpip.h>
00069 #endif
00070 #else
00071 
00072 /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
00073    libc5-based Linux systems. Only include it on system that are known to
00074    require it! */
00075 #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
00076     defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
00077     defined(ANDROID)
00078 #include <sys/select.h>
00079 #endif
00080 
00081 #ifndef _WIN32_WCE
00082 #include <sys/socket.h>
00083 #endif
00084 #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
00085 #include <sys/time.h>
00086 #endif
00087 #include <sys/types.h>
00088 #endif
00089 
00090 #ifdef __BEOS__
00091 #include <support/SupportDefs.h>
00092 #endif
00093 
00094 #ifdef  __cplusplus
00095 extern "C" {
00096 #endif
00097 
00098 typedef void CURL;
00099 
00100 /*
00101  * Decorate exportable functions for Win32 and Symbian OS DLL linking.
00102  * This avoids using a .def file for building libcurl.dll.
00103  */
00104 #if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \
00105      !defined(CURL_STATICLIB)
00106 #if defined(BUILDING_LIBCURL)
00107 #define CURL_EXTERN  __declspec(dllexport)
00108 #else
00109 #define CURL_EXTERN  __declspec(dllimport)
00110 #endif
00111 #else
00112 
00113 #ifdef CURL_HIDDEN_SYMBOLS
00114 /*
00115  * This definition is used to make external definitions visible in the
00116  * shared library when symbols are hidden by default.  It makes no
00117  * difference when compiling applications whether this is set or not,
00118  * only when compiling the library.
00119  */
00120 #define CURL_EXTERN CURL_EXTERN_SYMBOL
00121 #else
00122 #define CURL_EXTERN
00123 #endif
00124 #endif
00125 
00126 #ifndef curl_socket_typedef
00127 /* socket typedef */
00128 #ifdef WIN32
00129 typedef SOCKET curl_socket_t;
00130 #define CURL_SOCKET_BAD INVALID_SOCKET
00131 #else
00132 typedef int curl_socket_t;
00133 #define CURL_SOCKET_BAD -1
00134 #endif
00135 #define curl_socket_typedef
00136 #endif /* curl_socket_typedef */
00137 
00138 struct curl_httppost {
00139   struct curl_httppost *next;       /* next entry in the list */
00140   char *name;                       /* pointer to allocated name */
00141   long namelength;                  /* length of name length */
00142   char *contents;                   /* pointer to allocated data contents */
00143   long contentslength;              /* length of contents field */
00144   char *buffer;                     /* pointer to allocated buffer contents */
00145   long bufferlength;                /* length of buffer field */
00146   char *contenttype;                /* Content-Type */
00147   struct curl_slist* contentheader; /* list of extra headers for this form */
00148   struct curl_httppost *more;       /* if one field name has more than one
00149                                        file, this link should link to following
00150                                        files */
00151   long flags;                       /* as defined below */
00152 #define HTTPPOST_FILENAME (1<<0)    /* specified content is a file name */
00153 #define HTTPPOST_READFILE (1<<1)    /* specified content is a file name */
00154 #define HTTPPOST_PTRNAME (1<<2)     /* name is only stored pointer
00155                                        do not free in formfree */
00156 #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
00157                                        do not free in formfree */
00158 #define HTTPPOST_BUFFER (1<<4)      /* upload file from buffer */
00159 #define HTTPPOST_PTRBUFFER (1<<5)   /* upload file from pointer contents */
00160 #define HTTPPOST_CALLBACK (1<<6)    /* upload file contents by using the
00161                                        regular read callback to get the data
00162                                        and pass the given pointer as custom
00163                                        pointer */
00164 
00165   char *showfilename;               /* The file name to show. If not set, the
00166                                        actual file name will be used (if this
00167                                        is a file part) */
00168   void *userp;                      /* custom pointer used for
00169                                        HTTPPOST_CALLBACK posts */
00170 };
00171 
00172 typedef int (*curl_progress_callback)(void *clientp,
00173                                       double dltotal,
00174                                       double dlnow,
00175                                       double ultotal,
00176                                       double ulnow);
00177 
00178 #ifndef CURL_MAX_WRITE_SIZE
00179   /* Tests have proven that 20K is a very bad buffer size for uploads on
00180      Windows, while 16K for some odd reason performed a lot better.
00181      We do the ifndef check to allow this value to easier be changed at build
00182      time for those who feel adventurous. */
00183 #define CURL_MAX_WRITE_SIZE 16384
00184 #endif
00185 
00186 #ifndef CURL_MAX_HTTP_HEADER
00187 /* The only reason to have a max limit for this is to avoid the risk of a bad
00188    server feeding libcurl with a never-ending header that will cause reallocs
00189    infinitely */
00190 #define CURL_MAX_HTTP_HEADER (100*1024)
00191 #endif
00192 
00193 
00194 /* This is a magic return code for the write callback that, when returned,
00195    will signal libcurl to pause receiving on the current transfer. */
00196 #define CURL_WRITEFUNC_PAUSE 0x10000001
00197 typedef size_t (*curl_write_callback)(char *buffer,
00198                                       size_t size,
00199                                       size_t nitems,
00200                                       void *outstream);
00201 
00202 /* These are the return codes for the seek callbacks */
00203 #define CURL_SEEKFUNC_OK       0
00204 #define CURL_SEEKFUNC_FAIL     1 /* fail the entire transfer */
00205 #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so
00206                                     libcurl might try other means instead */
00207 typedef int (*curl_seek_callback)(void *instream,
00208                                   curl_off_t offset,
00209                                   int origin); /* 'whence' */
00210 
00211 /* This is a return code for the read callback that, when returned, will
00212    signal libcurl to immediately abort the current transfer. */
00213 #define CURL_READFUNC_ABORT 0x10000000
00214 /* This is a return code for the read callback that, when returned, will
00215    signal libcurl to pause sending data on the current transfer. */
00216 #define CURL_READFUNC_PAUSE 0x10000001
00217 
00218 typedef size_t (*curl_read_callback)(char *buffer,
00219                                       size_t size,
00220                                       size_t nitems,
00221                                       void *instream);
00222 
00223 typedef enum  {
00224   CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
00225   CURLSOCKTYPE_LAST   /* never use */
00226 } curlsocktype;
00227 
00228 typedef int (*curl_sockopt_callback)(void *clientp,
00229                                      curl_socket_t curlfd,
00230                                      curlsocktype purpose);
00231 
00232 struct curl_sockaddr {
00233   int family;
00234   int socktype;
00235   int protocol;
00236   unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it
00237                            turned really ugly and painful on the systems that
00238                            lack this type */
00239   struct sockaddr addr;
00240 };
00241 
00242 typedef curl_socket_t
00243 (*curl_opensocket_callback)(void *clientp,
00244                             curlsocktype purpose,
00245                             struct curl_sockaddr *address);
00246 
00247 #ifndef CURL_NO_OLDIES
00248   /* not used since 7.10.8, will be removed in a future release */
00249 typedef int (*curl_passwd_callback)(void *clientp,
00250                                     const char *prompt,
00251                                     char *buffer,
00252                                     int buflen);
00253 #endif
00254 
00255 typedef enum {
00256   CURLIOE_OK,            /* I/O operation successful */
00257   CURLIOE_UNKNOWNCMD,    /* command was unknown to callback */
00258   CURLIOE_FAILRESTART,   /* failed to restart the read */
00259   CURLIOE_LAST           /* never use */
00260 } curlioerr;
00261 
00262 typedef enum  {
00263   CURLIOCMD_NOP,         /* no operation */
00264   CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
00265   CURLIOCMD_LAST         /* never use */
00266 } curliocmd;
00267 
00268 typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
00269                                          int cmd,
00270                                          void *clientp);
00271 
00272 /*
00273  * The following typedef's are signatures of malloc, free, realloc, strdup and
00274  * calloc respectively.  Function pointers of these types can be passed to the
00275  * curl_global_init_mem() function to set user defined memory management
00276  * callback routines.
00277  */
00278 typedef void *(*curl_malloc_callback)(size_t size);
00279 typedef void (*curl_free_callback)(void *ptr);
00280 typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
00281 typedef char *(*curl_strdup_callback)(const char *str);
00282 typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
00283 
00284 /* the kind of data that is passed to information_callback*/
00285 typedef enum {
00286   CURLINFO_TEXT = 0,
00287   CURLINFO_HEADER_IN,    /* 1 */
00288   CURLINFO_HEADER_OUT,   /* 2 */
00289   CURLINFO_DATA_IN,      /* 3 */
00290   CURLINFO_DATA_OUT,     /* 4 */
00291   CURLINFO_SSL_DATA_IN,  /* 5 */
00292   CURLINFO_SSL_DATA_OUT, /* 6 */
00293   CURLINFO_END
00294 } curl_infotype;
00295 
00296 typedef int (*curl_debug_callback)
00297        (CURL *handle,      /* the handle/transfer this concerns */
00298         curl_infotype type, /* what kind of data */
00299         char *data,        /* points to the data */
00300         size_t size,       /* size of the data pointed to */
00301         void *userptr);    /* whatever the user please */
00302 
00303 /* All possible error codes from all sorts of curl functions. Future versions
00304    may return other values, stay prepared.
00305 
00306    Always add new return codes last. Never *EVER* remove any. The return
00307    codes must remain the same!
00308  */
00309 
00310 typedef enum {
00311   CURLE_OK = 0,
00312   CURLE_UNSUPPORTED_PROTOCOL,    /* 1 */
00313   CURLE_FAILED_INIT,             /* 2 */
00314   CURLE_URL_MALFORMAT,           /* 3 */
00315   CURLE_OBSOLETE4,               /* 4 - NOT USED */
00316   CURLE_COULDNT_RESOLVE_PROXY,   /* 5 */
00317   CURLE_COULDNT_RESOLVE_HOST,    /* 6 */
00318   CURLE_COULDNT_CONNECT,         /* 7 */
00319   CURLE_FTP_WEIRD_SERVER_REPLY,  /* 8 */
00320   CURLE_REMOTE_ACCESS_DENIED,    /* 9 a service was denied by the server
00321                                     due to lack of access - when login fails
00322                                     this is not returned. */
00323   CURLE_OBSOLETE10,              /* 10 - NOT USED */
00324   CURLE_FTP_WEIRD_PASS_REPLY,    /* 11 */
00325   CURLE_OBSOLETE12,              /* 12 - NOT USED */
00326   CURLE_FTP_WEIRD_PASV_REPLY,    /* 13 */
00327   CURLE_FTP_WEIRD_227_FORMAT,    /* 14 */
00328   CURLE_FTP_CANT_GET_HOST,       /* 15 */
00329   CURLE_OBSOLETE16,              /* 16 - NOT USED */
00330   CURLE_FTP_COULDNT_SET_TYPE,    /* 17 */
00331   CURLE_PARTIAL_FILE,            /* 18 */
00332   CURLE_FTP_COULDNT_RETR_FILE,   /* 19 */
00333   CURLE_OBSOLETE20,              /* 20 - NOT USED */
00334   CURLE_QUOTE_ERROR,             /* 21 - quote command failure */
00335   CURLE_HTTP_RETURNED_ERROR,     /* 22 */
00336   CURLE_WRITE_ERROR,             /* 23 */
00337   CURLE_OBSOLETE24,              /* 24 - NOT USED */
00338   CURLE_UPLOAD_FAILED,           /* 25 - failed upload "command" */
00339   CURLE_READ_ERROR,              /* 26 - couldn't open/read from file */
00340   CURLE_OUT_OF_MEMORY,           /* 27 */
00341   /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
00342            instead of a memory allocation error if CURL_DOES_CONVERSIONS
00343            is defined
00344   */
00345   CURLE_OPERATION_TIMEDOUT,      /* 28 - the timeout time was reached */
00346   CURLE_OBSOLETE29,              /* 29 - NOT USED */
00347   CURLE_FTP_PORT_FAILED,         /* 30 - FTP PORT operation failed */
00348   CURLE_FTP_COULDNT_USE_REST,    /* 31 - the REST command failed */
00349   CURLE_OBSOLETE32,              /* 32 - NOT USED */
00350   CURLE_RANGE_ERROR,             /* 33 - RANGE "command" didn't work */
00351   CURLE_HTTP_POST_ERROR,         /* 34 */
00352   CURLE_SSL_CONNECT_ERROR,       /* 35 - wrong when connecting with SSL */
00353   CURLE_BAD_DOWNLOAD_RESUME,     /* 36 - couldn't resume download */
00354   CURLE_FILE_COULDNT_READ_FILE,  /* 37 */
00355   CURLE_LDAP_CANNOT_BIND,        /* 38 */
00356   CURLE_LDAP_SEARCH_FAILED,      /* 39 */
00357   CURLE_OBSOLETE40,              /* 40 - NOT USED */
00358   CURLE_FUNCTION_NOT_FOUND,      /* 41 */
00359   CURLE_ABORTED_BY_CALLBACK,     /* 42 */
00360   CURLE_BAD_FUNCTION_ARGUMENT,   /* 43 */
00361   CURLE_OBSOLETE44,              /* 44 - NOT USED */
00362   CURLE_INTERFACE_FAILED,        /* 45 - CURLOPT_INTERFACE failed */
00363   CURLE_OBSOLETE46,              /* 46 - NOT USED */
00364   CURLE_TOO_MANY_REDIRECTS ,     /* 47 - catch endless re-direct loops */
00365   CURLE_UNKNOWN_TELNET_OPTION,   /* 48 - User specified an unknown option */
00366   CURLE_TELNET_OPTION_SYNTAX ,   /* 49 - Malformed telnet option */
00367   CURLE_OBSOLETE50,              /* 50 - NOT USED */
00368   CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
00369                                      wasn't verified fine */
00370   CURLE_GOT_NOTHING,             /* 52 - when this is a specific error */
00371   CURLE_SSL_ENGINE_NOTFOUND,     /* 53 - SSL crypto engine not found */
00372   CURLE_SSL_ENGINE_SETFAILED,    /* 54 - can not set SSL crypto engine as
00373                                     default */
00374   CURLE_SEND_ERROR,              /* 55 - failed sending network data */
00375   CURLE_RECV_ERROR,              /* 56 - failure in receiving network data */
00376   CURLE_OBSOLETE57,              /* 57 - NOT IN USE */
00377   CURLE_SSL_CERTPROBLEM,         /* 58 - problem with the local certificate */
00378   CURLE_SSL_CIPHER,              /* 59 - couldn't use specified cipher */
00379   CURLE_SSL_CACERT,              /* 60 - problem with the CA cert (path?) */
00380   CURLE_BAD_CONTENT_ENCODING,    /* 61 - Unrecognized transfer encoding */
00381   CURLE_LDAP_INVALID_URL,        /* 62 - Invalid LDAP URL */
00382   CURLE_FILESIZE_EXCEEDED,       /* 63 - Maximum file size exceeded */
00383   CURLE_USE_SSL_FAILED,          /* 64 - Requested FTP SSL level failed */
00384   CURLE_SEND_FAIL_REWIND,        /* 65 - Sending the data requires a rewind
00385                                     that failed */
00386   CURLE_SSL_ENGINE_INITFAILED,   /* 66 - failed to initialise ENGINE */
00387   CURLE_LOGIN_DENIED,            /* 67 - user, password or similar was not
00388                                     accepted and we failed to login */
00389   CURLE_TFTP_NOTFOUND,           /* 68 - file not found on server */
00390   CURLE_TFTP_PERM,               /* 69 - permission problem on server */
00391   CURLE_REMOTE_DISK_FULL,        /* 70 - out of disk space on server */
00392   CURLE_TFTP_ILLEGAL,            /* 71 - Illegal TFTP operation */
00393   CURLE_TFTP_UNKNOWNID,          /* 72 - Unknown transfer ID */
00394   CURLE_REMOTE_FILE_EXISTS,      /* 73 - File already exists */
00395   CURLE_TFTP_NOSUCHUSER,         /* 74 - No such user */
00396   CURLE_CONV_FAILED,             /* 75 - conversion failed */
00397   CURLE_CONV_REQD,               /* 76 - caller must register conversion
00398                                     callbacks using curl_easy_setopt options
00399                                     CURLOPT_CONV_FROM_NETWORK_FUNCTION,
00400                                     CURLOPT_CONV_TO_NETWORK_FUNCTION, and
00401                                     CURLOPT_CONV_FROM_UTF8_FUNCTION */
00402   CURLE_SSL_CACERT_BADFILE,      /* 77 - could not load CACERT file, missing
00403                                     or wrong format */
00404   CURLE_REMOTE_FILE_NOT_FOUND,   /* 78 - remote file not found */
00405   CURLE_SSH,                     /* 79 - error from the SSH layer, somewhat
00406                                     generic so the error message will be of
00407                                     interest when this has happened */
00408 
00409   CURLE_SSL_SHUTDOWN_FAILED,     /* 80 - Failed to shut down the SSL
00410                                     connection */
00411   CURLE_AGAIN,                   /* 81 - socket is not ready for send/recv,
00412                                     wait till it's ready and try again (Added
00413                                     in 7.18.2) */
00414   CURLE_SSL_CRL_BADFILE,         /* 82 - could not load CRL file, missing or
00415                                     wrong format (Added in 7.19.0) */
00416   CURLE_SSL_ISSUER_ERROR,        /* 83 - Issuer check failed.  (Added in
00417                                     7.19.0) */
00418   CURL_LAST /* never use! */
00419 } CURLcode;
00420 
00421 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
00422                           the obsolete stuff removed! */
00423 
00424 /* Backwards compatibility with older names */
00425 
00426 /* The following were added in 7.17.1 */
00427 /* These are scheduled to disappear by 2009 */
00428 #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION
00429 
00430 /* The following were added in 7.17.0 */
00431 /* These are scheduled to disappear by 2009 */
00432 #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* noone should be using this! */
00433 #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
00434 #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
00435 #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
00436 #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
00437 #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
00438 #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
00439 #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
00440 #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
00441 #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
00442 #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
00443 #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
00444 #define CURLE_URL_MALFORMAT_USER CURLE_OBSOLETE4
00445 
00446 #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
00447 #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
00448 #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
00449 #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
00450 #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
00451 #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
00452 #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
00453 
00454 /* The following were added earlier */
00455 
00456 #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT
00457 
00458 #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
00459 #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
00460 #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
00461 
00462 #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
00463 #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
00464 
00465 /* This was the error code 50 in 7.7.3 and a few earlier versions, this
00466    is no longer used by libcurl but is instead #defined here only to not
00467    make programs break */
00468 #define CURLE_ALREADY_COMPLETE 99999
00469 
00470 #endif 
00472 /* This prototype applies to all conversion callbacks */
00473 typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
00474 
00475 typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl,    /* easy handle */
00476                                           void *ssl_ctx, /* actually an
00477                                                             OpenSSL SSL_CTX */
00478                                           void *userptr);
00479 
00480 typedef enum {
00481   CURLPROXY_HTTP = 0,   /* added in 7.10, new in 7.19.4 default is to use
00482                            CONNECT HTTP/1.1 */
00483   CURLPROXY_HTTP_1_0 = 1,   /* added in 7.19.4, force to use CONNECT
00484                                HTTP/1.0  */
00485   CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already
00486                            in 7.10 */
00487   CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
00488   CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */
00489   CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the
00490                                    host name rather than the IP address. added
00491                                    in 7.18.0 */
00492 } curl_proxytype;  /* this enum was added in 7.10 */
00493 
00494 #define CURLAUTH_NONE         0       /* nothing */
00495 #define CURLAUTH_BASIC        (1<<0)  /* Basic (default) */
00496 #define CURLAUTH_DIGEST       (1<<1)  /* Digest */
00497 #define CURLAUTH_GSSNEGOTIATE (1<<2)  /* GSS-Negotiate */
00498 #define CURLAUTH_NTLM         (1<<3)  /* NTLM */
00499 #define CURLAUTH_DIGEST_IE    (1<<4)  /* Digest with IE flavour */
00500 #define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)  /* all fine types set */
00501 #define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
00502 
00503 #define CURLSSH_AUTH_ANY       ~0     /* all types supported by the server */
00504 #define CURLSSH_AUTH_NONE      0      /* none allowed, silly but complete */
00505 #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
00506 #define CURLSSH_AUTH_PASSWORD  (1<<1) /* password */
00507 #define CURLSSH_AUTH_HOST      (1<<2) /* host key files */
00508 #define CURLSSH_AUTH_KEYBOARD  (1<<3) /* keyboard interactive */
00509 #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
00510 
00511 #define CURL_ERROR_SIZE 256
00512 
00513 struct curl_khkey {
00514   const char *key; /* points to a zero-terminated string encoded with base64
00515                       if len is zero, otherwise to the "raw" data */
00516   size_t len;
00517   enum type {
00518     CURLKHTYPE_UNKNOWN,
00519     CURLKHTYPE_RSA1,
00520     CURLKHTYPE_RSA,
00521     CURLKHTYPE_DSS
00522   } keytype;
00523 };
00524 
00525 /* this is the set of return values expected from the curl_sshkeycallback
00526    callback */
00527 enum curl_khstat {
00528   CURLKHSTAT_FINE_ADD_TO_FILE,
00529   CURLKHSTAT_FINE,
00530   CURLKHSTAT_REJECT, /* reject the connection, return an error */
00531   CURLKHSTAT_DEFER,  /* do not accept it, but we can't answer right now so
00532                         this causes a CURLE_DEFER error but otherwise the
00533                         connection will be left intact etc */
00534   CURLKHSTAT_LAST    /* not for use, only a marker for last-in-list */
00535 };
00536 
00537 /* this is the set of status codes pass in to the callback */
00538 enum curl_khmatch {
00539   CURLKHMATCH_OK,       /* match */
00540   CURLKHMATCH_MISMATCH, /* host found, key mismatch! */
00541   CURLKHMATCH_MISSING,  /* no matching host/key found */
00542   CURLKHMATCH_LAST      /* not for use, only a marker for last-in-list */
00543 };
00544 
00545 typedef int
00546   (*curl_sshkeycallback) (CURL *easy,     /* easy handle */
00547                           const struct curl_khkey *knownkey, /* known */
00548                           const struct curl_khkey *foundkey, /* found */
00549                           enum curl_khmatch, /* libcurl's view on the keys */
00550                           void *clientp); /* custom pointer passed from app */
00551 
00552 /* parameter for the CURLOPT_USE_SSL option */
00553 typedef enum {
00554   CURLUSESSL_NONE,    /* do not attempt to use SSL */
00555   CURLUSESSL_TRY,     /* try using SSL, proceed anyway otherwise */
00556   CURLUSESSL_CONTROL, /* SSL for the control connection or fail */
00557   CURLUSESSL_ALL,     /* SSL for all communication or fail */
00558   CURLUSESSL_LAST     /* not an option, never use */
00559 } curl_usessl;
00560 
00561 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
00562                           the obsolete stuff removed! */
00563 
00564 /* Backwards compatibility with older names */
00565 /* These are scheduled to disappear by 2009 */
00566 
00567 #define CURLFTPSSL_NONE CURLUSESSL_NONE
00568 #define CURLFTPSSL_TRY CURLUSESSL_TRY
00569 #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
00570 #define CURLFTPSSL_ALL CURLUSESSL_ALL
00571 #define CURLFTPSSL_LAST CURLUSESSL_LAST
00572 #define curl_ftpssl curl_usessl
00573 #endif 
00575 /* parameter for the CURLOPT_FTP_SSL_CCC option */
00576 typedef enum {
00577   CURLFTPSSL_CCC_NONE,    /* do not send CCC */
00578   CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
00579   CURLFTPSSL_CCC_ACTIVE,  /* Initiate the shutdown */
00580   CURLFTPSSL_CCC_LAST     /* not an option, never use */
00581 } curl_ftpccc;
00582 
00583 /* parameter for the CURLOPT_FTPSSLAUTH option */
00584 typedef enum {
00585   CURLFTPAUTH_DEFAULT, /* let libcurl decide */
00586   CURLFTPAUTH_SSL,     /* use "AUTH SSL" */
00587   CURLFTPAUTH_TLS,     /* use "AUTH TLS" */
00588   CURLFTPAUTH_LAST /* not an option, never use */
00589 } curl_ftpauth;
00590 
00591 /* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
00592 typedef enum {
00593   CURLFTP_CREATE_DIR_NONE,  /* do NOT create missing dirs! */
00594   CURLFTP_CREATE_DIR,       /* (FTP/SFTP) if CWD fails, try MKD and then CWD
00595                                again if MKD succeeded, for SFTP this does
00596                                similar magic */
00597   CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
00598                                again even if MKD failed! */
00599   CURLFTP_CREATE_DIR_LAST   /* not an option, never use */
00600 } curl_ftpcreatedir;
00601 
00602 /* parameter for the CURLOPT_FTP_FILEMETHOD option */
00603 typedef enum {
00604   CURLFTPMETHOD_DEFAULT,   /* let libcurl pick */
00605   CURLFTPMETHOD_MULTICWD,  /* single CWD operation for each path part */
00606   CURLFTPMETHOD_NOCWD,     /* no CWD at all */
00607   CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
00608   CURLFTPMETHOD_LAST       /* not an option, never use */
00609 } curl_ftpmethod;
00610 
00611 /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
00612 #define CURLPROTO_HTTP   (1<<0)
00613 #define CURLPROTO_HTTPS  (1<<1)
00614 #define CURLPROTO_FTP    (1<<2)
00615 #define CURLPROTO_FTPS   (1<<3)
00616 #define CURLPROTO_SCP    (1<<4)
00617 #define CURLPROTO_SFTP   (1<<5)
00618 #define CURLPROTO_TELNET (1<<6)
00619 #define CURLPROTO_LDAP   (1<<7)
00620 #define CURLPROTO_LDAPS  (1<<8)
00621 #define CURLPROTO_DICT   (1<<9)
00622 #define CURLPROTO_FILE   (1<<10)
00623 #define CURLPROTO_TFTP   (1<<11)
00624 #define CURLPROTO_ALL    (~0) /* enable everything */
00625 
00626 /* long may be 32 or 64 bits, but we should never depend on anything else
00627    but 32 */
00628 #define CURLOPTTYPE_LONG          0
00629 #define CURLOPTTYPE_OBJECTPOINT   10000
00630 #define CURLOPTTYPE_FUNCTIONPOINT 20000
00631 #define CURLOPTTYPE_OFF_T         30000
00632 
00633 /* name is uppercase CURLOPT_<name>,
00634    type is one of the defined CURLOPTTYPE_<type>
00635    number is unique identifier */
00636 #ifdef CINIT
00637 #undef CINIT
00638 #endif
00639 
00640 #ifdef CURL_ISOCPP
00641 #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
00642 #else
00643 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
00644 #define LONG          CURLOPTTYPE_LONG
00645 #define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT
00646 #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
00647 #define OFF_T         CURLOPTTYPE_OFF_T
00648 #define CINIT(name,type,number) CURLOPT_name = type + number
00649 #endif
00650 
00651 /*
00652  * This macro-mania below setups the CURLOPT_[what] enum, to be used with
00653  * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
00654  * word.
00655  */
00656 
00657 typedef enum {
00658   /* This is the FILE * or void * the regular output should be written to. */
00659   CINIT(FILE, OBJECTPOINT, 1),
00660 
00661   /* The full URL to get/put */
00662   CINIT(URL,  OBJECTPOINT, 2),
00663 
00664   /* Port number to connect to, if other than default. */
00665   CINIT(PORT, LONG, 3),
00666 
00667   /* Name of proxy to use. */
00668   CINIT(PROXY, OBJECTPOINT, 4),
00669 
00670   /* "name:password" to use when fetching. */
00671   CINIT(USERPWD, OBJECTPOINT, 5),
00672 
00673   /* "name:password" to use with proxy. */
00674   CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
00675 
00676   /* Range to get, specified as an ASCII string. */
00677   CINIT(RANGE, OBJECTPOINT, 7),
00678 
00679   /* not used */
00680 
00681   /* Specified file stream to upload from (use as input): */
00682   CINIT(INFILE, OBJECTPOINT, 9),
00683 
00684   /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
00685    * bytes big. If this is not used, error messages go to stderr instead: */
00686   CINIT(ERRORBUFFER, OBJECTPOINT, 10),
00687 
00688   /* Function that will be called to store the output (instead of fwrite). The
00689    * parameters will use fwrite() syntax, make sure to follow them. */
00690   CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
00691 
00692   /* Function that will be called to read the input (instead of fread). The
00693    * parameters will use fread() syntax, make sure to follow them. */
00694   CINIT(READFUNCTION, FUNCTIONPOINT, 12),
00695 
00696   /* Time-out the read operation after this amount of seconds */
00697   CINIT(TIMEOUT, LONG, 13),
00698 
00699   /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
00700    * how large the file being sent really is. That allows better error
00701    * checking and better verifies that the upload was successful. -1 means
00702    * unknown size.
00703    *
00704    * For large file support, there is also a _LARGE version of the key
00705    * which takes an off_t type, allowing platforms with larger off_t
00706    * sizes to handle larger files.  See below for INFILESIZE_LARGE.
00707    */
00708   CINIT(INFILESIZE, LONG, 14),
00709 
00710   /* POST static input fields. */
00711   CINIT(POSTFIELDS, OBJECTPOINT, 15),
00712 
00713   /* Set the referrer page (needed by some CGIs) */
00714   CINIT(REFERER, OBJECTPOINT, 16),
00715 
00716   /* Set the FTP PORT string (interface name, named or numerical IP address)
00717      Use i.e '-' to use default address. */
00718   CINIT(FTPPORT, OBJECTPOINT, 17),
00719 
00720   /* Set the User-Agent string (examined by some CGIs) */
00721   CINIT(USERAGENT, OBJECTPOINT, 18),
00722 
00723   /* If the download receives less than "low speed limit" bytes/second
00724    * during "low speed time" seconds, the operations is aborted.
00725    * You could i.e if you have a pretty high speed connection, abort if
00726    * it is less than 2000 bytes/sec during 20 seconds.
00727    */
00728 
00729   /* Set the "low speed limit" */
00730   CINIT(LOW_SPEED_LIMIT, LONG, 19),
00731 
00732   /* Set the "low speed time" */
00733   CINIT(LOW_SPEED_TIME, LONG, 20),
00734 
00735   /* Set the continuation offset.
00736    *
00737    * Note there is also a _LARGE version of this key which uses
00738    * off_t types, allowing for large file offsets on platforms which
00739    * use larger-than-32-bit off_t's.  Look below for RESUME_FROM_LARGE.
00740    */
00741   CINIT(RESUME_FROM, LONG, 21),
00742 
00743   /* Set cookie in request: */
00744   CINIT(COOKIE, OBJECTPOINT, 22),
00745 
00746   /* This points to a linked list of headers, struct curl_slist kind */
00747   CINIT(HTTPHEADER, OBJECTPOINT, 23),
00748 
00749   /* This points to a linked list of post entries, struct curl_httppost */
00750   CINIT(HTTPPOST, OBJECTPOINT, 24),
00751 
00752   /* name of the file keeping your private SSL-certificate */
00753   CINIT(SSLCERT, OBJECTPOINT, 25),
00754 
00755   /* password for the SSL or SSH private key */
00756   CINIT(KEYPASSWD, OBJECTPOINT, 26),
00757 
00758   /* send TYPE parameter? */
00759   CINIT(CRLF, LONG, 27),
00760 
00761   /* send linked-list of QUOTE commands */
00762   CINIT(QUOTE, OBJECTPOINT, 28),
00763 
00764   /* send FILE * or void * to store headers to, if you use a callback it
00765      is simply passed to the callback unmodified */
00766   CINIT(WRITEHEADER, OBJECTPOINT, 29),
00767 
00768   /* point to a file to read the initial cookies from, also enables
00769      "cookie awareness" */
00770   CINIT(COOKIEFILE, OBJECTPOINT, 31),
00771 
00772   /* What version to specifically try to use.
00773      See CURL_SSLVERSION defines below. */
00774   CINIT(SSLVERSION, LONG, 32),
00775 
00776   /* What kind of HTTP time condition to use, see defines */
00777   CINIT(TIMECONDITION, LONG, 33),
00778 
00779   /* Time to use with the above condition. Specified in number of seconds
00780      since 1 Jan 1970 */
00781   CINIT(TIMEVALUE, LONG, 34),
00782 
00783   /* 35 = OBSOLETE */
00784 
00785   /* Custom request, for customizing the get command like
00786      HTTP: DELETE, TRACE and others
00787      FTP: to use a different list command
00788      */
00789   CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
00790 
00791   /* HTTP request, for odd commands like DELETE, TRACE and others */
00792   CINIT(STDERR, OBJECTPOINT, 37),
00793 
00794   /* 38 is not used */
00795 
00796   /* send linked-list of post-transfer QUOTE commands */
00797   CINIT(POSTQUOTE, OBJECTPOINT, 39),
00798 
00799   /* Pass a pointer to string of the output using full variable-replacement
00800      as described elsewhere. */
00801   CINIT(WRITEINFO, OBJECTPOINT, 40),
00802 
00803   CINIT(VERBOSE, LONG, 41),      /* talk a lot */
00804   CINIT(HEADER, LONG, 42),       /* throw the header out too */
00805   CINIT(NOPROGRESS, LONG, 43),   /* shut off the progress meter */
00806   CINIT(NOBODY, LONG, 44),       /* use HEAD to get http document */
00807   CINIT(FAILONERROR, LONG, 45),  /* no output on http error codes >= 300 */
00808   CINIT(UPLOAD, LONG, 46),       /* this is an upload */
00809   CINIT(POST, LONG, 47),         /* HTTP POST method */
00810   CINIT(DIRLISTONLY, LONG, 48),  /* return bare names when listing directories */
00811 
00812   CINIT(APPEND, LONG, 50),       /* Append instead of overwrite on upload! */
00813 
00814   /* Specify whether to read the user+password from the .netrc or the URL.
00815    * This must be one of the CURL_NETRC_* enums below. */
00816   CINIT(NETRC, LONG, 51),
00817 
00818   CINIT(FOLLOWLOCATION, LONG, 52),  /* use Location: Luke! */
00819 
00820   CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
00821   CINIT(PUT, LONG, 54),          /* HTTP PUT */
00822 
00823   /* 55 = OBSOLETE */
00824 
00825   /* Function that will be called instead of the internal progress display
00826    * function. This function should be defined as the curl_progress_callback
00827    * prototype defines. */
00828   CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
00829 
00830   /* Data passed to the progress callback */
00831   CINIT(PROGRESSDATA, OBJECTPOINT, 57),
00832 
00833   /* We want the referrer field set automatically when following locations */
00834   CINIT(AUTOREFERER, LONG, 58),
00835 
00836   /* Port of the proxy, can be set in the proxy string as well with:
00837      "[host]:[port]" */
00838   CINIT(PROXYPORT, LONG, 59),
00839 
00840   /* size of the POST input data, if strlen() is not good to use */
00841   CINIT(POSTFIELDSIZE, LONG, 60),
00842 
00843   /* tunnel non-http operations through a HTTP proxy */
00844   CINIT(HTTPPROXYTUNNEL, LONG, 61),
00845 
00846   /* Set the interface string to use as outgoing network interface */
00847   CINIT(INTERFACE, OBJECTPOINT, 62),
00848 
00849   /* Set the krb4/5 security level, this also enables krb4/5 awareness.  This
00850    * is a string, 'clear', 'safe', 'confidential' or 'private'.  If the string
00851    * is set but doesn't match one of these, 'private' will be used.  */
00852   CINIT(KRBLEVEL, OBJECTPOINT, 63),
00853 
00854   /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
00855   CINIT(SSL_VERIFYPEER, LONG, 64),
00856 
00857   /* The CApath or CAfile used to validate the peer certificate
00858      this option is used only if SSL_VERIFYPEER is true */
00859   CINIT(CAINFO, OBJECTPOINT, 65),
00860 
00861   /* 66 = OBSOLETE */
00862   /* 67 = OBSOLETE */
00863 
00864   /* Maximum number of http redirects to follow */
00865   CINIT(MAXREDIRS, LONG, 68),
00866 
00867   /* Pass a long set to 1 to get the date of the requested document (if
00868      possible)! Pass a zero to shut it off. */
00869   CINIT(FILETIME, LONG, 69),
00870 
00871   /* This points to a linked list of telnet options */
00872   CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
00873 
00874   /* Max amount of cached alive connections */
00875   CINIT(MAXCONNECTS, LONG, 71),
00876 
00877   /* What policy to use when closing connections when the cache is filled
00878      up */
00879   CINIT(CLOSEPOLICY, LONG, 72),
00880 
00881   /* 73 = OBSOLETE */
00882 
00883   /* Set to explicitly use a new connection for the upcoming transfer.
00884      Do not use this unless you're absolutely sure of this, as it makes the
00885      operation slower and is less friendly for the network. */
00886   CINIT(FRESH_CONNECT, LONG, 74),
00887 
00888   /* Set to explicitly forbid the upcoming transfer's connection to be re-used
00889      when done. Do not use this unless you're absolutely sure of this, as it
00890      makes the operation slower and is less friendly for the network. */
00891   CINIT(FORBID_REUSE, LONG, 75),
00892 
00893   /* Set to a file name that contains random data for libcurl to use to
00894      seed the random engine when doing SSL connects. */
00895   CINIT(RANDOM_FILE, OBJECTPOINT, 76),
00896 
00897   /* Set to the Entropy Gathering Daemon socket pathname */
00898   CINIT(EGDSOCKET, OBJECTPOINT, 77),
00899 
00900   /* Time-out connect operations after this amount of seconds, if connects
00901      are OK within this time, then fine... This only aborts the connect
00902      phase. [Only works on unix-style/SIGALRM operating systems] */
00903   CINIT(CONNECTTIMEOUT, LONG, 78),
00904 
00905   /* Function that will be called to store headers (instead of fwrite). The
00906    * parameters will use fwrite() syntax, make sure to follow them. */
00907   CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
00908 
00909   /* Set this to force the HTTP request to get back to GET. Only really usable
00910      if POST, PUT or a custom request have been used first.
00911    */
00912   CINIT(HTTPGET, LONG, 80),
00913 
00914   /* Set if we should verify the Common name from the peer certificate in ssl
00915    * handshake, set 1 to check existence, 2 to ensure that it matches the
00916    * provided hostname. */
00917   CINIT(SSL_VERIFYHOST, LONG, 81),
00918 
00919   /* Specify which file name to write all known cookies in after completed
00920      operation. Set file name to "-" (dash) to make it go to stdout. */
00921   CINIT(COOKIEJAR, OBJECTPOINT, 82),
00922 
00923   /* Specify which SSL ciphers to use */
00924   CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),
00925 
00926   /* Specify which HTTP version to use! This must be set to one of the
00927      CURL_HTTP_VERSION* enums set below. */
00928   CINIT(HTTP_VERSION, LONG, 84),
00929 
00930   /* Specifically switch on or off the FTP engine's use of the EPSV command. By
00931      default, that one will always be attempted before the more traditional
00932      PASV command. */
00933   CINIT(FTP_USE_EPSV, LONG, 85),
00934 
00935   /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
00936   CINIT(SSLCERTTYPE, OBJECTPOINT, 86),
00937 
00938   /* name of the file keeping your private SSL-key */
00939   CINIT(SSLKEY, OBJECTPOINT, 87),
00940 
00941   /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
00942   CINIT(SSLKEYTYPE, OBJECTPOINT, 88),
00943 
00944   /* crypto engine for the SSL-sub system */
00945   CINIT(SSLENGINE, OBJECTPOINT, 89),
00946 
00947   /* set the crypto engine for the SSL-sub system as default
00948      the param has no meaning...
00949    */
00950   CINIT(SSLENGINE_DEFAULT, LONG, 90),
00951 
00952   /* Non-zero value means to use the global dns cache */
00953   CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */
00954 
00955   /* DNS cache timeout */
00956   CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
00957 
00958   /* send linked-list of pre-transfer QUOTE commands */
00959   CINIT(PREQUOTE, OBJECTPOINT, 93),
00960 
00961   /* set the debug function */
00962   CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
00963 
00964   /* set the data for the debug function */
00965   CINIT(DEBUGDATA, OBJECTPOINT, 95),
00966 
00967   /* mark this as start of a cookie session */
00968   CINIT(COOKIESESSION, LONG, 96),
00969 
00970   /* The CApath directory used to validate the peer certificate
00971      this option is used only if SSL_VERIFYPEER is true */
00972   CINIT(CAPATH, OBJECTPOINT, 97),
00973 
00974   /* Instruct libcurl to use a smaller receive buffer */
00975   CINIT(BUFFERSIZE, LONG, 98),
00976 
00977   /* Instruct libcurl to not use any signal/alarm handlers, even when using
00978      timeouts. This option is useful for multi-threaded applications.
00979      See libcurl-the-guide for more background information. */
00980   CINIT(NOSIGNAL, LONG, 99),
00981 
00982   /* Provide a CURLShare for mutexing non-ts data */
00983   CINIT(SHARE, OBJECTPOINT, 100),
00984 
00985   /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
00986      CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
00987   CINIT(PROXYTYPE, LONG, 101),
00988 
00989   /* Set the Accept-Encoding string. Use this to tell a server you would like
00990      the response to be compressed. */
00991   CINIT(ENCODING, OBJECTPOINT, 102),
00992 
00993   /* Set pointer to private data */
00994   CINIT(PRIVATE, OBJECTPOINT, 103),
00995 
00996   /* Set aliases for HTTP 200 in the HTTP Response header */
00997   CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
00998 
00999   /* Continue to send authentication (user+password) when following locations,
01000      even when hostname changed. This can potentially send off the name
01001      and password to whatever host the server decides. */
01002   CINIT(UNRESTRICTED_AUTH, LONG, 105),
01003 
01004   /* Specifically switch on or off the FTP engine's use of the EPRT command ( it
01005      also disables the LPRT attempt). By default, those ones will always be
01006      attempted before the good old traditional PORT command. */
01007   CINIT(FTP_USE_EPRT, LONG, 106),
01008 
01009   /* Set this to a bitmask value to enable the particular authentications
01010      methods you like. Use this in combination with CURLOPT_USERPWD.
01011      Note that setting multiple bits may cause extra network round-trips. */
01012   CINIT(HTTPAUTH, LONG, 107),
01013 
01014   /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
01015      in second argument. The function must be matching the
01016      curl_ssl_ctx_callback proto. */
01017   CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
01018 
01019   /* Set the userdata for the ssl context callback function's third
01020      argument */
01021   CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
01022 
01023   /* FTP Option that causes missing dirs to be created on the remote server.
01024      In 7.19.4 we introduced the convenience enums for this option using the
01025      CURLFTP_CREATE_DIR prefix.
01026   */
01027   CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
01028 
01029   /* Set this to a bitmask value to enable the particular authentications
01030      methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
01031      Note that setting multiple bits may cause extra network round-trips. */
01032   CINIT(PROXYAUTH, LONG, 111),
01033 
01034   /* FTP option that changes the timeout, in seconds, associated with
01035      getting a response.  This is different from transfer timeout time and
01036      essentially places a demand on the FTP server to acknowledge commands
01037      in a timely manner. */
01038   CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
01039 
01040   /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
01041      tell libcurl to resolve names to those IP versions only. This only has
01042      affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
01043   CINIT(IPRESOLVE, LONG, 113),
01044 
01045   /* Set this option to limit the size of a file that will be downloaded from
01046      an HTTP or FTP server.
01047 
01048      Note there is also _LARGE version which adds large file support for
01049      platforms which have larger off_t sizes.  See MAXFILESIZE_LARGE below. */
01050   CINIT(MAXFILESIZE, LONG, 114),
01051 
01052   /* See the comment for INFILESIZE above, but in short, specifies
01053    * the size of the file being uploaded.  -1 means unknown.
01054    */
01055   CINIT(INFILESIZE_LARGE, OFF_T, 115),
01056 
01057   /* Sets the continuation offset.  There is also a LONG version of this;
01058    * look above for RESUME_FROM.
01059    */
01060   CINIT(RESUME_FROM_LARGE, OFF_T, 116),
01061 
01062   /* Sets the maximum size of data that will be downloaded from
01063    * an HTTP or FTP server.  See MAXFILESIZE above for the LONG version.
01064    */
01065   CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
01066 
01067   /* Set this option to the file name of your .netrc file you want libcurl
01068      to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
01069      a poor attempt to find the user's home directory and check for a .netrc
01070      file in there. */
01071   CINIT(NETRC_FILE, OBJECTPOINT, 118),
01072 
01073   /* Enable SSL/TLS for FTP, pick one of:
01074      CURLFTPSSL_TRY     - try using SSL, proceed anyway otherwise
01075      CURLFTPSSL_CONTROL - SSL for the control connection or fail
01076      CURLFTPSSL_ALL     - SSL for all communication or fail
01077   */
01078   CINIT(USE_SSL, LONG, 119),
01079 
01080   /* The _LARGE version of the standard POSTFIELDSIZE option */
01081   CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
01082 
01083   /* Enable/disable the TCP Nagle algorithm */
01084   CINIT(TCP_NODELAY, LONG, 121),
01085 
01086   /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
01087   /* 123 OBSOLETE. Gone in 7.16.0 */
01088   /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
01089   /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
01090   /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
01091   /* 127 OBSOLETE. Gone in 7.16.0 */
01092   /* 128 OBSOLETE. Gone in 7.16.0 */
01093 
01094   /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
01095      can be used to change libcurl's default action which is to first try
01096      "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
01097      response has been received.
01098 
01099      Available parameters are:
01100      CURLFTPAUTH_DEFAULT - let libcurl decide
01101      CURLFTPAUTH_SSL     - try "AUTH SSL" first, then TLS
01102      CURLFTPAUTH_TLS     - try "AUTH TLS" first, then SSL
01103   */
01104   CINIT(FTPSSLAUTH, LONG, 129),
01105 
01106   CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
01107   CINIT(IOCTLDATA, OBJECTPOINT, 131),
01108 
01109   /* 132 OBSOLETE. Gone in 7.16.0 */
01110   /* 133 OBSOLETE. Gone in 7.16.0 */
01111 
01112   /* zero terminated string for pass on to the FTP server when asked for
01113      "account" info */
01114   CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
01115 
01116   /* feed cookies into cookie engine */
01117   CINIT(COOKIELIST, OBJECTPOINT, 135),
01118 
01119   /* ignore Content-Length */
01120   CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
01121 
01122   /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
01123      response. Typically used for FTP-SSL purposes but is not restricted to
01124      that. libcurl will then instead use the same IP address it used for the
01125      control connection. */
01126   CINIT(FTP_SKIP_PASV_IP, LONG, 137),
01127 
01128   /* Select "file method" to use when doing FTP, see the curl_ftpmethod
01129      above. */
01130   CINIT(FTP_FILEMETHOD, LONG, 138),
01131 
01132   /* Local port number to bind the socket to */
01133   CINIT(LOCALPORT, LONG, 139),
01134 
01135   /* Number of ports to try, including the first one set with LOCALPORT.
01136      Thus, setting it to 1 will make no additional attempts but the first.
01137   */
01138   CINIT(LOCALPORTRANGE, LONG, 140),
01139 
01140   /* no transfer, set up connection and let application use the socket by
01141      extracting it with CURLINFO_LASTSOCKET */
01142   CINIT(CONNECT_ONLY, LONG, 141),
01143 
01144   /* Function that will be called to convert from the
01145      network encoding (instead of using the iconv calls in libcurl) */
01146   CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),
01147 
01148   /* Function that will be called to convert to the
01149      network encoding (instead of using the iconv calls in libcurl) */
01150   CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),
01151 
01152   /* Function that will be called to convert from UTF8
01153      (instead of using the iconv calls in libcurl)
01154      Note that this is used only for SSL certificate processing */
01155   CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
01156 
01157   /* if the connection proceeds too quickly then need to slow it down */
01158   /* limit-rate: maximum number of bytes per second to send or receive */
01159   CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
01160   CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
01161 
01162   /* Pointer to command string to send if USER/PASS fails. */
01163   CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),
01164 
01165   /* callback function for setting socket options */
01166   CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
01167   CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
01168 
01169   /* set to 0 to disable session ID re-use for this transfer, default is
01170      enabled (== 1) */
01171   CINIT(SSL_SESSIONID_CACHE, LONG, 150),
01172 
01173   /* allowed SSH authentication methods */
01174   CINIT(SSH_AUTH_TYPES, LONG, 151),
01175 
01176   /* Used by scp/sftp to do public/private key authentication */
01177   CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),
01178   CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),
01179 
01180   /* Send CCC (Clear Command Channel) after authentication */
01181   CINIT(FTP_SSL_CCC, LONG, 154),
01182 
01183   /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
01184   CINIT(TIMEOUT_MS, LONG, 155),
01185   CINIT(CONNECTTIMEOUT_MS, LONG, 156),
01186 
01187   /* set to zero to disable the libcurl's decoding and thus pass the raw body
01188      data to the application even when it is encoded/compressed */
01189   CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
01190   CINIT(HTTP_CONTENT_DECODING, LONG, 158),
01191 
01192   /* Permission used when creating new files and directories on the remote
01193      server for protocols that support it, SFTP/SCP/FILE */
01194   CINIT(NEW_FILE_PERMS, LONG, 159),
01195   CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
01196 
01197   /* Set the behaviour of POST when redirecting. Values must be set to one
01198      of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
01199   CINIT(POSTREDIR, LONG, 161),
01200 
01201   /* used by scp/sftp to verify the host's public key */
01202   CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),
01203 
01204   /* Callback function for opening socket (instead of socket(2)). Optionally,
01205      callback is able change the address or refuse to connect returning
01206      CURL_SOCKET_BAD.  The callback should have type
01207      curl_opensocket_callback */
01208   CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
01209   CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
01210 
01211   /* POST volatile input fields. */
01212   CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),
01213 
01214   /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
01215   CINIT(PROXY_TRANSFER_MODE, LONG, 166),
01216 
01217   /* Callback function for seeking in the input stream */
01218   CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
01219   CINIT(SEEKDATA, OBJECTPOINT, 168),
01220 
01221   /* CRL file */
01222   CINIT(CRLFILE, OBJECTPOINT, 169),
01223 
01224   /* Issuer certificate */
01225   CINIT(ISSUERCERT, OBJECTPOINT, 170),
01226 
01227   /* (IPv6) Address scope */
01228   CINIT(ADDRESS_SCOPE, LONG, 171),
01229 
01230   /* Collect certificate chain info and allow it to get retrievable with
01231      CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only
01232      working with OpenSSL-powered builds. */
01233   CINIT(CERTINFO, LONG, 172),
01234 
01235   /* "name" and "pwd" to use when fetching. */
01236   CINIT(USERNAME, OBJECTPOINT, 173),
01237   CINIT(PASSWORD, OBJECTPOINT, 174),
01238 
01239     /* "name" and "pwd" to use with Proxy when fetching. */
01240   CINIT(PROXYUSERNAME, OBJECTPOINT, 175),
01241   CINIT(PROXYPASSWORD, OBJECTPOINT, 176),
01242 
01243   /* Comma separated list of hostnames defining no-proxy zones. These should
01244      match both hostnames directly, and hostnames within a domain. For
01245      example, local.com will match local.com and www.local.com, but NOT
01246      notlocal.com or www.notlocal.com. For compatibility with other
01247      implementations of this, .local.com will be considered to be the same as
01248      local.com. A single * is the only valid wildcard, and effectively
01249      disables the use of proxy. */
01250   CINIT(NOPROXY, OBJECTPOINT, 177),
01251 
01252   /* block size for TFTP transfers */
01253   CINIT(TFTP_BLKSIZE, LONG, 178),
01254 
01255   /* Socks Service */
01256   CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),
01257 
01258   /* Socks Service */
01259   CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
01260 
01261   /* set the bitmask for the protocols that are allowed to be used for the
01262      transfer, which thus helps the app which takes URLs from users or other
01263      external inputs and want to restrict what protocol(s) to deal
01264      with. Defaults to CURLPROTO_ALL. */
01265   CINIT(PROTOCOLS, LONG, 181),
01266 
01267   /* set the bitmask for the protocols that libcurl is allowed to follow to,
01268      as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
01269      to be set in both bitmasks to be allowed to get redirected to. Defaults
01270      to all protocols except FILE and SCP. */
01271   CINIT(REDIR_PROTOCOLS, LONG, 182),
01272 
01273   /* set the SSH knownhost file name to use */
01274   CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),
01275 
01276   /* set the SSH host key callback, must point to a curl_sshkeycallback
01277      function */
01278   CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),
01279 
01280   /* set the SSH host key callback custom pointer */
01281   CINIT(SSH_KEYDATA, OBJECTPOINT, 185),
01282 
01283   CURLOPT_LASTENTRY /* the last unused */
01284 } CURLoption;
01285 
01286 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
01287                           the obsolete stuff removed! */
01288 
01289 /* Backwards compatibility with older names */
01290 /* These are scheduled to disappear by 2011 */
01291 
01292 /* This was added in version 7.19.1 */
01293 #define CURLOPT_POST301 CURLOPT_POSTREDIR
01294 
01295 /* These are scheduled to disappear by 2009 */
01296 
01297 /* The following were added in 7.17.0 */
01298 #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
01299 #define CURLOPT_FTPAPPEND CURLOPT_APPEND
01300 #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
01301 #define CURLOPT_FTP_SSL CURLOPT_USE_SSL
01302 
01303 /* The following were added earlier */
01304 
01305 #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
01306 #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
01307 
01308 #else
01309 /* This is set if CURL_NO_OLDIES is defined at compile-time */
01310 #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
01311 #endif
01312 
01313 
01314   /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
01315      name resolves addresses using more than one IP protocol version, this
01316      option might be handy to force libcurl to use a specific IP version. */
01317 #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
01318                                      versions that your system allows */
01319 #define CURL_IPRESOLVE_V4       1 /* resolve to ipv4 addresses */
01320 #define CURL_IPRESOLVE_V6       2 /* resolve to ipv6 addresses */
01321 
01322   /* three convenient "aliases" that follow the name scheme better */
01323 #define CURLOPT_WRITEDATA CURLOPT_FILE
01324 #define CURLOPT_READDATA  CURLOPT_INFILE
01325 #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
01326 
01327   /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
01328 enum {
01329   CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
01330                              like the library to choose the best possible
01331                              for us! */
01332   CURL_HTTP_VERSION_1_0,  /* please use HTTP 1.0 in the request */
01333   CURL_HTTP_VERSION_1_1,  /* please use HTTP 1.1 in the request */
01334 
01335   CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
01336 };
01337 
01338   /* These enums are for use with the CURLOPT_NETRC option. */
01339 enum CURL_NETRC_OPTION {
01340   CURL_NETRC_IGNORED,     /* The .netrc will never be read.
01341                            * This is the default. */
01342   CURL_NETRC_OPTIONAL,    /* A user:password in the URL will be preferred
01343                            * to one in the .netrc. */
01344   CURL_NETRC_REQUIRED,    /* A user:password in the URL will be ignored.
01345                            * Unless one is set programmatically, the .netrc
01346                            * will be queried. */
01347   CURL_NETRC_LAST
01348 };
01349 
01350 enum {
01351   CURL_SSLVERSION_DEFAULT,
01352   CURL_SSLVERSION_TLSv1,
01353   CURL_SSLVERSION_SSLv2,
01354   CURL_SSLVERSION_SSLv3,
01355 
01356   CURL_SSLVERSION_LAST /* never use, keep last */
01357 };
01358 
01359 /* symbols to use with CURLOPT_POSTREDIR.
01360    CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that
01361    CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */
01362 
01363 #define CURL_REDIR_GET_ALL  0
01364 #define CURL_REDIR_POST_301 1
01365 #define CURL_REDIR_POST_302 2
01366 #define CURL_REDIR_POST_ALL (CURL_REDIR_POST_301|CURL_REDIR_POST_302)
01367 
01368 typedef enum {
01369   CURL_TIMECOND_NONE,
01370 
01371   CURL_TIMECOND_IFMODSINCE,
01372   CURL_TIMECOND_IFUNMODSINCE,
01373   CURL_TIMECOND_LASTMOD,
01374 
01375   CURL_TIMECOND_LAST
01376 } curl_TimeCond;
01377 
01378 
01379 /* curl_strequal() and curl_strnequal() are subject for removal in a future
01380    libcurl, see lib/README.curlx for details */
01381 CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
01382 CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
01383 
01384 /* name is uppercase CURLFORM_<name> */
01385 #ifdef CFINIT
01386 #undef CFINIT
01387 #endif
01388 
01389 #ifdef CURL_ISOCPP
01390 #define CFINIT(name) CURLFORM_ ## name
01391 #else
01392 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
01393 #define CFINIT(name) CURLFORM_name
01394 #endif
01395 
01396 typedef enum {
01397   CFINIT(NOTHING),        /********* the first one is unused ************/
01398 
01399   /*  */
01400   CFINIT(COPYNAME),
01401   CFINIT(PTRNAME),
01402   CFINIT(NAMELENGTH),
01403   CFINIT(COPYCONTENTS),
01404   CFINIT(PTRCONTENTS),
01405   CFINIT(CONTENTSLENGTH),
01406   CFINIT(FILECONTENT),
01407   CFINIT(ARRAY),
01408   CFINIT(OBSOLETE),
01409   CFINIT(FILE),
01410 
01411   CFINIT(BUFFER),
01412   CFINIT(BUFFERPTR),
01413   CFINIT(BUFFERLENGTH),
01414 
01415   CFINIT(CONTENTTYPE),
01416   CFINIT(CONTENTHEADER),
01417   CFINIT(FILENAME),
01418   CFINIT(END),
01419   CFINIT(OBSOLETE2),
01420 
01421   CFINIT(STREAM),
01422 
01423   CURLFORM_LASTENTRY /* the last unused */
01424 } CURLformoption;
01425 
01426 #undef CFINIT /* done */
01427 
01428 /* structure to be used as parameter for CURLFORM_ARRAY */
01429 struct curl_forms {
01430   CURLformoption option;
01431   const char     *value;
01432 };
01433 
01434 /* use this for multipart formpost building */
01435 /* Returns code for curl_formadd()
01436  *
01437  * Returns:
01438  * CURL_FORMADD_OK             on success
01439  * CURL_FORMADD_MEMORY         if the FormInfo allocation fails
01440  * CURL_FORMADD_OPTION_TWICE   if one option is given twice for one Form
01441  * CURL_FORMADD_NULL           if a null pointer was given for a char
01442  * CURL_FORMADD_MEMORY         if the allocation of a FormInfo struct failed
01443  * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
01444  * CURL_FORMADD_INCOMPLETE     if the some FormInfo is not complete (or error)
01445  * CURL_FORMADD_MEMORY         if a curl_httppost struct cannot be allocated
01446  * CURL_FORMADD_MEMORY         if some allocation for string copying failed.
01447  * CURL_FORMADD_ILLEGAL_ARRAY  if an illegal option is used in an array
01448  *
01449  ***************************************************************************/
01450 typedef enum {
01451   CURL_FORMADD_OK, /* first, no error */
01452 
01453   CURL_FORMADD_MEMORY,
01454   CURL_FORMADD_OPTION_TWICE,
01455   CURL_FORMADD_NULL,
01456   CURL_FORMADD_UNKNOWN_OPTION,
01457   CURL_FORMADD_INCOMPLETE,
01458   CURL_FORMADD_ILLEGAL_ARRAY,
01459   CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
01460 
01461   CURL_FORMADD_LAST /* last */
01462 } CURLFORMcode;
01463 
01464 /*
01465  * NAME curl_formadd()
01466  *
01467  * DESCRIPTION
01468  *
01469  * Pretty advanced function for building multi-part formposts. Each invoke
01470  * adds one part that together construct a full post. Then use
01471  * CURLOPT_HTTPPOST to send it off to libcurl.
01472  */
01473 CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
01474                                       struct curl_httppost **last_post,
01475                                       ...);
01476 
01477 /*
01478  * callback function for curl_formget()
01479  * The void *arg pointer will be the one passed as second argument to
01480  *   curl_formget().
01481  * The character buffer passed to it must not be freed.
01482  * Should return the buffer length passed to it as the argument "len" on
01483  *   success.
01484  */
01485 typedef size_t (*curl_formget_callback)(void *arg, const char *buf, size_t len);
01486 
01487 /*
01488  * NAME curl_formget()
01489  *
01490  * DESCRIPTION
01491  *
01492  * Serialize a curl_httppost struct built with curl_formadd().
01493  * Accepts a void pointer as second argument which will be passed to
01494  * the curl_formget_callback function.
01495  * Returns 0 on success.
01496  */
01497 CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
01498                              curl_formget_callback append);
01499 /*
01500  * NAME curl_formfree()
01501  *
01502  * DESCRIPTION
01503  *
01504  * Free a multipart formpost previously built with curl_formadd().
01505  */
01506 CURL_EXTERN void curl_formfree(struct curl_httppost *form);
01507 
01508 /*
01509  * NAME curl_getenv()
01510  *
01511  * DESCRIPTION
01512  *
01513  * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
01514  * complete. DEPRECATED - see lib/README.curlx
01515  */
01516 CURL_EXTERN char *curl_getenv(const char *variable);
01517 
01518 /*
01519  * NAME curl_version()
01520  *
01521  * DESCRIPTION
01522  *
01523  * Returns a static ascii string of the libcurl version.
01524  */
01525 CURL_EXTERN char *curl_version(void);
01526 
01527 /*
01528  * NAME curl_easy_escape()
01529  *
01530  * DESCRIPTION
01531  *
01532  * Escapes URL strings (converts all letters consider illegal in URLs to their
01533  * %XX versions). This function returns a new allocated string or NULL if an
01534  * error occurred.
01535  */
01536 CURL_EXTERN char *curl_easy_escape(CURL *handle,
01537                                    const char *string,
01538                                    int length);
01539 
01540 /* the previous version: */
01541 CURL_EXTERN char *curl_escape(const char *string,
01542                               int length);
01543 
01544 
01545 /*
01546  * NAME curl_easy_unescape()
01547  *
01548  * DESCRIPTION
01549  *
01550  * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
01551  * versions). This function returns a new allocated string or NULL if an error
01552  * occurred.
01553  * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
01554  * converted into the host encoding.
01555  */
01556 CURL_EXTERN char *curl_easy_unescape(CURL *handle,
01557                                      const char *string,
01558                                      int length,
01559                                      int *outlength);
01560 
01561 /* the previous version */
01562 CURL_EXTERN char *curl_unescape(const char *string,
01563                                 int length);
01564 
01565 /*
01566  * NAME curl_free()
01567  *
01568  * DESCRIPTION
01569  *
01570  * Provided for de-allocation in the same translation unit that did the
01571  * allocation. Added in libcurl 7.10
01572  */
01573 CURL_EXTERN void curl_free(void *p);
01574 
01575 /*
01576  * NAME curl_global_init()
01577  *
01578  * DESCRIPTION
01579  *
01580  * curl_global_init() should be invoked exactly once for each application that
01581  * uses libcurl and before any call of other libcurl functions.
01582  *
01583  * This function is not thread-safe!
01584  */
01585 CURL_EXTERN CURLcode curl_global_init(long flags);
01586 
01587 /*
01588  * NAME curl_global_init_mem()
01589  *
01590  * DESCRIPTION
01591  *
01592  * curl_global_init() or curl_global_init_mem() should be invoked exactly once
01593  * for each application that uses libcurl.  This function can be used to
01594  * initialize libcurl and set user defined memory management callback
01595  * functions.  Users can implement memory management routines to check for
01596  * memory leaks, check for mis-use of the curl library etc.  User registered
01597  * callback routines with be invoked by this library instead of the system
01598  * memory management routines like malloc, free etc.
01599  */
01600 CURL_EXTERN CURLcode curl_global_init_mem(long flags,
01601                                           curl_malloc_callback m,
01602                                           curl_free_callback f,
01603                                           curl_realloc_callback r,
01604                                           curl_strdup_callback s,
01605                                           curl_calloc_callback c);
01606 
01607 /*
01608  * NAME curl_global_cleanup()
01609  *
01610  * DESCRIPTION
01611  *
01612  * curl_global_cleanup() should be invoked exactly once for each application
01613  * that uses libcurl
01614  */
01615 CURL_EXTERN void curl_global_cleanup(void);
01616 
01617 /* linked-list structure for the CURLOPT_QUOTE option (and other) */
01618 struct curl_slist {
01619   char *data;
01620   struct curl_slist *next;
01621 };
01622 
01623 /*
01624  * NAME curl_slist_append()
01625  *
01626  * DESCRIPTION
01627  *
01628  * Appends a string to a linked list. If no list exists, it will be created
01629  * first. Returns the new list, after appending.
01630  */
01631 CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
01632                                                  const char *);
01633 
01634 /*
01635  * NAME curl_slist_free_all()
01636  *
01637  * DESCRIPTION
01638  *
01639  * free a previously built curl_slist.
01640  */
01641 CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
01642 
01643 /*
01644  * NAME curl_getdate()
01645  *
01646  * DESCRIPTION
01647  *
01648  * Returns the time, in seconds since 1 Jan 1970 of the time string given in
01649  * the first argument. The time argument in the second parameter is unused
01650  * and should be set to NULL.
01651  */
01652 CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
01653 
01654 /* info about the certificate chain, only for OpenSSL builds. Asked
01655    for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
01656 struct curl_certinfo {
01657   int num_of_certs;             /* number of certificates with information */
01658   struct curl_slist **certinfo; /* for each index in this array, there's a
01659                                    linked list with textual information in the
01660                                    format "name: value" */
01661 };
01662 
01663 #define CURLINFO_STRING   0x100000
01664 #define CURLINFO_LONG     0x200000
01665 #define CURLINFO_DOUBLE   0x300000
01666 #define CURLINFO_SLIST    0x400000
01667 #define CURLINFO_MASK     0x0fffff
01668 #define CURLINFO_TYPEMASK 0xf00000
01669 
01670 typedef enum {
01671   CURLINFO_NONE, /* first, never use this */
01672   CURLINFO_EFFECTIVE_URL    = CURLINFO_STRING + 1,
01673   CURLINFO_RESPONSE_CODE    = CURLINFO_LONG   + 2,
01674   CURLINFO_TOTAL_TIME       = CURLINFO_DOUBLE + 3,
01675   CURLINFO_NAMELOOKUP_TIME  = CURLINFO_DOUBLE + 4,
01676   CURLINFO_CONNECT_TIME     = CURLINFO_DOUBLE + 5,
01677   CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
01678   CURLINFO_SIZE_UPLOAD      = CURLINFO_DOUBLE + 7,
01679   CURLINFO_SIZE_DOWNLOAD    = CURLINFO_DOUBLE + 8,
01680   CURLINFO_SPEED_DOWNLOAD   = CURLINFO_DOUBLE + 9,
01681   CURLINFO_SPEED_UPLOAD     = CURLINFO_DOUBLE + 10,
01682   CURLINFO_HEADER_SIZE      = CURLINFO_LONG   + 11,
01683   CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,
01684   CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,
01685   CURLINFO_FILETIME         = CURLINFO_LONG   + 14,
01686   CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,
01687   CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,
01688   CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
01689   CURLINFO_CONTENT_TYPE     = CURLINFO_STRING + 18,
01690   CURLINFO_REDIRECT_TIME    = CURLINFO_DOUBLE + 19,
01691   CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG   + 20,
01692   CURLINFO_PRIVATE          = CURLINFO_STRING + 21,
01693   CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,
01694   CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,
01695   CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,
01696   CURLINFO_OS_ERRNO         = CURLINFO_LONG   + 25,
01697   CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,
01698   CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,
01699   CURLINFO_COOKIELIST       = CURLINFO_SLIST  + 28,
01700   CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,
01701   CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,
01702   CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,
01703   CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,
01704   CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,
01705   CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,
01706   CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,
01707   /* Fill in new entries below here! */
01708 
01709   CURLINFO_LASTONE          = 35
01710 } CURLINFO;
01711 
01712 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
01713    CURLINFO_HTTP_CODE */
01714 #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
01715 
01716 typedef enum {
01717   CURLCLOSEPOLICY_NONE, /* first, never use this */
01718 
01719   CURLCLOSEPOLICY_OLDEST,
01720   CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
01721   CURLCLOSEPOLICY_LEAST_TRAFFIC,
01722   CURLCLOSEPOLICY_SLOWEST,
01723   CURLCLOSEPOLICY_CALLBACK,
01724 
01725   CURLCLOSEPOLICY_LAST /* last, never use this */
01726 } curl_closepolicy;
01727 
01728 #define CURL_GLOBAL_SSL (1<<0)
01729 #define CURL_GLOBAL_WIN32 (1<<1)
01730 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
01731 #define CURL_GLOBAL_NOTHING 0
01732 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
01733 
01734 
01735 /*****************************************************************************
01736  * Setup defines, protos etc for the sharing stuff.
01737  */
01738 
01739 /* Different data locks for a single share */
01740 typedef enum {
01741   CURL_LOCK_DATA_NONE = 0,
01742   /*  CURL_LOCK_DATA_SHARE is used internally to say that
01743    *  the locking is just made to change the internal state of the share
01744    *  itself.
01745    */
01746   CURL_LOCK_DATA_SHARE,
01747   CURL_LOCK_DATA_COOKIE,
01748   CURL_LOCK_DATA_DNS,
01749   CURL_LOCK_DATA_SSL_SESSION,
01750   CURL_LOCK_DATA_CONNECT,
01751   CURL_LOCK_DATA_LAST
01752 } curl_lock_data;
01753 
01754 /* Different lock access types */
01755 typedef enum {
01756   CURL_LOCK_ACCESS_NONE = 0,   /* unspecified action */
01757   CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
01758   CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
01759   CURL_LOCK_ACCESS_LAST        /* never use */
01760 } curl_lock_access;
01761 
01762 typedef void (*curl_lock_function)(CURL *handle,
01763                                    curl_lock_data data,
01764                                    curl_lock_access locktype,
01765                                    void *userptr);
01766 typedef void (*curl_unlock_function)(CURL *handle,
01767                                      curl_lock_data data,
01768                                      void *userptr);
01769 
01770 typedef void CURLSH;
01771 
01772 typedef enum {
01773   CURLSHE_OK,  /* all is fine */
01774   CURLSHE_BAD_OPTION, /* 1 */
01775   CURLSHE_IN_USE,     /* 2 */
01776   CURLSHE_INVALID,    /* 3 */
01777   CURLSHE_NOMEM,      /* out of memory */
01778   CURLSHE_LAST /* never use */
01779 } CURLSHcode;
01780 
01781 typedef enum {
01782   CURLSHOPT_NONE,  /* don't use */
01783   CURLSHOPT_SHARE,   /* specify a data type to share */
01784   CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */
01785   CURLSHOPT_LOCKFUNC,   /* pass in a 'curl_lock_function' pointer */
01786   CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
01787   CURLSHOPT_USERDATA,   /* pass in a user data pointer used in the lock/unlock
01788                            callback functions */
01789   CURLSHOPT_LAST  /* never use */
01790 } CURLSHoption;
01791 
01792 CURL_EXTERN CURLSH *curl_share_init(void);
01793 CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
01794 CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
01795 
01796 /****************************************************************************
01797  * Structures for querying information about the curl library at runtime.
01798  */
01799 
01800 typedef enum {
01801   CURLVERSION_FIRST,
01802   CURLVERSION_SECOND,
01803   CURLVERSION_THIRD,
01804   CURLVERSION_FOURTH,
01805   CURLVERSION_LAST /* never actually use this */
01806 } CURLversion;
01807 
01808 /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
01809    basically all programs ever that want to get version information. It is
01810    meant to be a built-in version number for what kind of struct the caller
01811    expects. If the struct ever changes, we redefine the NOW to another enum
01812    from above. */
01813 #define CURLVERSION_NOW CURLVERSION_FOURTH
01814 
01815 typedef struct {
01816   CURLversion age;          /* age of the returned struct */
01817   const char *version;      /* LIBCURL_VERSION */
01818   unsigned int version_num; /* LIBCURL_VERSION_NUM */
01819   const char *host;         /* OS/host/cpu/machine when configured */
01820   int features;             /* bitmask, see defines below */
01821   const char *ssl_version;  /* human readable string */
01822   long ssl_version_num;     /* not used anymore, always 0 */
01823   const char *libz_version; /* human readable string */
01824   /* protocols is terminated by an entry with a NULL protoname */
01825   const char * const *protocols;
01826 
01827   /* The fields below this were added in CURLVERSION_SECOND */
01828   const char *ares;
01829   int ares_num;
01830 
01831   /* This field was added in CURLVERSION_THIRD */
01832   const char *libidn;
01833 
01834   /* These field were added in CURLVERSION_FOURTH */
01835 
01836   /* Same as '_libiconv_version' if built with HAVE_ICONV */
01837   int iconv_ver_num;
01838 
01839   const char *libssh_version; /* human readable string */
01840 
01841 } curl_version_info_data;
01842 
01843 #define CURL_VERSION_IPV6      (1<<0)  /* IPv6-enabled */
01844 #define CURL_VERSION_KERBEROS4 (1<<1)  /* kerberos auth is supported */
01845 #define CURL_VERSION_SSL       (1<<2)  /* SSL options are present */
01846 #define CURL_VERSION_LIBZ      (1<<3)  /* libz features are present */
01847 #define CURL_VERSION_NTLM      (1<<4)  /* NTLM auth is supported */
01848 #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */
01849 #define CURL_VERSION_DEBUG     (1<<6)  /* built with debug capabilities */
01850 #define CURL_VERSION_ASYNCHDNS (1<<7)  /* asynchronous dns resolves */
01851 #define CURL_VERSION_SPNEGO    (1<<8)  /* SPNEGO auth */
01852 #define CURL_VERSION_LARGEFILE (1<<9)  /* supports files bigger than 2GB */
01853 #define CURL_VERSION_IDN       (1<<10) /* International Domain Names support */
01854 #define CURL_VERSION_SSPI      (1<<11) /* SSPI is supported */
01855 #define CURL_VERSION_CONV      (1<<12) /* character conversions supported */
01856 #define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */
01857 
01858 /*
01859  * NAME curl_version_info()
01860  *
01861  * DESCRIPTION
01862  *
01863  * This function returns a pointer to a static copy of the version info
01864  * struct. See above.
01865  */
01866 CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
01867 
01868 /*
01869  * NAME curl_easy_strerror()
01870  *
01871  * DESCRIPTION
01872  *
01873  * The curl_easy_strerror function may be used to turn a CURLcode value
01874  * into the equivalent human readable error string.  This is useful
01875  * for printing meaningful error messages.
01876  */
01877 CURL_EXTERN const char *curl_easy_strerror(CURLcode);
01878 
01879 /*
01880  * NAME curl_share_strerror()
01881  *
01882  * DESCRIPTION
01883  *
01884  * The curl_share_strerror function may be used to turn a CURLSHcode value
01885  * into the equivalent human readable error string.  This is useful
01886  * for printing meaningful error messages.
01887  */
01888 CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
01889 
01890 /*
01891  * NAME curl_easy_pause()
01892  *
01893  * DESCRIPTION
01894  *
01895  * The curl_easy_pause function pauses or unpauses transfers. Select the new
01896  * state by setting the bitmask, use the convenience defines below.
01897  *
01898  */
01899 CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
01900 
01901 #define CURLPAUSE_RECV      (1<<0)
01902 #define CURLPAUSE_RECV_CONT (0)
01903 
01904 #define CURLPAUSE_SEND      (1<<2)
01905 #define CURLPAUSE_SEND_CONT (0)
01906 
01907 #define CURLPAUSE_ALL       (CURLPAUSE_RECV|CURLPAUSE_SEND)
01908 #define CURLPAUSE_CONT      (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)
01909 
01910 #ifdef  __cplusplus
01911 }
01912 #endif
01913 
01914 /* unfortunately, the easy.h and multi.h include files need options and info
01915   stuff before they can be included! */
01916 #include "easy.h" /* nothing in curl is fun without the easy stuff */
01917 #include "multi.h"
01918 
01919 /* the typechecker doesn't work in C++ (yet) */
01920 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
01921     ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
01922     !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
01923 #include "typecheck-gcc.h"
01924 #else
01925 #if defined(__STDC__) && (__STDC__ >= 1)
01926 /* This preprocessor magic that replaces a call with the exact same call is
01927    only done to make sure application authors pass exactly three arguments
01928    to these functions. */
01929 #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
01930 #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
01931 #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
01932 #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
01933 #endif /* __STDC__ >= 1 */
01934 #endif /* gcc >= 4.3 && !__cplusplus */
01935 
01936 #endif /* __CURL_CURL_H */