libcurl的回调函数们

//------------------------------------------------------------------------------------------------------

// Callbacks supported in CURL

// Easy Interface
// ---------------------------------------------------------------------------------------------------

//
CURLOPT_PROGRESSFUNCTION
//函数正常情况下每秒被libcurl调用一次,为了使被调用,CURLOPT_NOPROGRESS必须被设置为false,CURLOPT_PROGRESSDATA指定参数
typedef int              (*curl_progress_callback)    (void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);

//CURLOPT_HEADERFUNCTION:
//CURLOPT_WRITEFUNCTION:
//CURLOPT_INTERLEAVEFUNCTION:
//This function gets called by libcurl as soon as it has received interleaved RTP data.
typedef size_t           (*curl_write_callback)       (char *buffer, size_t size, size_t nitems, void *outstream);

//CURLOPT_SEEKFUNCTION
//当libcurl需要定位到文件的特定位置时,就会调用相应的回调函数,并传递这里设置的输入
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
//the CURLOPT_SEEKFUNCTION/DATA pair is taking over what CURLOPT_IOCTLFUNCTION/DATA pair previously provided for seeking
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);

你可能感兴趣的:(网络)