cococococos 2 d-Xノード(curl.h)API


本論文はhttp://blog.csdn.net/runaying ,引用は出典を明記しなければならない!
cococococos 2 d-Xノード(curl.h)API
みなさんがよりよく勉強できるように、私のブログを見ることを強くおすすめします。 Cocos 2 d-X権威ガイドノート
///cocos2d-x-3.0alpha0/cocos2dx/platform/third_party/ios/curl
#ifndef __CURL_CURL_H
#define __CURL_CURL_H


/*
 *      libcurl      ,             :
 *   http://curl.haxx.se/libcurl/
 *
 * curl-library          web          :
 *   http://cool.haxx.se/mailman/listinfo/curl-library/
 */

#include "curlver.h"         /* libcurl        */
#include "curlbuild.h"       /* libcurl      */
#include "curlrules.h"       /* libcurl      */

/*
 *    Win32 ,       Win32 API
 */

#if (defined(_WIN32) || defined(__WIN32__)) && \
     !defined(WIN32) && !defined(__SYMBIAN32__)
#define WIN32
#endif

#include <stdio.h>
#include <limits.h>

#if defined(__FreeBSD__) && (__FreeBSD__ >= 2)
/*   __ FreeBSD_version      */
#include <osreldate.h>
#endif

/*          ,     time_t! */
#include <sys/types.h>
#include <time.h>

#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)
#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__))
/*    winsock2        winsock.h         ,                
*/
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#endif

/* HP-UX       9,    10 、 11    sys/select.h     
   libc5-based Linux      .          (sys/select.h)! 
 */
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
    defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
    defined(ANDROID) || defined(__ANDROID__) || \
   (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))
#include <sys/select.h>
#endif

#if !defined(WIN32) && !defined(_WIN32_WCE)
#include <sys/socket.h>
#endif

#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
#include <sys/time.h>
#endif

#ifdef __BEOS__
#include <support/SupportDefs.h>
#endif

#ifdef  __cplusplus
extern "C" {
#endif

typedef void CURL;

/*
 * Win32 、 Symbian OS DLL          .
 *      .def      libcurl.dll.
 */
#if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \
     !defined(CURL_STATICLIB)
#if defined(BUILDING_LIBCURL)
#define CURL_EXTERN  __declspec(dllexport)
#else
#define CURL_EXTERN  __declspec(dllimport)
#endif
#else

#ifdef CURL_HIDDEN_SYMBOLS
/*
 *    symbols     ,                
 * 
 *    library  ,        ,      ,     ,.
 */
#define CURL_EXTERN CURL_EXTERN_SYMBOL
#else
#define CURL_EXTERN
#endif
#endif

#ifndef curl_socket_typedef
/* socket typedef */
#if defined(WIN32) && !defined(__LWIP_OPT_H__)
typedef SOCKET curl_socket_t;
#define CURL_SOCKET_BAD INVALID_SOCKET
#else
typedef int curl_socket_t;
#define CURL_SOCKET_BAD -1
#endif
#define curl_socket_typedef
#endif /* curl_socket_typedef */

struct curl_httppost {
  struct curl_httppost *next;       /*           */
  char *name;                       /*         */
  long namelength;                  /*       */
  char *contents;                   /*           */
  long contentslength;              /*        	 */
  char *buffer;                     /*            */
  long bufferlength;                /*            */
  char *contenttype;                /*      */
  struct curl_slist* contentheader; /*           (www.、 http://、https:// ) */
  struct curl_httppost *more;       /*                ,             
                                        */
  long flags;                       /*       */
#define HTTPPOST_FILENAME (1<<0)    /*           */
#define HTTPPOST_READFILE (1<<1)    /*           */
#define HTTPPOST_PTRNAME (1<<2)     /*        
                                       formfree     (free) */
#define HTTPPOST_PTRCONTENTS (1<<3) /*         
                                       formfree     (free)  */
#define HTTPPOST_BUFFER (1<<4)      /*          */
#define HTTPPOST_PTRBUFFER (1<<5)   /*           */
#define HTTPPOST_CALLBACK (1<<6)    /*        callback     ,             
                                    */

  char *showfilename;               /* T       he file name to show.                , (          )
                                     */
  void *userp;                      /*          HTTPPOST_CALLBACK posts 
                                     */
};

typedef int (*curl_progress_callback)(void *clientp,
                                      double dltotal,
                                      double dlnow,
                                      double ultotal,
                                      double ulnow);

#ifndef CURL_MAX_WRITE_SIZE
  /*      20 k   windosw               ,        16k       。    ifndef   ,                   
               400 bytes,  libcurl      buffer         (         ).
   */
#define CURL_MAX_WRITE_SIZE 16384
#endif

#ifndef CURL_MAX_HTTP_HEADER
/*            ,   libcurl    never-ending   header                    
*/
#define CURL_MAX_HTTP_HEADER (100*1024)
#endif

/* return        write callback ,   ,libcurl               
 */
#define CURL_WRITEFUNC_PAUSE 0x10000001

typedef size_t (*curl_write_callback)(char *buffer,
                                      size_t size,
                                      size_t nitems,
                                      void *outstream);



/*        */
typedef enum {
  CURLFILETYPE_FILE = 0,
  CURLFILETYPE_DIRECTORY,
  CURLFILETYPE_SYMLINK,
  CURLFILETYPE_DEVICE_BLOCK,
  CURLFILETYPE_DEVICE_CHAR,
  CURLFILETYPE_NAMEDPIPE,
  CURLFILETYPE_SOCKET,
  CURLFILETYPE_DOOR, /*        Sun Solaris */

  CURLFILETYPE_UNKNOWN /*          */
} curlfiletype;

#define CURLFINFOFLAG_KNOWN_FILENAME    (1<<0)
#define CURLFINFOFLAG_KNOWN_FILETYPE    (1<<1)
#define CURLFINFOFLAG_KNOWN_TIME        (1<<2)
#define CURLFINFOFLAG_KNOWN_PERM        (1<<3)
#define CURLFINFOFLAG_KNOWN_UID         (1<<4)
#define CURLFINFOFLAG_KNOWN_GID         (1<<5)
#define CURLFINFOFLAG_KNOWN_SIZE        (1<<6)
#define CURLFINFOFLAG_KNOWN_HLINKCOUNT  (1<<7)

    /*                      (e.g.    FTP LIST   ).    url_easy_setopt(3)         callbacks returning  --          ,
                。           . */
struct curl_fileinfo {
  char *filename;
  curlfiletype filetype;
  time_t time;
  unsigned int perm;
  int uid;
  int gid;
  curl_off_t size;
  long int hardlinks;

  struct {
    /*          NULL,        b_data    . */
    char *time;
    char *perm;
    char *user;
    char *group;
    char *target; /*      symlink          */
  } strings;

  unsigned int flags;

  /*      */
  char * b_data;
  size_t b_size;
  size_t b_used;
};

/* return  CURLOPT_CHUNK_BGN_FUNCTION      */
#define CURL_CHUNK_BGN_FUNC_OK      0
#define CURL_CHUNK_BGN_FUNC_FAIL    1 /*    lib     */
#define CURL_CHUNK_BGN_FUNC_SKIP    2 /*       */

/*             ,                 callback    
        "remains"   ,   FTP    ,     ,       
*/
typedef long (*curl_chunk_bgn_callback)(const void *transfer_info,
                                        void *ptr,
                                        int remains);

/* return CURLOPT_CHUNK_END_FUNCTION      */
#define CURL_CHUNK_END_FUNC_OK      0
#define CURL_CHUNK_END_FUNC_FAIL    1 /*    lib     */

/*             ,           ,                 callback    .
      !               .
            CHUNK_BGN_FUNC       。.
               "transfer_info"    ,         "remains"      . */
typedef long (*curl_chunk_end_callback)(void *ptr);

/* return  FNMATCHFUNCTION       */
#define CURL_FNMATCHFUNC_MATCH    0 /*          */
#define CURL_FNMATCHFUNC_NOMATCH  1 /*           */
#define CURL_FNMATCHFUNC_FAIL     2 /*       */

/*               . 
           , return CURL_FNMATCHFUNC_MATCH  , etc. */
typedef int (*curl_fnmatch_callback)(void *ptr,
                                     const char *pattern,
                                     const char *string);

/*           seek(  ) callbacks */
#define CURL_SEEKFUNC_OK       0
#define CURL_SEEKFUNC_FAIL     1 /*        */
#define CURL_SEEKFUNC_CANTSEEK 2 /*    libcurl (  )seeking    , 
                                       libcurl              */
typedef int (*curl_seek_callback)(void *instream,
                                  curl_off_t offset,
                                  int origin); /* 'whence' */   ;//   

/*   read callback ,   ,libcurl                
*/
#define CURL_READFUNC_ABORT 0x10000000
/*    read callback ,   ,libcurl                  . */
#define CURL_READFUNC_PAUSE 0x10000001

typedef size_t (*curl_read_callback)(char *buffer,
                                      size_t size,
                                      size_t nitems,
                                      void *instream);

typedef enum  {
  CURLSOCKTYPE_IPCXN, /*        IP      socket */
  CURLSOCKTYPE_LAST   /* never use */
} curlsocktype;

/*    libcurl  sockopt_callback      : */
#define CURL_SOCKOPT_OK 0
#define CURL_SOCKOPT_ERROR 1 /*   libcurl   ,   
                                CURLE_ABORTED_BY_CALLBACK */
#define CURL_SOCKOPT_ALREADY_CONNECTED 2

typedef int (*curl_sockopt_callback)(void *clientp,
                                     curl_socket_t curlfd,
                                     curlsocktype purpose);

struct curl_sockaddr {
  int family;
  int socktype;
  int protocol;
  unsigned int addrlen; /*  addrlen     socklen_t   , 7.780        
                           turned       
                           */
  struct sockaddr addr;
};

typedef curl_socket_t
(*curl_opensocket_callback)(void *clientp,
                            curlsocktype purpose,
                            struct curl_sockaddr *address);

typedef int
(*curl_closesocket_callback)(void *clientp, curl_socket_t item);

typedef enum {
  CURLIOE_OK,            /* I/O      */
  CURLIOE_UNKNOWNCMD,    /*         */
  CURLIOE_FAILRESTART,   /*        */
  CURLIOE_LAST           /* never use */
} curlioerr;

typedef enum  {
  CURLIOCMD_NOP,         /*    */
  CURLIOCMD_RESTARTREAD, /*         */
  CURLIOCMD_LAST         /* never use */
} curliocmd;

typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
                                         int cmd,
                                         void *clientp);

/*
 *    typedef's      malloc, free, realloc, strdup and
 * calloc respectively.                
 * curl_global_init_mem()                   。
 */
typedef void *(*curl_malloc_callback)(size_t size);
typedef void (*curl_free_callback)(void *ptr);
typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
typedef char *(*curl_strdup_callback)(const char *str);
typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);

/*         information_callback*/
typedef enum {
  CURLINFO_TEXT = 0,
  CURLINFO_HEADER_IN,    /* 1 */
  CURLINFO_HEADER_OUT,   /* 2 */
  CURLINFO_DATA_IN,      /* 3 */
  CURLINFO_DATA_OUT,     /* 4 */
  CURLINFO_SSL_DATA_IN,  /* 5 */
  CURLINFO_SSL_DATA_OUT, /* 6 */
  CURLINFO_END
} curl_infotype;

typedef int (*curl_debug_callback)
       (CURL *handle,      /*       /   */
        curl_infotype type, /*         */
        char *data,        /*     */
        size_t size,       /*        */
        void *userptr);    /*         */

/*       curl         
             ,     。

             .   * EVER *  。  
         !
 */

typedef enum {
  CURLE_OK = 0,
  CURLE_UNSUPPORTED_PROTOCOL,    /* 1 */
  CURLE_FAILED_INIT,             /* 2 */
  CURLE_URL_MALFORMAT,           /* 3 */
  CURLE_NOT_BUILT_IN,            /* 4 - [2007 8   ,  2011 4 ,  ] */
  CURLE_COULDNT_RESOLVE_PROXY,   /* 5 */
  CURLE_COULDNT_RESOLVE_HOST,    /* 6 */
  CURLE_COULDNT_CONNECT,         /* 7 */
  CURLE_FTP_WEIRD_SERVER_REPLY,  /* 8 */
    CURLE_REMOTE_ACCESS_DENIED,    /* 9         
                                           -         . */
  CURLE_FTP_ACCEPT_FAILED,       /* 10 - [   , 2006 4 
                                    ,  2011 12 12 ]*/
  CURLE_FTP_WEIRD_PASS_REPLY,    /* 11 */
  CURLE_FTP_ACCEPT_TIMEOUT,      /* 12 -        
                                    [   , 2007 8 ,
                                    r 2011 12   ]*/
  CURLE_FTP_WEIRD_PASV_REPLY,    /* 13 */
  CURLE_FTP_WEIRD_227_FORMAT,    /* 14 */
  CURLE_FTP_CANT_GET_HOST,       /* 15 */
  CURLE_OBSOLETE16,              /* 16 - NOT USED */
  CURLE_FTP_COULDNT_SET_TYPE,    /* 17 */
  CURLE_PARTIAL_FILE,            /* 18 */
  CURLE_FTP_COULDNT_RETR_FILE,   /* 19 */
  CURLE_OBSOLETE20,              /* 20 - NOT USED */
  CURLE_QUOTE_ERROR,             /* 21 - quote command failure */
  CURLE_HTTP_RETURNED_ERROR,     /* 22 */
  CURLE_WRITE_ERROR,             /* 23 */
  CURLE_OBSOLETE24,              /* 24 - NOT USED */
  CURLE_UPLOAD_FAILED,           /* 25 -      "command" */
  CURLE_READ_ERROR,              /* 26 -     /     */
  CURLE_OUT_OF_MEMORY,           /* 27 */
  /* Note: CURLE_OUT_OF_MEMORY           
                     ,   CURL_DOES_CONVERSIONS
               
  */
  CURLE_OPERATION_TIMEDOUT,      /* 28 -         */
  CURLE_OBSOLETE29,              /* 29 - NOT USED */
  CURLE_FTP_PORT_FAILED,         /* 30 - FTP       */
  CURLE_FTP_COULDNT_USE_REST,    /* 31 - REST     */
  CURLE_OBSOLETE32,              /* 32 - NOT USED */
  CURLE_RANGE_ERROR,             /* 33 -    "command"     */
  CURLE_HTTP_POST_ERROR,         /* 34 */
  CURLE_SSL_CONNECT_ERROR,       /* 35 -    SSL        */
  CURLE_BAD_DOWNLOAD_RESUME,     /* 36 -        */
  CURLE_FILE_COULDNT_READ_FILE,  /* 37 */
  CURLE_LDAP_CANNOT_BIND,        /* 38 */
  CURLE_LDAP_SEARCH_FAILED,      /* 39 */
  CURLE_OBSOLETE40,              /* 40 - NOT USED */
  CURLE_FUNCTION_NOT_FOUND,      /* 41 */
  CURLE_ABORTED_BY_CALLBACK,     /* 42 */
  CURLE_BAD_FUNCTION_ARGUMENT,   /* 43 */
  CURLE_OBSOLETE44,              /* 44 - NOT USED */
  CURLE_INTERFACE_FAILED,        /* 45 - CURLOPT_INTERFACE     */
  CURLE_OBSOLETE46,              /* 46 - NOT USED */
  CURLE_TOO_MANY_REDIRECTS ,     /* 47 -       re-direct    */
  CURLE_UNKNOWN_OPTION,          /* 48 -              */
  CURLE_TELNET_OPTION_SYNTAX ,   /* 49 -       telnet   */
  CURLE_OBSOLETE50,              /* 50 - NOT USED */
  CURLE_PEER_FAILED_VERIFICATION, /* 51 -          
                                           */
  CURLE_GOT_NOTHING,             /* 52 -           */
  CURLE_SSL_ENGINE_NOTFOUND,      /* 53 - SSL        */
  CURLE_SSL_ENGINE_SETFAILED,     /* 54 -     SSL    
       */
  CURLE_SEND_ERROR,               /* 55 -        */
  CURLE_RECV_ERROR,               /* 56 -        */
  CURLE_OBSOLETE57,              /* 57 - NOT IN USE */
  CURLE_SSL_CERTPROBLEM,         /* 58 -         */
  CURLE_SSL_CIPHER,              /* 59 -           */
  CURLE_SSL_CACERT,              /* 60 - CA  (  )    */
  CURLE_BAD_CONTENT_ENCODING,    /* 61 -        /  */
  CURLE_LDAP_INVALID_URL,        /* 62 -    LDAP URL  */
  CURLE_FILESIZE_EXCEEDED,       /* 63 -          */
  CURLE_USE_SSL_FAILED,          /* 64 -   FTP SSL     */
  CURLE_SEND_FAIL_REWIND,        /* 65 -          
                                       */
  CURLE_SSL_ENGINE_INITFAILED,   /* 66 -     ENGINE    */
    CURLE_LOGIN_DENIED,            /* 67 -    ,       
                                            */
  CURLE_TFTP_NOTFOUND,           /* 68 -            */
  CURLE_TFTP_PERM,               /* 69 -           */
  CURLE_REMOTE_DISK_FULL,        /* 70 -             */
  CURLE_TFTP_ILLEGAL,            /* 71 -    TFTP   */
  CURLE_TFTP_UNKNOWNID,          /* 72 -      ID */
  CURLE_REMOTE_FILE_EXISTS,      /* 73 -        */
  CURLE_TFTP_NOSUCHUSER,         /* 74 -        */
  CURLE_CONV_FAILED,             /* 75 -      */
  CURLE_CONV_REQD,               /* 76 -          
                                       curl_easy_setopt    
                                    CURLOPT_CONV_FROM_NETWORK_FUNCTION,
                                    CURLOPT_CONV_TO_NETWORK_FUNCTION, and
                                    CURLOPT_CONV_FROM_UTF8_FUNCTION */
  CURLE_SSL_CACERT_BADFILE,      /* 77 -     CACERT  ,  
                                          */
  CURLE_REMOTE_FILE_NOT_FOUND,   /* 78 -          */
  CURLE_SSH,                     /* 79 - SSH layer    ,     
                                                   
                                 */

  CURLE_SSL_SHUTDOWN_FAILED,     /* 80 -     SSL   */
    CURLE_AGAIN,                   /* 81 - socket         /  ,
                                            ,      */
    CURLE_SSL_CRL_BADFILE,         /* 82 -     CRL  ,   
                                        ( 7.19.0   ) */
    CURLE_SSL_ISSUER_ERROR,        /* 83 -        。( 
                                    7.19.0 ) */
  CURLE_FTP_PRET_FAILED,         /* 84 -   PRET      */
  CURLE_RTSP_CSEQ_ERROR,         /* 85 - RTSP Cseq      */
  CURLE_RTSP_SESSION_ERROR,      /* 86 - RTSP  ID    */
  CURLE_FTP_BAD_FILE_LIST,       /* 87 -     FTP     */
  CURLE_CHUNK_FAILED,            /* 88 -         */
  CURL_LAST /* never use! */
} CURLcode;

