]>
Commit | Line | Data |
---|---|---|
52ad194e | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
e735f4d4 MP |
2 | #pragma once |
3 | ||
e735f4d4 | 4 | #include <curl/curl.h> |
4c89c718 | 5 | #include <sys/types.h> |
e735f4d4 | 6 | |
e735f4d4 MP |
7 | #include "sd-event.h" |
8 | ||
db2df898 | 9 | #include "hashmap.h" |
bb4f798a | 10 | #include "time-util.h" |
db2df898 | 11 | |
e735f4d4 MP |
12 | typedef struct CurlGlue CurlGlue; |
13 | ||
14 | struct CurlGlue { | |
15 | sd_event *event; | |
16 | CURLM *curl; | |
17 | sd_event_source *timer; | |
18 | Hashmap *ios; | |
19 | Hashmap *translate_fds; | |
20 | ||
21 | void (*on_finished)(CurlGlue *g, CURL *curl, CURLcode code); | |
22 | void *userdata; | |
23 | }; | |
24 | ||
25 | int curl_glue_new(CurlGlue **glue, sd_event *event); | |
26 | CurlGlue* curl_glue_unref(CurlGlue *glue); | |
27 | ||
28 | DEFINE_TRIVIAL_CLEANUP_FUNC(CurlGlue*, curl_glue_unref); | |
29 | ||
30 | int curl_glue_make(CURL **ret, const char *url, void *userdata); | |
31 | int curl_glue_add(CurlGlue *g, CURL *c); | |
32 | void curl_glue_remove_and_free(CurlGlue *g, CURL *c); | |
33 | ||
34 | struct curl_slist *curl_slist_new(const char *first, ...) _sentinel_; | |
35 | int curl_header_strdup(const void *contents, size_t sz, const char *field, char **value); | |
36 | int curl_parse_http_time(const char *t, usec_t *ret); | |
37 | ||
38 | DEFINE_TRIVIAL_CLEANUP_FUNC(CURL*, curl_easy_cleanup); | |
6e866b33 | 39 | DEFINE_TRIVIAL_CLEANUP_FUNC(CURL*, curl_multi_cleanup); |
e735f4d4 | 40 | DEFINE_TRIVIAL_CLEANUP_FUNC(struct curl_slist*, curl_slist_free_all); |