]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/import/curl-util.h
tree-wide: drop license boilerplate
[thirdparty/systemd.git] / src / import / curl-util.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
72648326
LP
2#pragma once
3
4/***
5 This file is part of systemd.
6
7 Copyright 2014 Lennart Poettering
72648326
LP
8***/
9
72648326 10#include <curl/curl.h>
71d35b6b 11#include <sys/types.h>
72648326 12
72648326
LP
13#include "sd-event.h"
14
07630cea
LP
15#include "hashmap.h"
16
72648326
LP
17typedef struct CurlGlue CurlGlue;
18
19struct CurlGlue {
20 sd_event *event;
21 CURLM *curl;
22 sd_event_source *timer;
23 Hashmap *ios;
24 Hashmap *translate_fds;
25
26 void (*on_finished)(CurlGlue *g, CURL *curl, CURLcode code);
27 void *userdata;
28};
29
30int curl_glue_new(CurlGlue **glue, sd_event *event);
31CurlGlue* curl_glue_unref(CurlGlue *glue);
32
33DEFINE_TRIVIAL_CLEANUP_FUNC(CurlGlue*, curl_glue_unref);
34
35int curl_glue_make(CURL **ret, const char *url, void *userdata);
36int curl_glue_add(CurlGlue *g, CURL *c);
37void curl_glue_remove_and_free(CurlGlue *g, CURL *c);
38
39struct curl_slist *curl_slist_new(const char *first, ...) _sentinel_;
40int curl_header_strdup(const void *contents, size_t sz, const char *field, char **value);
5fa89b2c 41int curl_parse_http_time(const char *t, usec_t *ret);
72648326
LP
42
43DEFINE_TRIVIAL_CLEANUP_FUNC(CURL*, curl_easy_cleanup);
44DEFINE_TRIVIAL_CLEANUP_FUNC(struct curl_slist*, curl_slist_free_all);