#ifndef CURL_NO_OLDIES /*       ,                       ! */

/*              7.24.0 */
#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED
#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT

/*             */
#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING

/*   ,2011 4   7.21.5 */
#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION

/*       7.17.1 */
/*     2009   */
#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION

    /*       7.17.1 */
    /*     2009   */
#define CURLE_OBSOLETE CURLE_OBSOLETE50 /*           ! */
#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN

#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED

/*         */

#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT

#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED

#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME

    /*       50 7.7.3       , 
       libcurl     ,                  */
#define CURLE_ALREADY_COMPLETE 99999

#endif /*!CURL_NO_OLDIES*/

/*                */
typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);

typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl,    /* easy    */
                                          void *ssl_ctx, /*       
                                                            OpenSSL SSL_CTX */
                                          void *userptr);

typedef enum {
  CURLPROXY_HTTP = 0,   /*7.10  ,  7.19.4     
                           CONNECT HTTP/1.1 */
  CURLPROXY_HTTP_1_0 = 1,   /* 7.19.4  ,    CONNECT 
                               HTTP/1.0  */
  CURLPROXY_SOCKS4 = 4, /* 7.15.2    ,    7.10     
                        */
  CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
  CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */
    CURLPROXY_SOCKS5_HOSTNAME = 7 /*   SOCKS5  ,     
                                        IP  。added                                   
                                   in 7.18.0 */
} curl_proxytype;  /*     added in 7.10 */

/*
 *  CURLOPT_HTTPAUTH 、 CURLOPT_PROXYAUTH Bitmasks(   )  :
 *
 * CURLAUTH_NONE         -   HTTP  
 * CURLAUTH_BASIC        - HTTP      (  )
 * CURLAUTH_DIGEST       - HTTP Digest   
 * CURLAUTH_GSSNEGOTIATE - HTTP GSS-    
 * CURLAUTH_NTLM         - HTTP NTLM     
 * CURLAUTH_DIGEST_IE    - HTTP        IE  
 * CURLAUTH_NTLM_WB      - HTTP winbind      (NTLM    )
 * CURLAUTH_ONLY         -                            
 * CURLAUTH_ANY          -       
 * CURLAUTH_ANYSAFE      -           
 */

#define CURLAUTH_NONE         ((unsigned long)0)
#define CURLAUTH_BASIC        (((unsigned long)1)<<0)
#define CURLAUTH_DIGEST       (((unsigned long)1)<<1)
#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2)
#define CURLAUTH_NTLM         (((unsigned long)1)<<3)
#define CURLAUTH_DIGEST_IE    (((unsigned long)1)<<4)
#define CURLAUTH_NTLM_WB      (((unsigned long)1)<<5)
#define CURLAUTH_ONLY         (((unsigned long)1)<<31)
#define CURLAUTH_ANY          (~CURLAUTH_DIGEST_IE)
#define CURLAUTH_ANYSAFE      (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))

#define CURLSSH_AUTH_ANY       ~0     /*             */
#define CURLSSH_AUTH_NONE      0      /*      ,   ,     */
#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* (public/private )  /     */
#define CURLSSH_AUTH_PASSWORD  (1<<1) /*    */
#define CURLSSH_AUTH_HOST      (1<<2) /*        */
#define CURLSSH_AUTH_KEYBOARD  (1<<3) /*      */
#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY

#define CURLGSSAPI_DELEGATION_NONE        0      /*     (  ) */
#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /*        */
#define CURLGSSAPI_DELEGATION_FLAG        (1<<1) /*      */

#define CURL_ERROR_SIZE 256

struct curl_khkey {
    const char *key; /*           , base64  
                        len 0, otherwise    "raw"(  )    */
  size_t len;
  enum type {
    CURLKHTYPE_UNKNOWN,
    CURLKHTYPE_RSA1,
    CURLKHTYPE_RSA,
    CURLKHTYPE_DSS
  } keytype;
};

    /*        curl_sshkeycallback callback       */
enum curl_khstat {
  CURLKHSTAT_FINE_ADD_TO_FILE,
  CURLKHSTAT_FINE,
  CURLKHSTAT_REJECT, /*     ,       */
  CURLKHSTAT_DEFER,  /*    ,      d
                              CURLE_DEFER  ,      
                                  */
  CURLKHSTAT_LAST    /*    ,          */
};

/*                */
enum curl_khmatch {
  CURLKHMATCH_OK,       /*    */
  CURLKHMATCH_MISMATCH, /*     ,      ! */
  CURLKHMATCH_MISSING,  /*        host/key  */
  CURLKHMATCH_LAST      /*    ,          */
};

typedef int
  (*curl_sshkeycallback) (CURL *easy,     /* easy handle */
                          const struct curl_khkey *knownkey, /*    */
                          const struct curl_khkey *foundkey, /*    */
                          enum curl_khmatch, /* libcurl's        */
                          void *clientp); /*              */

/*  CURLOPT_USE_SSL      */
typedef enum {
  CURLUSESSL_NONE,    /*       SSL*/
  CURLUSESSL_TRY,     /*     SSL,               */
  CURLUSESSL_CONTROL, /*     SSL      */
  CURLUSESSL_ALL,     /*    SSL       */
  CURLUSESSL_LAST     /*       ,       */
} curl_usessl;

/*   CURLOPT_SSL_OPTIONS    bits   : */

/* - ALLOW_BEAST  libcurl  BEAST SSL    
                  。  SSL  
            ,        SSL    
              ,              
 */
#define CURLSSLOPT_ALLOW_BEAST (1<<0)

#ifndef CURL_NO_OLDIES /*       ,                       ! */

/*        */
/*     2009    */

#define CURLFTPSSL_NONE CURLUSESSL_NONE
#define CURLFTPSSL_TRY CURLUSESSL_TRY
#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
#define CURLFTPSSL_ALL CURLUSESSL_ALL
#define CURLFTPSSL_LAST CURLUSESSL_LAST
#define curl_ftpssl curl_usessl
#endif /*!CURL_NO_OLDIES*/

/* CURLOPT_FTP_SSL_CCC      */
typedef enum {
  CURLFTPSSL_CCC_NONE,    /*     CCC */
  CURLFTPSSL_CCC_PASSIVE, /*          */
  CURLFTPSSL_CCC_ACTIVE,  /*     (  ) */
  CURLFTPSSL_CCC_LAST     /*       ,       */
} curl_ftpccc;

/*  CURLOPT_FTPSSLAUTH      */
typedef enum {
  CURLFTPAUTH_DEFAULT, /*  libcurl    */
  CURLFTPAUTH_SSL,     /* use "AUTH SSL" */
  CURLFTPAUTH_TLS,     /* use "AUTH TLS" */
  CURLFTPAUTH_LAST /*       ,       */
} curl_ftpauth;

/*  CURLOPT_FTP_CREATE_MISSING_DIRS      */
typedef enum {
  CURLFTP_CREATE_DIR_NONE,  /*        dirs! */
  CURLFTP_CREATE_DIR,       /* (FTP/SFTP)    CWD   ,    MKD       CWD
                                    MKD   ,  SFTP        
                             */
    CURLFTP_CREATE_DIR_RETRY, /* (FTP only)    CWD   ,    MKD       CWD
                                    MKD   ! */
  CURLFTP_CREATE_DIR_LAST   /*       ,       */
} curl_ftpcreatedir;

/*  CURLOPT_FTP_FILEMETHOD      */
typedef enum {
  CURLFTPMETHOD_DEFAULT,   /*   libcurl    */
  CURLFTPMETHOD_MULTICWD,  /*              CWD   */
  CURLFTPMETHOD_NOCWD,     /*        CWD ,          */
  CURLFTPMETHOD_SINGLECWD, /*      CMD    */
  CURLFTPMETHOD_LAST       /*       ,       */
} curl_ftpmethod;

