summaryrefslogtreecommitdiff
path: root/src/curl/curl.h
blob: dd5798a0c850d0a6363145aa4d4995b18f9158e5 (plain)
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
#pragma once

#include <al/str.h>
#include <curl/curl.h>

#include "../loop.h"

struct nn_curl {
    struct nn_event_loop *loop;
    ev_io event;
    bool started;
    ev_timer timer;
    bool timer_started;
    CURL *handle;
    CURLM *multi_handle;
    bool added;
    curl_socket_t sock;
    void (*handle_events)(void *, struct nn_curl *);
    void *userdata;
};

bool nn_curl_init(struct nn_curl *curl);
void nn_curl_set_url(struct nn_curl *curl, str *url);
bool nn_curl_add_handle(struct nn_curl *curl);
bool nn_curl_remove_handle(struct nn_curl *curl);
void nn_curl_close(struct nn_curl *curl);