libacfutils
A general purpose library of utility functions designed to make it easier to develop addons for the X-Plane flight simulator.
Loading...
Searching...
No Matches
chart_prov_common.h
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license in the file COPYING
10 * or http://www.opensource.org/licenses/CDDL-1.0.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file COPYING.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2018 Saso Kiselkov. All rights reserved.
24 */
25
26#ifndef _ACF_UTILS_CHART_PROV_COMMON_H_
27#define _ACF_UTILS_CHART_PROV_COMMON_H_
28
29#include <curl/curl.h>
30
31#include "acfutils/core.h"
32#include "acfutils/chartdb.h"
33#include "chartdb_impl.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39typedef struct {
40 const char *url;
41 chartdb_t *cdb;
42 uint8_t *buf;
43 size_t bufcap;
44 size_t bufsz;
46
47bool_t chart_download_multi(CURL **curl_p, chartdb_t *cdb, const char *url,
48 const char *filepath, const char *method,
49 const chart_prov_info_login_t *login, int timeout,
50 const char *error_prefix, chart_dl_info_t *raw_output);
51bool_t chart_download_multi2(CURL **curl_p, const char *proxy, const char *url,
52 const char *filepath, const char *method,
53 const chart_prov_info_login_t *login, int timeout,
54 const char *error_prefix, chart_dl_info_t *raw_output);
55bool_t chart_download(chartdb_t *cdb, const char *url, const char *filepath,
56 const chart_prov_info_login_t *login, const char *error_prefix,
57 chart_dl_info_t *raw_output);
58void chart_setup_curl(CURL *curl, const char *cainfo);
59void word_subst(char *name, const char **subst);
60bool_t chartdb_want_to_stop(chartdb_t *cdb);
61
62/*
63 * writefunction for curl that uses a chart_dl_info_t
64 */
65void chart_dl_info_init(chart_dl_info_t *info, chartdb_t *cdb, const char *url);
66void chart_dl_info_fini(chart_dl_info_t *info);
67size_t chart_dl_info_write(char *ptr, size_t size, size_t nmemb,
68 void *userdata);
69
70void *chart_get_prov_info(const chart_t *chart, chartdb_t **cdb_p,
71 chart_arpt_t **arpt_p);
72
73#ifdef __cplusplus
74}
75#endif
76
77#endif /* _ACF_UTILS_CHART_PROV_COMMON_H_ */