/* CURLPROTO_   CURLOPT_*PROTOCOLS       */
#define CURLPROTO_HTTP   (1<<0)
#define CURLPROTO_HTTPS  (1<<1)
#define CURLPROTO_FTP    (1<<2)
#define CURLPROTO_FTPS   (1<<3)
#define CURLPROTO_SCP    (1<<4)
#define CURLPROTO_SFTP   (1<<5)
#define CURLPROTO_TELNET (1<<6)
#define CURLPROTO_LDAP   (1<<7)
#define CURLPROTO_LDAPS  (1<<8)
#define CURLPROTO_DICT   (1<<9)
#define CURLPROTO_FILE   (1<<10)
#define CURLPROTO_TFTP   (1<<11)
#define CURLPROTO_IMAP   (1<<12)
#define CURLPROTO_IMAPS  (1<<13)
#define CURLPROTO_POP3   (1<<14)
#define CURLPROTO_POP3S  (1<<15)
#define CURLPROTO_SMTP   (1<<16)
#define CURLPROTO_SMTPS  (1<<17)
#define CURLPROTO_RTSP   (1<<18)
#define CURLPROTO_RTMP   (1<<19)
#define CURLPROTO_RTMPT  (1<<20)
#define CURLPROTO_RTMPE  (1<<21)
#define CURLPROTO_RTMPTE (1<<22)
#define CURLPROTO_RTMPS  (1<<23)
#define CURLPROTO_RTMPTS (1<<24)
#define CURLPROTO_GOPHER (1<<25)
#define CURLPROTO_ALL    (~0) /*      */

/*     32 64 ,                   32  */
#define CURLOPTTYPE_LONG          0
#define CURLOPTTYPE_OBJECTPOINT   10000
#define CURLOPTTYPE_FUNCTIONPOINT 20000
#define CURLOPTTYPE_OFF_T         30000

/*        CURLOPT_<name>,
   type   CURLOPTTYPE_<type>        
             */
#ifdef CINIT
#undef CINIT
#endif

#ifdef CURL_ISOCPP
#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu
#else
/*   "##"    ISO C    ,      pre-ISO C     . */
#define LONG          CURLOPTTYPE_LONG
#define OBJECTPOINT   CURLOPTTYPE_OBJECTPOINT
#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
#define OFF_T         CURLOPTTYPE_OFF_T
#define CINIT(name,type,number) CURLOPT_/**/name = type + number
#endif

/*
 *    macro-mania       CURLOPT_[what]   ,
 *  curl_easy_setopt()     .  CINIT()          [what]
 *   .
 */

