要写一个LibCURL的Wrapper,有必要把它的回调函数整理一下。尽管花了写时间,但是对LibCURL的全貌有了更多的了解。
-----#include
- Piaoger
//------------------------------------------------------------------------------------------------------
// Callbacks supported in CURL
// Easy Interface
// ---------------------------------------------------------------------------------------------------
//CURLOPT_PROGRESSFUNCTION
//
typedef int (*curl_progress_callback) (void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
//CURLOPT_HEADERFUNCTION:
//CURLOPT_WRITEFUNCTION:
//CURLOPT_INTERLEAVEFUNCTION:
//
typedef size_t (*curl_write_callback) (char *buffer, size_t size, size_t nitems, void *outstream);
//CURLOPT_SEEKFUNCTION
//
typedef int (*curl_seek_callback) (void *instream, curl_off_t offset, int origin);
//CURLOPT_READFUNCTION
//
typedef size_t (*curl_read_callback) (char *buffer, size_t size, size_t nitems, void *instream);
//CURLOPT_SOCKOPTFUNCTION
//
typedef int (*curl_sockopt_callback) (void *clientp, curl_socket_t curlfd, curlsocktype purpose);
//CURLOPT_OPENSOCKETFUNCTION
//
typedef curl_socket_t (*curl_opensocket_callback) (void *clientp, curlsocktype purpose, struct curl_sockaddr *address);
//CURLOPT_IOCTLFUNCTION
//
typedef curlioerr (*curl_ioctl_callback) (CURL *handle, int cmd, void *clientp);
//CURLOPT_DEBUGFUNCTION
//
typedef int (*curl_debug_callback) (CURL *handle, curl_infotype type, char *data, size_t size, void *userptr);
//CURLOPT_CONV_FROM_NETWORK_FUNCTION:
//CURLOPT_CONV_TO_NETWORK_FUNCTION:
//CURLOPT_CONV_FROM_UTF8_FUNCTION:
//
typedef CURLcode (*curl_conv_callback) (char *buffer, size_t length);
//CURLOPT_SSL_CTX_FUNCTION
//
typedef CURLcode (*curl_ssl_ctx_callback) (CURL *curl, void *openssl_ctx, void *userptr);
// CURLOPT_SSH_KEYFUNCTION
//
typedef int (*curl_sshkeycallback) (CURL *easy, const struct curl_khkey *knownkey, const struct curl_khkey *foundkey, enum curl_khmatch, void *clientp);
// Memory Related
//
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);
// Other
//
typedef size_t (*curl_formget_callback) (void *arg, const char *buf, size_t len);
// Multi Interface
// ---------------------------------------------------------------------------------------------------
typedef int (*curl_socket_callback) (CURL *easy, curl_socket_t s, int what, void *userp, void *socketp);
typedef int (*curl_multi_timer_callback) (CURLM *multi, long timeout_ms, void *userp);
// Shared Interface
// ---------------------------------------------------------------------------------------------------
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);
转载:
阅读(9534) | 评论(0) | 转发(0) |