📄 curl.h
字号:
* NAME curl_formget() * * DESCRIPTION * * Serialize a curl_httppost struct built with curl_formadd(). * Accepts a void pointer as second argument which will be passed to * the curl_formget_callback function. * Returns 0 on success. */CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg, curl_formget_callback append);/* * NAME curl_formfree() * * DESCRIPTION * * Free a multipart formpost previously built with curl_formadd(). */CURL_EXTERN void curl_formfree(struct curl_httppost *form);/* * NAME curl_getenv() * * DESCRIPTION * * Returns a malloc()'ed string that MUST be curl_free()ed after usage is * complete. DEPRECATED - see lib/README.curlx */CURL_EXTERN char *curl_getenv(const char *variable);/* * NAME curl_version() * * DESCRIPTION * * Returns a static ascii string of the libcurl version. */CURL_EXTERN char *curl_version(void);/* * NAME curl_easy_escape() * * DESCRIPTION * * Escapes URL strings (converts all letters consider illegal in URLs to their * %XX versions). This function returns a new allocated string or NULL if an * error occurred. */CURL_EXTERN char *curl_easy_escape(CURL *handle, const char *string, int length);/* the previous version: */CURL_EXTERN char *curl_escape(const char *string, int length);/* * NAME curl_easy_unescape() * * DESCRIPTION * * Unescapes URL encoding in strings (converts all %XX codes to their 8bit * versions). This function returns a new allocated string or NULL if an error * occurred. * Conversion Note: On non-ASCII platforms the ASCII %XX codes are * converted into the host encoding. */CURL_EXTERN char *curl_easy_unescape(CURL *handle, const char *string, int length, int *outlength);/* the previous version */CURL_EXTERN char *curl_unescape(const char *string, int length);/* * NAME curl_free() * * DESCRIPTION * * Provided for de-allocation in the same translation unit that did the * allocation. Added in libcurl 7.10 */CURL_EXTERN void curl_free(void *p);/* * NAME curl_global_init() * * DESCRIPTION * * curl_global_init() should be invoked exactly once for each application that * uses libcurl */CURL_EXTERN CURLcode curl_global_init(long flags);/* * NAME curl_global_init_mem() * * DESCRIPTION * * curl_global_init() or curl_global_init_mem() should be invoked exactly once * for each application that uses libcurl. This function can be used to * initialize libcurl and set user defined memory management callback * functions. Users can implement memory management routines to check for * memory leaks, check for mis-use of the curl library etc. User registered * callback routines with be invoked by this library instead of the system * memory management routines like malloc, free 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 * * curl_global_cleanup() should be invoked exactly once for each application * that uses libcurl */CURL_EXTERN void curl_global_cleanup(void);/* linked-list structure for the CURLOPT_QUOTE option (and other) */struct curl_slist { char *data; struct curl_slist *next;};/* * NAME curl_slist_append() * * DESCRIPTION * * Appends a string to a linked list. If no list exists, it will be created * first. Returns the new list, after appending. */CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *, const char *);/* * NAME curl_slist_free_all() * * DESCRIPTION * * free a previously built curl_slist. */CURL_EXTERN void curl_slist_free_all(struct curl_slist *);/* * NAME curl_getdate() * * DESCRIPTION * * Returns the time, in seconds since 1 Jan 1970 of the time string given in * the first argument. The time argument in the second parameter is unused * and should be set to NULL. */CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);#define CURLINFO_STRING 0x100000#define CURLINFO_LONG 0x200000#define CURLINFO_DOUBLE 0x300000#define CURLINFO_SLIST 0x400000#define CURLINFO_MASK 0x0fffff#define CURLINFO_TYPEMASK 0xf00000typedef enum { CURLINFO_NONE, /* first, never use this */ 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, /* Fill in new entries below here! */ CURLINFO_LASTONE = 30} CURLINFO;/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as CURLINFO_HTTP_CODE */#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODEtypedef enum { CURLCLOSEPOLICY_NONE, /* first, never use this */ 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/***************************************************************************** * Setup defines, protos etc for the sharing stuff. *//* Different data locks for a single share */typedef enum { CURL_LOCK_DATA_NONE = 0, /* CURL_LOCK_DATA_SHARE is used internaly to say that * the locking is just made to change the internal state of the share * itself. */ 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;/* Different lock access types */typedef enum { CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */ CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */ CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */ CURL_LOCK_ACCESS_LAST /* never use */} 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, /* all is fine */ CURLSHE_BAD_OPTION, /* 1 */ CURLSHE_IN_USE, /* 2 */ CURLSHE_INVALID, /* 3 */ CURLSHE_NOMEM, /* out of memory */ CURLSHE_LAST /* never use */} CURLSHcode;typedef enum { CURLSHOPT_NONE, /* don't use */ CURLSHOPT_SHARE, /* specify a data type to share */ CURLSHOPT_UNSHARE, /* specify shich data type to stop sharing */ CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */ CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */ CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock callback functions */ 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 *);/**************************************************************************** * Structures for querying information about the curl library at runtime. */typedef enum { CURLVERSION_FIRST, CURLVERSION_SECOND, CURLVERSION_THIRD, CURLVERSION_LAST /* never actually use this */} CURLversion;/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by basicly all programs ever, that want to get version information. It is meant to be a built-in version number for what kind of struct the caller expects. If the struct ever changes, we redefine the NOW to another enum from above. */#define CURLVERSION_NOW CURLVERSION_THIRDtypedef struct { CURLversion age; /* age of the returned 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, see defines below */ const char *ssl_version; /* human readable string */ long ssl_version_num; /* not used anymore, always 0 */ const char *libz_version; /* human readable string */ /* protocols is terminated by an entry with a NULL protoname */ const char * const *protocols; /* The fields below this were added in CURLVERSION_SECOND */ const char *ares; int ares_num; /* This field was added in CURLVERSION_THIRD */ const char *libidn; /* Same as '_libiconv_version' if built with HAVE_ICONV */ int iconv_ver_num;} curl_version_info_data;#define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */#define CURL_VERSION_KERBEROS4 (1<<1) /* kerberos auth is supported */#define CURL_VERSION_SSL (1<<2) /* SSL options are present */#define CURL_VERSION_LIBZ (1<<3) /* libz features are present */#define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */#define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */#define CURL_VERSION_ASYNCHDNS (1<<7) /* asynchronous dns resolves */#define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */#define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */#define CURL_VERSION_IDN (1<<10) /* International Domain Names support */#define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */#define CURL_VERSION_CONV (1<<12) /* character conversions are supported *//* * NAME curl_version_info() * * DESCRIPTION * * This function returns a pointer to a static copy of the version info * struct. See above. */CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);/* * NAME curl_easy_strerror() * * DESCRIPTION * * The curl_easy_strerror function may be used to turn a CURLcode value * into the equivalent human readable error string. This is useful * for printing meaningful error messages. */CURL_EXTERN const char *curl_easy_strerror(CURLcode);/* * NAME curl_share_strerror() * * DESCRIPTION * * The curl_share_strerror function may be used to turn a CURLSHcode value * into the equivalent human readable error string. This is useful * for printing meaningful error messages. */CURL_EXTERN const char *curl_share_strerror(CURLSHcode);#ifdef __cplusplus}#endif/* unfortunately, the easy.h and multi.h include files need options and info stuff before they can be included! */#include "easy.h" /* nothing in curl is fun without the easy stuff */#include "multi.h"#endif /* __CURL_CURL_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -