-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevcurl.h
52 lines (37 loc) · 1.08 KB
/
evcurl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef __evcurl_h__
#define __evcurl_h__
#include <ev.h>
#include <curl/curl.h>
typedef struct evcurl_processor_s
{
struct ev_loop *loop;
struct ev_timer timer_event;
CURLM *multi;
int still_running;
} evcurl_processor_t;
evcurl_processor_t *evcurl_create(struct ev_loop* loop);
void evcurl_destroy(evcurl_processor_t* __evcurl_pi);
typedef struct evcurl_req_result_s
{
CURLcode result;
const char* effective_url;
long response_code;
const char* content_type;
void* body;
size_t sz_body;
} evcurl_req_result_t;
typedef void (*evcurl_req_done_cb)(evcurl_req_result_t* res, void* src_req_data);
CURLMcode evcurl_new_http_GET(evcurl_processor_t *mp, char *url, evcurl_req_done_cb _finish_cb);
typedef struct evcurl_upload_req_s
{
long timeout;
long connect_timeout;
const char* url;
const char* username;
const char* password;
void* buf;
size_t sz_buf;
void* ptr;
} evcurl_upload_req_t;
CURLMcode evcurl_new_UPLOAD(evcurl_processor_t *mp, evcurl_upload_req_t* req, evcurl_req_done_cb _finish_cb);
#endif //__evcurl_h__