#include "multiif.h"
#include "sigpipe.h"
#include "ssh.h"
+/* The last 3 #include files should be in this order */
#include "curl_printf.h"
-
-/* The last #include files should be: */
#include "curl_memory.h"
#include "memdebug.h"
/* wVersionRequested in wVersion. wHighVersion contains the */
/* highest supported version. */
- if(LOBYTE( wsaData.wVersion ) != LOBYTE(wVersionRequested) ||
- HIBYTE( wsaData.wVersion ) != HIBYTE(wVersionRequested) ) {
+ if(LOBYTE(wsaData.wVersion) != LOBYTE(wVersionRequested) ||
+ HIBYTE(wsaData.wVersion) != HIBYTE(wVersionRequested) ) {
/* Tell the user that we couldn't find a useable */
/* winsock.dll. */
return CURLE_FAILED_INIT;
}
+ (void)Curl_ipv6works();
+
#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_INIT)
if(libssh2_init(0)) {
DEBUGF(fprintf(stderr, "Error: libssh2_init failed\n"));
* curl_easy_init() is the external interface to alloc, setup and init an
* easy handle that is returned. If anything goes wrong, NULL is returned.
*/
-CURL *curl_easy_init(void)
+struct Curl_easy *curl_easy_init(void)
{
CURLcode result;
- struct SessionHandle *data;
+ struct Curl_easy *data;
/* Make sure we inited the global SSL stuff */
if(!initialized) {
*/
#undef curl_easy_setopt
-CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)
+CURLcode curl_easy_setopt(struct Curl_easy *data, CURLoption tag, ...)
{
va_list arg;
- struct SessionHandle *data = curl;
CURLcode result;
- if(!curl)
+ if(!data)
return CURLE_BAD_FUNCTION_ARGUMENT;
va_start(arg, tag);
* updated.
*/
-static int events_timer(CURLM *multi, /* multi handle */
+static int events_timer(struct Curl_multi *multi, /* multi handle */
long timeout_ms, /* see above */
void *userp) /* private callback pointer */
{
* Callback that gets called with information about socket activity to
* monitor.
*/
-static int events_socket(CURL *easy, /* easy handle */
+static int events_socket(struct Curl_easy *easy, /* easy handle */
curl_socket_t s, /* socket */
int what, /* see above */
void *userp, /* private callback
*
* Do the multi handle setups that only event-based transfers need.
*/
-static void events_setup(CURLM *multi, struct events *ev)
+static void events_setup(struct Curl_multi *multi, struct events *ev)
{
/* timer callback */
curl_multi_setopt(multi, CURLMOPT_TIMERFUNCTION, events_timer);
if(0 == pollrc) {
/* timeout! */
ev->ms = 0;
- /* fprintf(stderr, "call curl_multi_socket_action( TIMEOUT )\n"); */
+ /* fprintf(stderr, "call curl_multi_socket_action(TIMEOUT)\n"); */
mcode = curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, 0,
&ev->running_handles);
}
if(fds[i].revents) {
/* socket activity, tell libcurl */
int act = poll2cselect(fds[i].revents); /* convert */
- infof(multi->easyp, "call curl_multi_socket_action( socket %d )\n",
+ infof(multi->easyp, "call curl_multi_socket_action(socket %d)\n",
fds[i].fd);
mcode = curl_multi_socket_action(multi, fds[i].fd, act,
&ev->running_handles);
*
* Runs a transfer in a blocking manner using the events-based API
*/
-static CURLcode easy_events(CURLM *multi)
+static CURLcode easy_events(struct Curl_multi *multi)
{
struct events evs= {2, FALSE, 0, NULL, 0};
#define easy_events(x) CURLE_NOT_BUILT_IN
#endif
-static CURLcode easy_transfer(CURLM *multi)
+static CURLcode easy_transfer(struct Curl_multi *multi)
{
bool done = FALSE;
CURLMcode mcode = CURLM_OK;
* DEBUG: if 'events' is set TRUE, this function will use a replacement engine
* instead of curl_multi_perform() and use curl_multi_socket_action().
*/
-static CURLcode easy_perform(struct SessionHandle *data, bool events)
+static CURLcode easy_perform(struct Curl_easy *data, bool events)
{
- CURLM *multi;
+ struct Curl_multi *multi;
CURLMcode mcode;
CURLcode result = CURLE_OK;
SIGPIPE_VARIABLE(pipe_st);
* curl_easy_perform() is the external interface that performs a blocking
* transfer as previously setup.
*/
-CURLcode curl_easy_perform(CURL *easy)
+CURLcode curl_easy_perform(struct Curl_easy *data)
{
- return easy_perform(easy, FALSE);
+ return easy_perform(data, FALSE);
}
#ifdef CURLDEBUG
* curl_easy_perform_ev() is the external interface that performs a blocking
* transfer using the event-based API internally.
*/
-CURLcode curl_easy_perform_ev(CURL *easy)
+CURLcode curl_easy_perform_ev(struct Curl_easy *data)
{
- return easy_perform(easy, TRUE);
+ return easy_perform(data, TRUE);
}
#endif
* curl_easy_cleanup() is the external interface to cleaning/freeing the given
* easy handle.
*/
-void curl_easy_cleanup(CURL *curl)
+void curl_easy_cleanup(struct Curl_easy *data)
{
- struct SessionHandle *data = (struct SessionHandle *)curl;
SIGPIPE_VARIABLE(pipe_st);
if(!data)
* information from a performed transfer and similar.
*/
#undef curl_easy_getinfo
-CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
+CURLcode curl_easy_getinfo(struct Curl_easy *data, CURLINFO info, ...)
{
va_list arg;
void *paramp;
CURLcode result;
- struct SessionHandle *data = (struct SessionHandle *)curl;
va_start(arg, info);
paramp = va_arg(arg, void *);
* given input easy handle. The returned handle will be a new working handle
* with all options set exactly as the input source handle.
*/
-CURL *curl_easy_duphandle(CURL *incurl)
+struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
{
- struct SessionHandle *data=(struct SessionHandle *)incurl;
-
- struct SessionHandle *outcurl = calloc(1, sizeof(struct SessionHandle));
+ struct Curl_easy *outcurl = calloc(1, sizeof(struct Curl_easy));
if(NULL == outcurl)
goto fail;
* curl_easy_reset() is an external interface that allows an app to re-
* initialize a session handle to the default values.
*/
-void curl_easy_reset(CURL *curl)
+void curl_easy_reset(struct Curl_easy *data)
{
- struct SessionHandle *data = (struct SessionHandle *)curl;
-
Curl_safefree(data->state.pathbuffer);
data->state.path = NULL;
*
* Action is a bitmask consisting of CURLPAUSE_* bits in curl/curl.h
*/
-CURLcode curl_easy_pause(CURL *curl, int action)
+CURLcode curl_easy_pause(struct Curl_easy *data, int action)
{
- struct SessionHandle *data = (struct SessionHandle *)curl;
struct SingleRequest *k = &data->req;
CURLcode result = CURLE_OK;
if(!result &&
((newstate&(KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) !=
(KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) )
- Curl_expire(data, 1); /* get this handle going again */
+ Curl_expire(data, 0); /* get this handle going again */
return result;
}
-static CURLcode easy_connection(struct SessionHandle *data,
+static CURLcode easy_connection(struct Curl_easy *data,
curl_socket_t *sfd,
struct connectdata **connp)
{
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
* Returns CURLE_OK on success, error code on error.
*/
-CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n)
+CURLcode curl_easy_recv(struct Curl_easy *data, void *buffer, size_t buflen,
+ size_t *n)
{
curl_socket_t sfd;
CURLcode result;
ssize_t n1;
struct connectdata *c;
- struct SessionHandle *data = (struct SessionHandle *)curl;
result = easy_connection(data, &sfd, &c);
if(result)
* Sends data over the connected socket. Use after successful
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
*/
-CURLcode curl_easy_send(CURL *curl, const void *buffer, size_t buflen,
- size_t *n)
+CURLcode curl_easy_send(struct Curl_easy *data, const void *buffer,
+ size_t buflen, size_t *n)
{
curl_socket_t sfd;
CURLcode result;
ssize_t n1;
struct connectdata *c = NULL;
- struct SessionHandle *data = (struct SessionHandle *)curl;
result = easy_connection(data, &sfd, &c);
if(result)