... and save the typedef'ed names for headers and external APIs.
* 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 Curl_easy *data;
*/
#undef curl_easy_setopt
-CURLcode curl_easy_setopt(CURL *data, CURLoption tag, ...)
+CURLcode curl_easy_setopt(struct Curl_easy *data, CURLoption tag, ...)
{
va_list arg;
CURLcode result;
* 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);
*
* 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;
*/
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 *data)
+CURLcode curl_easy_perform(struct Curl_easy *data)
{
return easy_perform(data, FALSE);
}
* 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 *data)
+CURLcode curl_easy_perform_ev(struct Curl_easy *data)
{
return easy_perform(data, TRUE);
}
* curl_easy_cleanup() is the external interface to cleaning/freeing the given
* easy handle.
*/
-void curl_easy_cleanup(CURL *data)
+void curl_easy_cleanup(struct Curl_easy *data)
{
SIGPIPE_VARIABLE(pipe_st);
* information from a performed transfer and similar.
*/
#undef curl_easy_getinfo
-CURLcode curl_easy_getinfo(CURL *data, CURLINFO info, ...)
+CURLcode curl_easy_getinfo(struct Curl_easy *data, CURLINFO info, ...)
{
va_list arg;
void *paramp;
* 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 *data)
+struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
{
struct Curl_easy *outcurl = calloc(1, sizeof(struct Curl_easy));
if(NULL == outcurl)
* 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 *data)
+void curl_easy_reset(struct Curl_easy *data)
{
Curl_safefree(data->state.pathbuffer);
*
* Action is a bitmask consisting of CURLPAUSE_* bits in curl/curl.h
*/
-CURLcode curl_easy_pause(CURL *data, int action)
+CURLcode curl_easy_pause(struct Curl_easy *data, int action)
{
struct SingleRequest *k = &data->req;
CURLcode result = CURLE_OK;
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
* Returns CURLE_OK on success, error code on error.
*/
-CURLcode curl_easy_recv(CURL *data, 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;
* Sends data over the connected socket. Use after successful
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
*/
-CURLcode curl_easy_send(CURL *data, 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;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* Prototypes for library-wide functions provided by easy.c
*/
#ifdef CURLDEBUG
-CURL_EXTERN CURLcode curl_easy_perform_ev(CURL *easy);
+CURL_EXTERN CURLcode curl_easy_perform_ev(struct Curl_easy *easy);
#endif
#endif /* HEADER_CURL_EASYIF_H */
return curl_easy_unescape(NULL, string, length, NULL);
}
-char *curl_easy_escape(CURL *handle, const char *string, int inlength)
+char *curl_easy_escape(struct Curl_easy *data, const char *string,
+ int inlength)
{
size_t alloc = (inlength?(size_t)inlength:strlen(string))+1;
char *ns;
}
}
- result = Curl_convert_to_network(handle, &in, 1);
+ result = Curl_convert_to_network(data, &in, 1);
if(result) {
/* Curl_convert_to_network calls failf if unsuccessful */
free(ns);
* If length == 0, the length is assumed to be strlen(string).
* If olen == NULL, no output length is stored.
*/
-char *curl_easy_unescape(CURL *handle, const char *string, int length,
- int *olen)
+char *curl_easy_unescape(struct Curl_easy *data, const char *string,
+ int length, int *olen)
{
char *str = NULL;
size_t inputlen = length;
size_t outputlen;
- CURLcode res = Curl_urldecode(handle, string, inputlen, &str, &outputlen,
+ CURLcode res = Curl_urldecode(data, string, inputlen, &str, &outputlen,
FALSE);
if(res)
return NULL;
return NULL;
}
-static CURL *duphandle(struct Curl_easy *data)
+static struct Curl_easy *duphandle(struct Curl_easy *data)
{
struct Curl_easy *second = curl_easy_duphandle(data);
if(second) {
#define CURL_MULTI_HANDLE 0x000bab1e
#define GOOD_MULTI_HANDLE(x) \
- ((x) && (((struct Curl_multi *)(x))->type == CURL_MULTI_HANDLE))
+ ((x) && (x)->type == CURL_MULTI_HANDLE)
static void singlesocket(struct Curl_multi *multi,
struct Curl_easy *data);
/* -1 means it not set by user, use the default value */
multi->maxconnects = -1;
- return (CURLM *) multi;
+ return multi;
error:
return NULL;
}
-CURLM *curl_multi_init(void)
+struct Curl_multi *curl_multi_init(void)
{
return Curl_multi_handle(CURL_SOCKET_HASH_TABLE_SIZE,
CURL_CONNECTION_HASH_SIZE);
}
-CURLMcode curl_multi_add_handle(CURLM *multi, CURL *data)
+CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
+ struct Curl_easy *data)
{
struct curl_llist *timeoutlist;
return result;
}
-CURLMcode curl_multi_remove_handle(CURLM *multi, CURL *data)
+CURLMcode curl_multi_remove_handle(struct Curl_multi *multi,
+ struct Curl_easy *data)
{
struct Curl_easy *easy = data;
bool premature;
}
-CURLMcode curl_multi_fdset(CURLM *multi,
+CURLMcode curl_multi_fdset(struct Curl_multi *multi,
fd_set *read_fd_set, fd_set *write_fd_set,
fd_set *exc_fd_set, int *max_fd)
{
return CURLM_OK;
}
-CURLMcode curl_multi_wait(CURLM *multi,
+CURLMcode curl_multi_wait(struct Curl_multi *multi,
struct curl_waitfd extra_fds[],
unsigned int extra_nfds,
int timeout_ms,
}
-CURLMcode curl_multi_perform(CURLM *multi, int *running_handles)
+CURLMcode curl_multi_perform(struct Curl_multi *multi, int *running_handles)
{
struct Curl_easy *data;
CURLMcode returncode=CURLM_OK;
}
}
-CURLMcode curl_multi_cleanup(CURLM *multi)
+CURLMcode curl_multi_cleanup(struct Curl_multi *multi)
{
struct Curl_easy *data;
struct Curl_easy *nextdata;
* beyond. The current design is fully O(1).
*/
-CURLMsg *curl_multi_info_read(CURLM *multi, int *msgs_in_queue)
+CURLMsg *curl_multi_info_read(struct Curl_multi *multi, int *msgs_in_queue)
{
struct Curl_message *msg;
}
#undef curl_multi_setopt
-CURLMcode curl_multi_setopt(CURLM *multi,
+CURLMcode curl_multi_setopt(struct Curl_multi *multi,
CURLMoption option, ...)
{
CURLMcode res = CURLM_OK;
/* we define curl_multi_socket() in the public multi.h header */
#undef curl_multi_socket
-CURLMcode curl_multi_socket(CURLM *multi, curl_socket_t s,
+CURLMcode curl_multi_socket(struct Curl_multi *multi, curl_socket_t s,
int *running_handles)
{
CURLMcode result = multi_socket(multi, FALSE, s, 0, running_handles);
return result;
}
-CURLMcode curl_multi_socket_action(CURLM *multi, curl_socket_t s,
+CURLMcode curl_multi_socket_action(struct Curl_multi *multi, curl_socket_t s,
int ev_bitmask, int *running_handles)
{
CURLMcode result = multi_socket(multi, FALSE, s,
return result;
}
-CURLMcode curl_multi_socket_all(CURLM *multi, int *running_handles)
+CURLMcode curl_multi_socket_all(struct Curl_multi *multi, int *running_handles)
{
CURLMcode result = multi_socket(multi, TRUE, CURL_SOCKET_BAD, 0,
return CURLM_OK;
}
-CURLMcode curl_multi_timeout(CURLM *multi,
+CURLMcode curl_multi_timeout(struct Curl_multi *multi,
long *timeout_ms)
{
/* First, make some basic checks that the CURLM handle is a good handle */
Curl_expire(data, milli);
}
-CURLMcode curl_multi_assign(CURLM *multi, curl_socket_t s, void *hashp)
+CURLMcode curl_multi_assign(struct Curl_multi *multi, curl_socket_t s,
+ void *hashp)
{
struct Curl_sh_entry *there = NULL;
/* The last #include file should be: */
#include "memdebug.h"
-CURLSH *
+struct Curl_share *
curl_share_init(void)
{
struct Curl_share *share = calloc(1, sizeof(struct Curl_share));
#undef curl_share_setopt
CURLSHcode
-curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
+curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...)
{
- struct Curl_share *share = (struct Curl_share *)sh;
va_list param;
int type;
curl_lock_function lockfunc;
}
CURLSHcode
-curl_share_cleanup(CURLSH *sh)
+curl_share_cleanup(struct Curl_share *share)
{
- struct Curl_share *share = (struct Curl_share *)sh;
-
if(share == NULL)
return CURLSHE_INVALID;
}
#ifdef HAVE_LIBSSH2_KNOWNHOST_API
-static int sshkeycallback(CURL *easy,
+static int sshkeycallback(struct Curl_easy *easy,
const struct curl_khkey *knownkey, /* known */
const struct curl_khkey *foundkey, /* found */
enum curl_khmatch match,