]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/import/curl-util.h
Merge pull request #12508 from keszybz/no-root-checks
[thirdparty/systemd.git] / src / import / curl-util.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
72648326
LP
2#pragma once
3
72648326 4#include <curl/curl.h>
71d35b6b 5#include <sys/types.h>
72648326 6
72648326
LP
7#include "sd-event.h"
8
07630cea 9#include "hashmap.h"
ca78ad1d 10#include "time-util.h"
07630cea 11
72648326
LP
12typedef struct CurlGlue CurlGlue;
13
14struct 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
25int curl_glue_new(CurlGlue **glue, sd_event *event);
26CurlGlue* curl_glue_unref(CurlGlue *glue);
27
28DEFINE_TRIVIAL_CLEANUP_FUNC(CurlGlue*, curl_glue_unref);
29
30int curl_glue_make(CURL **ret, const char *url, void *userdata);
31int curl_glue_add(CurlGlue *g, CURL *c);
32void curl_glue_remove_and_free(CurlGlue *g, CURL *c);
33
34struct curl_slist *curl_slist_new(const char *first, ...) _sentinel_;
35int curl_header_strdup(const void *contents, size_t sz, const char *field, char **value);
5fa89b2c 36int curl_parse_http_time(const char *t, usec_t *ret);
72648326
LP
37
38DEFINE_TRIVIAL_CLEANUP_FUNC(CURL*, curl_easy_cleanup);
0d94088e 39DEFINE_TRIVIAL_CLEANUP_FUNC(CURL*, curl_multi_cleanup);
72648326 40DEFINE_TRIVIAL_CLEANUP_FUNC(struct curl_slist*, curl_slist_free_all);