]>
Commit | Line | Data |
---|---|---|
72648326 LP |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
3 | #pragma once | |
4 | ||
5 | /*** | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2014 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | ***/ | |
23 | ||
24 | #include <sys/types.h> | |
25 | #include <curl/curl.h> | |
26 | ||
72648326 LP |
27 | #include "sd-event.h" |
28 | ||
07630cea LP |
29 | #include "hashmap.h" |
30 | ||
72648326 LP |
31 | typedef struct CurlGlue CurlGlue; |
32 | ||
33 | struct CurlGlue { | |
34 | sd_event *event; | |
35 | CURLM *curl; | |
36 | sd_event_source *timer; | |
37 | Hashmap *ios; | |
38 | Hashmap *translate_fds; | |
39 | ||
40 | void (*on_finished)(CurlGlue *g, CURL *curl, CURLcode code); | |
41 | void *userdata; | |
42 | }; | |
43 | ||
44 | int curl_glue_new(CurlGlue **glue, sd_event *event); | |
45 | CurlGlue* curl_glue_unref(CurlGlue *glue); | |
46 | ||
47 | DEFINE_TRIVIAL_CLEANUP_FUNC(CurlGlue*, curl_glue_unref); | |
48 | ||
49 | int curl_glue_make(CURL **ret, const char *url, void *userdata); | |
50 | int curl_glue_add(CurlGlue *g, CURL *c); | |
51 | void curl_glue_remove_and_free(CurlGlue *g, CURL *c); | |
52 | ||
53 | struct curl_slist *curl_slist_new(const char *first, ...) _sentinel_; | |
54 | int curl_header_strdup(const void *contents, size_t sz, const char *field, char **value); | |
5fa89b2c | 55 | int curl_parse_http_time(const char *t, usec_t *ret); |
72648326 LP |
56 | |
57 | DEFINE_TRIVIAL_CLEANUP_FUNC(CURL*, curl_easy_cleanup); | |
58 | DEFINE_TRIVIAL_CLEANUP_FUNC(struct curl_slist*, curl_slist_free_all); |