typedef enum {
  /*    FILE * or void *          . */
  CINIT(FILE, OBJECTPOINT, 1),

  /*    URL get/put */
  CINIT(URL,  OBJECTPOINT, 2),

  /*       ,            . */
  CINIT(PORT, LONG, 3),

  /*        . */
  CINIT(PROXY, OBJECTPOINT, 4),

  /* "name:password"        . */
  CINIT(USERPWD, OBJECTPOINT, 5),

  /*       "name:password" . */
  CINIT(PROXYUSERPWD, OBJECTPOINT, 6),

  /*      ,     ASCII   . */
  CINIT(RANGE, OBJECTPOINT, 7),

  /* not used */

  /*         (    ): */
  CINIT(INFILE, OBJECTPOINT, 9),

  /*           ,     CURL_ERROR_SIZE   byte  
   *       ,      stderr   : */
  CINIT(ERRORBUFFER, OBJECTPOINT, 10),

  /*              (   fwrite ). 
   *        fwrite()   ,        . */
  CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),

  /*            (    fread). The
   *         fread()   ,        . */
  CINIT(READFUNCTION, FUNCTIONPOINT, 12),

  /*                    */
  CINIT(TIMEOUT, LONG, 13),

  /*     CURLOPT_INFILE,       libcurl 
   *           .         
   *        ,    。-1  
   *    。 
   *
   *        ,    _LARGE   
   *        off_t    ,         off_t            
   *     INFILESIZE_LARGE.
   */
  CINIT(INFILESIZE, LONG, 14),

  /* POST      . */
  CINIT(POSTFIELDS, OBJECTPOINT, 15),

  /*     CGI        */
  CINIT(REFERER, OBJECTPOINT, 16),

  /*    FTP PORT    (    、IP  )
        i.e  '-'        . */
  CINIT(FTPPORT, OBJECTPOINT, 17),

  /*   User-Agent   (  CGI    ) */
  CINIT(USERAGENT, OBJECTPOINT, 18),

  /*          "low speed limit" bytes/second
   *   "low speed time"  ,      .
   *               ,
   *        20  ,    2000 bytes/second。
   */

  /* Set the "low speed limit" */
  CINIT(LOW_SPEED_LIMIT, LONG, 19),

  /* Set the "low speed time" */
  CINIT(LOW_SPEED_TIME, LONG, 20),

  /*       .
   *
   * Note       _LARGE   
   *        off_t    ,      32            
   *     RESUME_FROM_LARGE.
   */
  CINIT(RESUME_FROM, LONG, 21),

  /*   cookie  : */
  CINIT(COOKIE, OBJECTPOINT, 22),

  /*        , struct curl_slist       */
  CINIT(HTTPHEADER, OBJECTPOINT, 23),

  /*       , struct curl_httppost */
  CINIT(HTTPPOST, OBJECTPOINT, 24),

  /*        SSL-certificate(  )  */
  CINIT(SSLCERT, OBJECTPOINT, 25),

  /* SSL SSH    */
  CINIT(KEYPASSWD, OBJECTPOINT, 26),

  /*       ? */
  CINIT(CRLF, LONG, 27),

  /*       QUOTE(  )    */
  CINIT(QUOTE, OBJECTPOINT, 28),

  /*    FILE * or void *     ,          
                */
  CINIT(WRITEHEADER, OBJECTPOINT, 29),

  /*              cookie
          "cookie awareness" */
  CINIT(COOKIEFILE, OBJECTPOINT, 31),

  /*           
          CURL_SSLVERSION    . */
  CINIT(SSLVERSION, LONG, 32),

  /*       HTTP    ,      */
  CINIT(TIMECONDITION, LONG, 33),

    /*          。    
      1970 1 1    */
  CINIT(TIMEVALUE, LONG, 34),

  /* 35 = OBSOLETE *///   

  /*       ,  get  , 
     HTTP: DELETE, TRACE(  ) and others
     FTP:      list  
     */
  CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),

  /* HTTP  ,  ,           */
  CINIT(STDERR, OBJECTPOINT, 37),

  /* 38 is not used */

  /*    post-transfer   linked-list      */
  CINIT(POSTQUOTE, OBJECTPOINT, 39),

  CINIT(WRITEINFO, OBJECTPOINT, 40), /*      ,   ! */

  CINIT(VERBOSE, LONG, 41),      /*      */
  CINIT(HEADER, LONG, 42),       /*       */
  CINIT(NOPROGRESS, LONG, 43),   /*       */
  CINIT(NOBODY, LONG, 44),       /*   HTTP    */
  CINIT(FAILONERROR, LONG, 45),  /*    HTTP   codes >= 300 */
  CINIT(UPLOAD, LONG, 46),       /*        */
  CINIT(POST, LONG, 47),         /* HTTP POST    */
  CINIT(DIRLISTONLY, LONG, 48),  /*            */

  CINIT(APPEND, LONG, 50),       /*          ! */

  /*        user+password    .netrc or the URL.
   *        CURL_NETRC_ *    . */
  CINIT(NETRC, LONG, 51),

  CINIT(FOLLOWLOCATION, LONG, 52),  /*     : Luke! */

  CINIT(TRANSFERTEXT, LONG, 53), /*      text/ASCII    */
  CINIT(PUT, LONG, 54),          /* HTTP PUT */

  /* 55 = OBSOLETE *///   

  /*     ,            
   *           curl_progress_callback      
  */
  CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),

  /*          * */
  CINIT(PROGRESSDATA, OBJECTPOINT, 57),

  /*                   */
  CINIT(AUTOREFERER, LONG, 58),

  /*     ,         :
     "[host]:[port]" */
  CINIT(PROXYPORT, LONG, 59),

  /* POST       ,    strlen()                 */
  CINIT(POSTFIELDSIZE, LONG, 60),

  /*    HTTP      non-http  */
  CINIT(HTTPPROXYTUNNEL, LONG, 61),

  /*           outgoing      */
  CINIT(INTERFACE, OBJECTPOINT, 62),

  /*    krb4/5     ,       krb4/5 awareness(  ).  
   *      'clear', 'safe', 'confidential' or 'private'    . 
   *                   ,       'private'.  */
  CINIT(KRBLEVEL, OBJECTPOINT, 63),

  /*     SSL          ,1     */
  CINIT(SSL_VERIFYPEER, LONG, 64),

  /*   SSL_VERIFYPEER    true ,  CApath or CAfile         */
  CINIT(CAINFO, OBJECTPOINT, 65),

  /* 66 = OBSOLETE *///   
  /* 67 = OBSOLETE *///   

  /* HTTP         */
  CINIT(MAXREDIRS, LONG, 68),

    /*       1            (  
         )!     ,    . */
  CINIT(FILETIME, LONG, 69),

  /*        telnet   */
  CINIT(TELNETOPTIONS, OBJECTPOINT, 70),

  /*      alive       */
  CINIT(MAXCONNECTS, LONG, 71),

  CINIT(CLOSEPOLICY, LONG, 72), /*      ,   ! */

  /* 73 = OBSOLETE *///   

  /*                   
         ,        ,    
         ,       。 */
  CINIT(FRESH_CONNECT, LONG, 74),

  /*    re-used            
         ,        ,    
         ,       。  */
  CINIT(FORBID_REUSE, LONG, 75),

    /*  libcurl       , SSL                 . */
  CINIT(RANDOM_FILE, OBJECTPOINT, 76),

  /* Set Entropy Gathering Daemon socket     */
  CINIT(EGDSOCKET, OBJECTPOINT, 77),

  /* Time-out     ,              OK,            . [   unix-style/SIGALRM    ] */
  CINIT(CONNECTTIMEOUT, LONG, 78),

  /* *             (  fwrite)
   *         fwrite()   ,        . */
  CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),

  /*     HTTP      GET.   post    , PUT or        .
   */
  CINIT(HTTPGET, LONG, 80),

  /*    SSL                   , set 1       , 2             . */
  CINIT(SSL_VERIFYHOST, LONG, 81),

    /*                  cookies
       .*/
  CINIT(COOKIEJAR, OBJECTPOINT, 82),

  /*     SSL   */
  CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),

  /*      HTTP  !      
     CURL_HTTP_VERSION*        . */
  CINIT(HTTP_VERSION, LONG, 84),

  /*       FTP     EPSV  . 
     . */
  CINIT(FTP_USE_EPSV, LONG, 85),

  /*     SSL        ("DER", "PEM", "ENG") */
  CINIT(SSLCERTTYPE, OBJECTPOINT, 86),

  /*       SSL         */
  CINIT(SSLKEY, OBJECTPOINT, 87),

  /*       SSL        ("DER", "PEM", "ENG") */
  CINIT(SSLKEYTYPE, OBJECTPOINT, 88),

  /*      SSL    */
  CINIT(SSLENGINE, OBJECTPOINT, 89),

    /*            SSL   
               
   */
  CINIT(SSLENGINE_DEFAULT, LONG, 90),

  /*          DNS   */
  CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /*      ,   ! */

  /* DNS     */
  CINIT(DNS_CACHE_TIMEOUT, LONG, 92),

  /*             */
  CINIT(PREQUOTE, OBJECTPOINT, 93),

  /*        */
  CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),

  /*          */
  CINIT(DEBUGDATA, OBJECTPOINT, 95),

  /*     cookie     */
  CINIT(COOKIESESSION, LONG, 96),

  /*   SSL_VERIFYPEER   true          CApath       */
  CINIT(CAPATH, OBJECTPOINT, 97),

  /*    libcurl            */
  CINIT(BUFFERSIZE, LONG, 98),

    /*   libcurl        /    ,    
       .              .
     See libcurl-the-guide        . */
  CINIT(NOSIGNAL, LONG, 99),

  /*   CURLShare  -TS  mutexing */
  CINIT(SHARE, OBJECTPOINT, 100),

  /*       。      CURLPROXY_HTTP(  ),
     CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
  CINIT(PROXYTYPE, LONG, 101),

    /*           。          
          。7.21.6  ,    
     CURLOPT_ENCODING */
  CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),

  /*           */
  CINIT(PRIVATE, OBJECTPOINT, 103),

  /*      ​​HTTP 200 HTTP    */
  CINIT(HTTP200ALIASES, OBJECTPOINT, 104),

    /*      (   +  )     ,
            ,                      */
  CINIT(UNRESTRICTED_AUTH, LONG, 105),

    /*         FTP  ,   EPRT  (
         LPRT    )。     ,   
          PORT  . */
  CINIT(FTP_USE_EPRT, LONG, 106),

  /*                 
      CURLOPT_PROXYUSERPWD     .
   Note     ,            。 */
  CINIT(HTTPAUTH, LONG, 107),

    /*   SSL        ,     OpenSSL SSL_CTX       . 
             curl_ssl_ctx_callback  . */
  CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),

    /* SSL                  */
  CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),

  /*           FTP         
   In 7.19.4                  CURLFTP_CREATE_DIR   .
  */
  CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),

  /*                 
        CURLOPT_PROXYUSERPWD     .
     Note     ,            。. */
  CINIT(PROXYAUTH, LONG, 111),

    /*    FTP    ( ),            
          FTP                  。 */
  CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT

  /*    CURL_IPRESOLVE_*      ,     
       libcurl     IP  .       IPv4 _and_ IPv6       . */
  CINIT(IPRESOLVE, LONG, 113),

  /*             http/FTP             .

       _LARGE  ,         
   off_t           .  See MAXFILESIZE_LARGE below. */
  CINIT(MAXFILESIZE, LONG, 114),

  /*      INFILESIZE   ,               ,  -1      .
   */
  CINIT(INFILESIZE_LARGE, OFF_T, 115),

  /*       .            ;
   *      RESUME_FROM.
   */
  CINIT(RESUME_FROM_LARGE, OFF_T, 116),

  /*        http/FTP         ,        See MAXFILESIZE      .
   */
  CINIT(MAXFILESIZE_LARGE, OFF_T, 117),

    /*        libcurl     .netrc      (   CURLOPT_NETRC   ).       , libcurl                       .netrc       */
  CINIT(NETRC_FILE, OBJECTPOINT, 118),

  /*   FTP    SSL/TLS ,     :
     CURLFTPSSL_TRY     -      SSL,          
     CURLFTPSSL_CONTROL - SSL           
     CURLFTPSSL_ALL     - SSL        
  */
  CINIT(USE_SSL, LONG, 119),

  /*     POSTFIELDSIZE     _LARGE    */
  CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),

  /*   /  TCP Nagle   */
  CINIT(TCP_NODELAY, LONG, 121),

  /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 *///   
  /* 123 OBSOLETE. Gone in 7.16.0 *///   
  /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 *///   
  /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 *///   
  /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 *///   
  /* 127 OBSOLETE. Gone in 7.16.0 *///   
  /* 128 OBSOLETE. Gone in 7.16.0 *///   

    /*   SSL/ TLS FTP    (with CURLOPT_USE_SSL),     
           libcurl          
     "AUTH SSL"      "AUTH TLS" ,       OK          

           :
     CURLFTPAUTH_DEFAULT -  libcurl   
     CURLFTPAUTH_SSL     - try "AUTH SSL" first, then TLS
     CURLFTPAUTH_TLS     - try "AUTH TLS" first, then SSL
  */
  CINIT(FTPSSLAUTH, LONG, 129),

  CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
  CINIT(IOCTLDATA, OBJECTPOINT, 131),

  /* 132 OBSOLETE. Gone in 7.16.0 *///   
  /* 133 OBSOLETE. Gone in 7.16.0 *///   

    /*     “  ”   ,         FTP     */
  CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),

  /*   cookie engine      cookie*/
  CINIT(COOKIELIST, OBJECTPOINT, 135),

  /*    Content-Length */
  CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),

    /*          227 PASV FTP      IP    。    FTP SSL,      
        。 libcurl       IP    ,   
         */
  CINIT(FTP_SKIP_PASV_IP, LONG, 137),

  /*   FTP       "file method", see the curl_ftpmethod
     above. */
  CINIT(FTP_FILEMETHOD, LONG, 138),

  /*              */
  CINIT(LOCALPORT, LONG, 139),

  /*      ,       LOCALPORT.
          1,                .
  */
  CINIT(LOCALPORTRANGE, LONG, 140),

  /*     ,    CURLINFO_LASTSOCKET   ,          sock */
  CINIT(CONNECT_ONLY, LONG, 141),

    /*            (     libcurl  iconv   */
  CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),

    /*          
         (     libcurl  iconv   */
  CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),

    /*         UTF8  
     (      iconv  libcurl )
        ,    SSL     */
  CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),

  /*                     */
  /* limit-rate:                     */
  CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
  CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),

  /*      /             。 */
  CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),

  /*             */
  CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
  CINIT(SOCKOPTDATA, OBJECTPOINT, 149),

  /*    0     ID,        , default is
     enabled (== 1) */
  CINIT(SSL_SESSIONID_CACHE, LONG, 150),

  /*   SSH     */
  CINIT(SSH_AUTH_TYPES, LONG, 151),

  /* scp/sftp     /     */
  CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),
  CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),

  /*       CCC (Clear Command Channel)  */          //      
  CINIT(FTP_SSL_CCC, LONG, 154),

  /*    TIMEOUT and CONNECTTIMEOUT,            */
  CINIT(TIMEOUT_MS, LONG, 155),
  CINIT(CONNECTTIMEOUT_MS, LONG, 156),

  /*    0     libcurl's                     encoded/compressed */
  CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
  CINIT(HTTP_CONTENT_DECODING, LONG, 158),

  /*             /       ,        SFTP/SCP/FILE */
  CINIT(NEW_FILE_PERMS, LONG, 159),
  CINIT(NEW_DIRECTORY_PERMS, LONG, 160),

  /*   POST        .        CURL_REDIR*       .       CURLOPT_POST301 */
  CINIT(POSTREDIR, LONG, 161),

  /*    scp/sftp          */
  CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),

  /*         socket (   socket(2)).   ,
                       
     CURL_SOCKET_BAD.           
     curl_opensocket_callback */
  CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
  CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),

  /* POST       。 */
  CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),

  /* s       (;type=<a|i>)  FTP  HTTP   */
  CINIT(PROXY_TRANSFER_MODE, LONG, 166),

  /*            * */
  CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
  CINIT(SEEKDATA, OBJECTPOINT, 168),

  /* CRL file */
  CINIT(CRLFILE, OBJECTPOINT, 169),

  /*      */
  CINIT(ISSUERCERT, OBJECTPOINT, 170),

  /* (IPv6)       */
  CINIT(ADDRESS_SCOPE, LONG, 171),

  /*         ,       CURLINFO_CERTINFO     .        OpenSSL-powered builds   . */
  CINIT(CERTINFO, LONG, 172),

  /*       "name" and "pwd" . */
  CINIT(USERNAME, OBJECTPOINT, 173),
  CINIT(PASSWORD, OBJECTPOINT, 174),

    /*         "name" and "pwd" . */
  CINIT(PROXYUSERNAME, OBJECTPOINT, 175),
  CINIT(PROXYPASSWORD, OBJECTPOINT, 176),

  /*                  。                   local.com      local.com and www.local.com,        notlocal.com or www.notlocal.com.              , .local.com       local.com   .      *         ,           . */
  CINIT(NOPROXY, OBJECTPOINT, 177),

  /* TFTP      */
  CINIT(TFTP_BLKSIZE, LONG, 178),

  /* Socks Service */
  CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),

  /* Socks Service */
  CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),

    /*               ,        ,      urls                
     urls . Defaults to CURLPROTO_ALL. */
  CINIT(PROTOCOLS, LONG, 181),

  /*   libcurl   ,       bitmask(   )
        CURLOPT_PROTOCOLS      .                       bitmasks (   ).      FILE 、 SCP      . */
  CINIT(REDIR_PROTOCOLS, LONG, 182),

  /*    SSH knownhost        */
  CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),

  /*   SSH      ,       curl_sshkeycallback
        */
  CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),

  /*   SSH             */
  CINIT(SSH_KEYDATA, OBJECTPOINT, 185),

  /*   SMTP      */
  CINIT(MAIL_FROM, OBJECTPOINT, 186),

  /*   SMTP   receiver(s) */
  CINIT(MAIL_RCPT, OBJECTPOINT, 187),

  /* FTP:   PASV     PRET */
  CINIT(FTP_USE_PRET, LONG, 188),

  /* RTSP       (OPTIONS, SETUP, PLAY, etc...) */
  CINIT(RTSP_REQUEST, LONG, 189),

  /*  RTSP session     */
  CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190),

  /*  RTSP   URI   */
  CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191),

  /*   :    RTSP     */
  CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192),

  /*       RTSP CSeq      handle */
  CINIT(RTSP_CLIENT_CSEQ, LONG, 193),

  /*       RTSP CSeq      handle*/
  CINIT(RTSP_SERVER_CSEQ, LONG, 194),

  /*      INTERLEAVEFUNCTION. */
  CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),

  /*          RTP        */
  CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),

  /*         */
  CINIT(WILDCARDMATCH, LONG, 197),

  /*    ( )                */
  CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),

    /*   ( )
       ,               */
  CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),

  /*         (fnmatch-like)       */
  CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),

  /*                 */
  CINIT(CHUNK_DATA, OBJECTPOINT, 201),

  /* FNMATCH_FUNCTION     */
  CINIT(FNMATCH_DATA, OBJECTPOINT, 202),

  /*  sets       name:port:address */
  CINIT(RESOLVE, OBJECTPOINT, 203),

  /*   TLS         */
  CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204),

  /*   TLS        */
  CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205),

  /*   TLS        */
  CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),

  /*   1    "TE:"  HTTP     ,         .   0    TE:
          。     0,     libcurl      .

     libcurl        ,     ,          1           i.

  */
  CINIT(TRANSFER_ENCODING, LONG, 207),

  /*   socket       (   close(2)).         curl_closesocket_callback   */
  CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),
  CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),

  /*  GSSAPI     */
  CINIT(GSSAPI_DELEGATION, LONG, 210),

  /*          DNS   */
  CINIT(DNS_SERVERS, OBJECTPOINT, 211),

  /* Time-out            (currently for FTP only) . */
  CINIT(ACCEPTTIMEOUT_MS, LONG, 212),

  /* S  TCP  keepalive */
  CINIT(TCP_KEEPALIVE, LONG, 213),

  /* non-universal      (Linux, AIX, HP-UX, more) */
  CINIT(TCP_KEEPIDLE, LONG, 214),
  CINIT(TCP_KEEPINTVL, LONG, 215),

  /* Enable/disable    SSL    bitmask(   ), see CURLSSLOPT_* */
  CINIT(SSL_OPTIONS, LONG, 216),

  /* set the SMTP          */
  CINIT(MAIL_AUTH, OBJECTPOINT, 217),

  CURLOPT_LASTENTRY /*         */
} CURLoption;

