mirror of
https://github.com/curl/curl.git
synced 2025-02-17 14:59:45 +08:00
curl_multi_socket() updates
This commit is contained in:
parent
e5babd086d
commit
778b6a86c0
@ -83,8 +83,6 @@ extern "C" {
|
|||||||
|
|
||||||
typedef void CURLM;
|
typedef void CURLM;
|
||||||
|
|
||||||
#ifdef HAVE_CURL_MULTI_SOCKET /* this is not set by anything yet */
|
|
||||||
|
|
||||||
#ifndef curl_socket_typedef
|
#ifndef curl_socket_typedef
|
||||||
/* Public socket typedef */
|
/* Public socket typedef */
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -97,8 +95,6 @@ typedef int curl_socket_t;
|
|||||||
#define curl_socket_typedef
|
#define curl_socket_typedef
|
||||||
#endif /* curl_socket_typedef */
|
#endif /* curl_socket_typedef */
|
||||||
|
|
||||||
#endif /* HAVE_CURL_MULTI_SOCKET */
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() soon */
|
CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() soon */
|
||||||
CURLM_OK,
|
CURLM_OK,
|
||||||
@ -106,6 +102,8 @@ typedef enum {
|
|||||||
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
|
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
|
||||||
CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
|
CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
|
||||||
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
|
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
|
||||||
|
CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
|
||||||
|
CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
|
||||||
CURLM_LAST
|
CURLM_LAST
|
||||||
} CURLMcode;
|
} CURLMcode;
|
||||||
|
|
||||||
@ -243,7 +241,6 @@ CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
|
|||||||
*/
|
*/
|
||||||
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
|
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
|
||||||
|
|
||||||
#ifdef HAVE_CURL_MULTI_SOCKET
|
|
||||||
/*
|
/*
|
||||||
* Name: curl_multi_socket() and
|
* Name: curl_multi_socket() and
|
||||||
* curl_multi_socket_all()
|
* curl_multi_socket_all()
|
||||||
@ -259,8 +256,6 @@ CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
|
|||||||
#define CURL_POLL_INOUT 3
|
#define CURL_POLL_INOUT 3
|
||||||
#define CURL_POLL_REMOVE 4
|
#define CURL_POLL_REMOVE 4
|
||||||
|
|
||||||
#define CURL_EASY_NONE (CURL *)0
|
|
||||||
#define CURL_EASY_TIMEOUT (CURL *)0
|
|
||||||
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
|
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
|
||||||
|
|
||||||
typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
|
typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
|
||||||
@ -268,15 +263,9 @@ typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
|
|||||||
int what, /* see above */
|
int what, /* see above */
|
||||||
void *userp); /* "private" pointer */
|
void *userp); /* "private" pointer */
|
||||||
|
|
||||||
CURLMcode curl_multi_socket(CURLM *multi_handle,
|
CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s);
|
||||||
curl_socket_t s,
|
|
||||||
CURL *easy,
|
|
||||||
curl_socket_callback callback,
|
|
||||||
void *userp); /* passed to callback */
|
|
||||||
|
|
||||||
CURLMcode curl_multi_socket_all(CURLM *multi_handle,
|
CURLMcode curl_multi_socket_all(CURLM *multi_handle);
|
||||||
curl_socket_callback callback,
|
|
||||||
void *userp); /* passed to callback */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Name: curl_multi_timeout()
|
* Name: curl_multi_timeout()
|
||||||
@ -289,7 +278,39 @@ CURLMcode curl_multi_socket_all(CURLM *multi_handle,
|
|||||||
*/
|
*/
|
||||||
CURLMcode curl_multi_timeout(CURLM *multi_handle, long *milliseconds);
|
CURLMcode curl_multi_timeout(CURLM *multi_handle, long *milliseconds);
|
||||||
|
|
||||||
#endif /* HAVE_CURL_MULTI_SOCKET */
|
#undef CINIT /* re-using the same name as in curl.h */
|
||||||
|
|
||||||
|
#ifdef CURL_ISOCPP
|
||||||
|
#define CINIT(name,type,number) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + number
|
||||||
|
#else
|
||||||
|
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
|
||||||
|
#define LONG CURLOPTTYPE_LONG
|
||||||
|
#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
|
||||||
|
#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
|
||||||
|
#define OFF_T CURLOPTTYPE_OFF_T
|
||||||
|
#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
/* This is the socket callback function pointer */
|
||||||
|
CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
|
||||||
|
|
||||||
|
/* This is the argument passed to the socket callback */
|
||||||
|
CINIT(SOCKETDATA, OBJECTPOINT, 2),
|
||||||
|
|
||||||
|
CURLMOPT_LASTENTRY /* the last unused */
|
||||||
|
} CURLMoption;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_setopt()
|
||||||
|
*
|
||||||
|
* Desc: Sets options for the multi handle.
|
||||||
|
*
|
||||||
|
* Returns: CURLM error code.
|
||||||
|
*/
|
||||||
|
CURLMcode curl_multi_setopt(CURLM *multi_handle,
|
||||||
|
CURLMoption option, ...);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* end of extern "C" */
|
} /* end of extern "C" */
|
||||||
|
Loading…
Reference in New Issue
Block a user