Advertisement
Guest User

curl.h fixed for cURL 7.26

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