#ifndef CURL_NO_OLDIES /*       ,                       ! */

/*        */
/*     2011    */

/* 7.19.1     */
#define CURLOPT_POST301 CURLOPT_POSTREDIR

/*     2009    */

/*  7.17.0       */
#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
#define CURLOPT_FTPAPPEND CURLOPT_APPEND
#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
#define CURLOPT_FTP_SSL CURLOPT_USE_SSL

/*          */

#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL

#else
/*        CURL_NO_OLDIES       */
#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete *///   
#endif


    /*        CURLOPT_IPRESOLVE   .       
                 IP     ,             IP     . */
#define CURL_IPRESOLVE_WHATEVER 0 /*      ,        ,          ip   */
#define CURL_IPRESOLVE_V4       1 /*    ipv4    */
#define CURL_IPRESOLVE_V6       2 /*    ipv6    */

  /*      “aliases”,          */
#define CURLOPT_WRITEDATA CURLOPT_FILE
#define CURLOPT_READDATA  CURLOPT_INFILE
#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER

  /*  CURLOPT_HTTP_VERSION         . */
enum {
  CURL_HTTP_VERSION_NONE, /*           ,     library              */
  CURL_HTTP_VERSION_1_0,  /*    HTTP 1.0    */
  CURL_HTTP_VERSION_1_1,  /*    HTTP 1.1   */

  CURL_HTTP_VERSION_LAST /* *ILLEGAL* HTTP   */         //   
};

/*
 *    RTSP       API
 */
enum {
    CURL_RTSPREQ_NONE, /*         */
    CURL_RTSPREQ_OPTIONS,
    CURL_RTSPREQ_DESCRIBE,
    CURL_RTSPREQ_ANNOUNCE,
    CURL_RTSPREQ_SETUP,
    CURL_RTSPREQ_PLAY,
    CURL_RTSPREQ_PAUSE,
    CURL_RTSPREQ_TEARDOWN,
    CURL_RTSPREQ_GET_PARAMETER,
    CURL_RTSPREQ_SET_PARAMETER,
    CURL_RTSPREQ_RECORD,
    CURL_RTSPREQ_RECEIVE,
    CURL_RTSPREQ_LAST /*          */
};

  /*         CURLOPT_NETRC     . */
enum CURL_NETRC_OPTION {
  CURL_NETRC_IGNORED,     /*    .netrc          . */
  CURL_NETRC_OPTIONAL,    /* A user: URL          .netrc          . */
  CURL_NETRC_REQUIRED,    /* A user:URL        .
                           *     .netrc           . */
  CURL_NETRC_LAST
};

enum {
  CURL_SSLVERSION_DEFAULT,
  CURL_SSLVERSION_TLSv1,
  CURL_SSLVERSION_SSLv2,
  CURL_SSLVERSION_SSLv3,

  CURL_SSLVERSION_LAST /*      ,     */
};

enum CURL_TLSAUTH {
  CURL_TLSAUTH_NONE,
  CURL_TLSAUTH_SRP,
  CURL_TLSAUTH_LAST /*      ,     */
};

/*     CURLOPT_POSTREDIR.
   CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303
             : CURL_REDIR_POST_301 | CURL_REDIR_POST_302
   | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */

#define CURL_REDIR_GET_ALL  0
#define CURL_REDIR_POST_301 1
#define CURL_REDIR_POST_302 2
#define CURL_REDIR_POST_303 4
#define CURL_REDIR_POST_ALL \
    (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)

typedef enum {
  CURL_TIMECOND_NONE,

  CURL_TIMECOND_IFMODSINCE,
  CURL_TIMECOND_IFUNMODSINCE,
  CURL_TIMECOND_LASTMOD,

  CURL_TIMECOND_LAST
} curl_TimeCond;


/*       libcurl       curl_strequal() and curl_strnequal() , see lib/README.curlx for details */
CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);

/*  CURLFORM_<name>     name    */
#ifdef CFINIT
#undef CFINIT
#endif

#ifdef CURL_ISOCPP
#define CFINIT(name) CURLFORM_ ## name
#else
/*   "##"    ISO C    ,      pre-ISO C     . */
#define CFINIT(name) CURLFORM_/**/name
#endif

typedef enum {
  CFINIT(NOTHING),        /*********          ************/

  /*  */
  CFINIT(COPYNAME),
  CFINIT(PTRNAME),
  CFINIT(NAMELENGTH),
  CFINIT(COPYCONTENTS),
  CFINIT(PTRCONTENTS),
  CFINIT(CONTENTSLENGTH),
  CFINIT(FILECONTENT),
  CFINIT(ARRAY),
  CFINIT(OBSOLETE),
  CFINIT(FILE),

  CFINIT(BUFFER),
  CFINIT(BUFFERPTR),
  CFINIT(BUFFERLENGTH),

  CFINIT(CONTENTTYPE),
  CFINIT(CONTENTHEADER),
  CFINIT(FILENAME),
  CFINIT(END),
  CFINIT(OBSOLETE2),

  CFINIT(STREAM),

  CURLFORM_LASTENTRY /*         */
} CURLformoption;

#undef CFINIT /* done */

/*  CURLFORM_ARRAY      */
struct curl_forms {
  CURLformoption option;
  const char     *value;
};

/*      formpost    */
/* Returns  curl_formadd()    
 *
 * Returns:
 * CURL_FORMADD_OK               
 * CURL_FORMADD_MEMORY             FormInfo   
 * CURL_FORMADD_OPTION_TWICE               
 * CURL_FORMADD_NULL                       char
 * CURL_FORMADD_MEMORY             FormInfo       
 * CURL_FORMADD_UNKNOWN_OPTION             
 * CURL_FORMADD_INCOMPLETE         FormInfo      (   )
 * CURL_FORMADD_MEMORY           curl_httppost      
 * CURL_FORMADD_MEMORY                      .
 * CURL_FORMADD_ILLEGAL_ARRAY      array            
 *
 ***************************************************************************/
typedef enum {
  CURL_FORMADD_OK, /* first, no error */

  CURL_FORMADD_MEMORY,
  CURL_FORMADD_OPTION_TWICE,
  CURL_FORMADD_NULL,
  CURL_FORMADD_UNKNOWN_OPTION,
  CURL_FORMADD_INCOMPLETE,
  CURL_FORMADD_ILLEGAL_ARRAY,
  CURL_FORMADD_DISABLED, /*    libcurl    */

  CURL_FORMADD_LAST /* last */
} CURLFORMcode;

/*
 * NAME curl_formadd()
 *
 * DESCRIPTION
 *
 *      formposts      .             ,          post.     
 * CURLOPT_HTTPPOST       libcurl.
 */
CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
                                      struct curl_httppost **last_post,
                                      ...);

/*
 *  curl_formget()      
 *    *arg   ,           curl_formget() .
 *                .
 *         buffer length     "len",     len
 */
typedef size_t (*curl_formget_callback)(void *arg, const char *buf,
                                        size_t len);

/*
 * NAME curl_formget()
 *
 * DESCRIPTION
 *
 *    curl_formadd()          curl_httppost  .
 *                 curl_formget_callback   .
 * Returns 0 on success.
 */
CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
                             curl_formget_callback append);
/*
 * NAME curl_formfree()
 *
 * DESCRIPTION
 *
 *       curl_formadd()     formpost.
 */
CURL_EXTERN void curl_formfree(struct curl_httppost *form);

/*
 * NAME curl_getenv()
 *
 * DESCRIPTION
 *
 * Returns    malloc()'ed       ,          curl_free()ed
 * DEPRECATED - see lib/README.curlx
 */
CURL_EXTERN char *curl_getenv(const char *variable);

/*
 * NAME curl_version()
 *
 * DESCRIPTION
 *
 * Returns    libcurl         .
 */
CURL_EXTERN char *curl_version(void);

/*
 * NAME curl_easy_escape()
 *
 * DESCRIPTION
 *
 * Escapes URL strings (
 *    %XX URLs            ).                 NULL  (    )。
 * 
 */
CURL_EXTERN char *curl_easy_escape(CURL *handle,
                                   const char *string,
                                   int length);

/*      : */
CURL_EXTERN char *curl_escape(const char *string,
                              int length);


/*
 * NAME curl_easy_unescape()
 *
 * DESCRIPTION
 *
 * Unescapes URL        (         %XX     8bit
 *   ). This                 NULL  (    )
 * Conversion Note:    ASCII  ASCII%XX  ,          
 * 
 */
CURL_EXTERN char *curl_easy_unescape(CURL *handle,
                                     const char *string,
                                     int length,
                                     int *outlength);

/*       */
CURL_EXTERN char *curl_unescape(const char *string,
                                int length);

/*
 * NAME curl_free()
 *
 * DESCRIPTION
 *
 *             
 *  Added in libcurl 7.10
 */
CURL_EXTERN void curl_free(void *p);

/*
 * NAME curl_global_init()
 *
 * DESCRIPTION
 *
 *          libcurl   libcurl       curl_global_init()  
 *            !
 */
CURL_EXTERN CURLcode curl_global_init(long flags);

/*
 * NAME curl_global_init_mem()
 *
 * DESCRIPTION
 *
 *          libcurl  ,      curl_global_init() or curl_global_init_mem()   .        
 * libcurl                  
 *  。               
 *     ,      curl   etc.             ,        .
 */
CURL_EXTERN CURLcode curl_global_init_mem(long flags,
                                          curl_malloc_callback m,
                                          curl_free_callback f,
                                          curl_realloc_callback r,
                                          curl_strdup_callback s,
                                          curl_calloc_callback c);

/*
 * NAME curl_global_cleanup()
 *
 * DESCRIPTION
 *
 *          libcurl  ,       curl_global_cleanup() 
 */
CURL_EXTERN void curl_global_cleanup(void);

/*  CURLOPT_QUOTE         */
struct curl_slist {
  char *data;
  struct curl_slist *next;
};

/*
 * NAME curl_slist_append()
 *
 * DESCRIPTION
 *
 *             。         ,       
 *. Returns        .
 */
CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
                                                 const char *);

/*
 * NAME curl_slist_free_all()
 *
 * DESCRIPTION
 *
 *         curl_slist.
 */
CURL_EXTERN void curl_slist_free_all(struct curl_slist *);

/*
 * NAME curl_getdate()
 *
 * DESCRIPTION
 *
 *      ,        1970            
 *                   NULL。
 */
CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);

/*        ,   OpenSSL   .    CURLOPT_CERTINFO / CURLINFO_CERTINFO    */
struct curl_certinfo {
  int num_of_certs;             /*         */
    struct curl_slist **certinfo; /*         ,    
                                           (    "name: value" )
                                   */
};

#define CURLINFO_STRING   0x100000
#define CURLINFO_LONG     0x200000
#define CURLINFO_DOUBLE   0x300000
#define CURLINFO_SLIST    0x400000
#define CURLINFO_MASK     0x0fffff
#define CURLINFO_TYPEMASK 0xf00000

typedef enum {
  CURLINFO_NONE, /*   ,        */
  CURLINFO_EFFECTIVE_URL    = CURLINFO_STRING + 1,
  CURLINFO_RESPONSE_CODE    = CURLINFO_LONG   + 2,
  CURLINFO_TOTAL_TIME       = CURLINFO_DOUBLE + 3,
  CURLINFO_NAMELOOKUP_TIME  = CURLINFO_DOUBLE + 4,
  CURLINFO_CONNECT_TIME     = CURLINFO_DOUBLE + 5,
  CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
  CURLINFO_SIZE_UPLOAD      = CURLINFO_DOUBLE + 7,
  CURLINFO_SIZE_DOWNLOAD    = CURLINFO_DOUBLE + 8,
  CURLINFO_SPEED_DOWNLOAD   = CURLINFO_DOUBLE + 9,
  CURLINFO_SPEED_UPLOAD     = CURLINFO_DOUBLE + 10,
  CURLINFO_HEADER_SIZE      = CURLINFO_LONG   + 11,
  CURLINFO_REQUEST_SIZE     = CURLINFO_LONG   + 12,
  CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG   + 13,
  CURLINFO_FILETIME         = CURLINFO_LONG   + 14,
  CURLINFO_CONTENT_LENGTH_DOWNLOAD   = CURLINFO_DOUBLE + 15,
  CURLINFO_CONTENT_LENGTH_UPLOAD     = CURLINFO_DOUBLE + 16,
  CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
  CURLINFO_CONTENT_TYPE     = CURLINFO_STRING + 18,
  CURLINFO_REDIRECT_TIME    = CURLINFO_DOUBLE + 19,
  CURLINFO_REDIRECT_COUNT   = CURLINFO_LONG   + 20,
  CURLINFO_PRIVATE          = CURLINFO_STRING + 21,
  CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG   + 22,
  CURLINFO_HTTPAUTH_AVAIL   = CURLINFO_LONG   + 23,
  CURLINFO_PROXYAUTH_AVAIL  = CURLINFO_LONG   + 24,
  CURLINFO_OS_ERRNO         = CURLINFO_LONG   + 25,
  CURLINFO_NUM_CONNECTS     = CURLINFO_LONG   + 26,
  CURLINFO_SSL_ENGINES      = CURLINFO_SLIST  + 27,
  CURLINFO_COOKIELIST       = CURLINFO_SLIST  + 28,
  CURLINFO_LASTSOCKET       = CURLINFO_LONG   + 29,
  CURLINFO_FTP_ENTRY_PATH   = CURLINFO_STRING + 30,
  CURLINFO_REDIRECT_URL     = CURLINFO_STRING + 31,
  CURLINFO_PRIMARY_IP       = CURLINFO_STRING + 32,
  CURLINFO_APPCONNECT_TIME  = CURLINFO_DOUBLE + 33,
  CURLINFO_CERTINFO         = CURLINFO_SLIST  + 34,
  CURLINFO_CONDITION_UNMET  = CURLINFO_LONG   + 35,
  CURLINFO_RTSP_SESSION_ID  = CURLINFO_STRING + 36,
  CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG   + 37,
  CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG   + 38,
  CURLINFO_RTSP_CSEQ_RECV   = CURLINFO_LONG   + 39,
  CURLINFO_PRIMARY_PORT     = CURLINFO_LONG   + 40,
  CURLINFO_LOCAL_IP         = CURLINFO_STRING + 41,
  CURLINFO_LOCAL_PORT       = CURLINFO_LONG   + 42,
  /*          ! */

  CURLINFO_LASTONE          = 42
} CURLINFO;

/* CURLINFO_RESPONSE_CODE         
   CURLINFO_HTTP_CODE */
#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE

typedef enum {
  CURLCLOSEPOLICY_NONE, /*   ,       */

  CURLCLOSEPOLICY_OLDEST,
  CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
  CURLCLOSEPOLICY_LEAST_TRAFFIC,
  CURLCLOSEPOLICY_SLOWEST,
  CURLCLOSEPOLICY_CALLBACK,

  CURLCLOSEPOLICY_LAST /* last, never use this */
} curl_closepolicy;

#define CURL_GLOBAL_SSL (1<<0)
#define CURL_GLOBAL_WIN32 (1<<1)
#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
#define CURL_GLOBAL_NOTHING 0
#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL


/*****************************************************************************
 *     ,PROTOS      。 
 */

/*                  */
typedef enum {
  CURL_LOCK_DATA_NONE = 0,
  /*  CURL_LOCK_DATA_SHARE      
   *                
   *  
   */
  CURL_LOCK_DATA_SHARE,
  CURL_LOCK_DATA_COOKIE,
  CURL_LOCK_DATA_DNS,
  CURL_LOCK_DATA_SSL_SESSION,
  CURL_LOCK_DATA_CONNECT,
  CURL_LOCK_DATA_LAST
} curl_lock_data;

/*          */
typedef enum {
  CURL_LOCK_ACCESS_NONE = 0,   /*       */
  CURL_LOCK_ACCESS_SHARED = 1, /*      */
  CURL_LOCK_ACCESS_SINGLE = 2, /*      */
  CURL_LOCK_ACCESS_LAST        /*      */
} curl_lock_access;

typedef void (*curl_lock_function)(CURL *handle,
                                   curl_lock_data data,
                                   curl_lock_access locktype,
                                   void *userptr);
typedef void (*curl_unlock_function)(CURL *handle,
                                     curl_lock_data data,
                                     void *userptr);

typedef void CURLSH;

typedef enum {
  CURLSHE_OK,  /*       */
  CURLSHE_BAD_OPTION, /* 1 */
  CURLSHE_IN_USE,     /* 2 */
  CURLSHE_INVALID,    /* 3 */
  CURLSHE_NOMEM,      /* 4      */
  CURLSHE_NOT_BUILT_IN, /* 5          */
  CURLSHE_LAST        /* never use */
} CURLSHcode;

typedef enum {
  CURLSHOPT_NONE,  /* don't use */
  CURLSHOPT_SHARE,   /*          */
  CURLSHOPT_UNSHARE, /*             */
  CURLSHOPT_LOCKFUNC,   /*      'curl_lock_function'    */
  CURLSHOPT_UNLOCKFUNC, /*      'curl_unlock_function'    */
    CURLSHOPT_USERDATA,   /*                 /        */
  CURLSHOPT_LAST  /* never use */
} CURLSHoption;

CURL_EXTERN CURLSH *curl_share_init(void);
CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);

/****************************************************************************
 *    curl  ,         
 */

typedef enum {
  CURLVERSION_FIRST,
  CURLVERSION_SECOND,
  CURLVERSION_THIRD,
  CURLVERSION_FOURTH,
  CURLVERSION_LAST /*          */
} CURLversion;

/*  'CURLVERSION_NOW'                      .                  .                       . */
#define CURLVERSION_NOW CURLVERSION_FOURTH

typedef struct {
  CURLversion age;          /*    struct   */
  const char *version;      /* LIBCURL_VERSION */
  unsigned int version_num; /* LIBCURL_VERSION_NUM */
  const char *host;         /* OS/host/cpu/machine when configured */
  int features;             /* bitmask,          */
  const char *ssl_version;  /*        */
  long ssl_version_num;     /*    ,   0*/
  const char *libz_version; /*        */
  /*      NULL protoname       
  const char * const *protocols;

  /*  CURLVERSION_SECOND         */
  const char *ares;
  int ares_num;

  /*       CURLVERSION_THIRD      */
  const char *libidn;

  /*       CURLVERSION_FOURTH       */

  /*      HAVE_ICONV      '_libiconv_version' */
  int iconv_ver_num;

  const char *libssh_version; /*        */

} curl_version_info_data;

#define CURL_VERSION_IPV6      (1<<0)  /* IPv6-enabled */
#define CURL_VERSION_KERBEROS4 (1<<1)  /* Kerberos       */
#define CURL_VERSION_SSL       (1<<2)  /* SSL      */
#define CURL_VERSION_LIBZ      (1<<3)  /* libz       */
#define CURL_VERSION_NTLM      (1<<4)  /*   NTLM    */
#define CURL_VERSION_GSSNEGOTIATE (1<<5) /*   Negotiate(  )    */
#define CURL_VERSION_DEBUG     (1<<6)  /*       */
#define CURL_VERSION_ASYNCHDNS (1<<7)  /*   DNS   */
#define CURL_VERSION_SPNEGO    (1<<8)  /* SPNEGO    */
#define CURL_VERSION_LARGEFILE (1<<9)  /*      2GB     */
#define CURL_VERSION_IDN       (1<<10) /*       (       ) */
#define CURL_VERSION_SSPI      (1<<11) /*    SSPI */
#define CURL_VERSION_CONV      (1<<12) /*       */
#define CURL_VERSION_CURLDEBUG (1<<13) /*         */
#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP      */
#define CURL_VERSION_NTLM_WB   (1<<15) /* NTLM   winbind       */

 /*
 * NAME curl_version_info()
 *
 * DESCRIPTION
 *
 *                    
 *   。   。
 */
CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);

/*
 * NAME curl_easy_strerror()
 *
 * DESCRIPTION
 *
 * curl_easy_strerror           CURLSHcode
 *             。       
 *       .
 */
CURL_EXTERN const char *curl_easy_strerror(CURLcode);

/*
 * NAME curl_share_strerror()
 *
 * DESCRIPTION
 *
 *  curl_share_strerror           CURLSHcode
 *             。       
 *       .
 */
CURL_EXTERN const char *curl_share_strerror(CURLSHcode);

/*
 * NAME curl_easy_pause()
 *
 *   
 *
 *  curl_easy_pause     /       。     bitmask(   )        
 *          
 *
 */
CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);

#define CURLPAUSE_RECV      (1<<0)
#define CURLPAUSE_RECV_CONT (0)

#define CURLPAUSE_SEND      (1<<2)
#define CURLPAUSE_SEND_CONT (0)

#define CURLPAUSE_ALL       (CURLPAUSE_RECV|CURLPAUSE_SEND)
#define CURLPAUSE_CONT      (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)

#ifdef  __cplusplus
}
#endif

/*      , easy.h 、 multi.h           ,     options 、 info! */
#include "easy.h" /* (       ,curl       )nothing in curl is fun without the easy stuff */
#include "multi.h"

/*  typechecker(    )  C++     (yet) */
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
    ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
    !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
#include "typecheck-gcc.h"
#else
#if defined(__STDC__) && (__STDC__ >= 1)
/*               ,                 
*/
#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
#endif /* __STDC__ >= 1 */
#endif /* gcc >= 4.3 && !__cplusplus */

#endif /* __CURL_CURL_H */