Asterisk - The Open Source Telephony Project  18.5.0
curl.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2020, Sangoma Technologies Corporation
5  *
6  * Ben Ford <[email protected]>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 #ifndef _STIR_SHAKEN_CURL_H
19 #define _STIR_SHAKEN_CURL_H
20 
21 /* Forward declarion for CURL callback data */
22 struct curl_cb_data;
23 
24 /*!
25  * \brief Allocate memory for a curl_cb_data struct
26  *
27  * \note This will need to be freed by the consumer using curl_cb_data_free
28  *
29  * \retval NULL on failure
30  * \retval curl_cb_struct on success
31  */
32 struct curl_cb_data *curl_cb_data_create(void);
33 
34 /*!
35  * \brief Free a curl_cb_data struct
36  *
37  * \param data The curl_cb_data struct to free
38  */
39 void curl_cb_data_free(struct curl_cb_data *data);
40 
41 /*!
42  * \brief Get the cache_control field from a curl_cb_data struct
43  *
44  * \param data The curl_cb_data
45  *
46  * \retval cache_control on success
47  * \retval NULL otherwise
48  */
49 char *curl_cb_data_get_cache_control(const struct curl_cb_data *data);
50 
51 /*!
52  * \brief Get the expires field from a curl_cb_data struct
53  *
54  * \param data The curl_cb_data
55  *
56  * \retval expires on success
57  * \retval NULL otherwise
58  */
59 char *curl_cb_data_get_expires(const struct curl_cb_data *data);
60 
61 /*!
62  * \brief CURL the public key from the provided URL to the specified path
63  *
64  * \note The returned string will need to be freed by the caller
65  *
66  * \param public_cert_url The public cert URL
67  * \param path The path to download the file to
68  * \param data The curl_cb_data
69  *
70  * \retval NULL on failure
71  * \retval full path filename on success
72  */
73 char *curl_public_key(const char *public_cert_url, const char *path, struct curl_cb_data *data);
74 
75 #endif /* _STIR_SHAKEN_CURL_H */
struct curl_cb_data * curl_cb_data_create(void)
Allocate memory for a curl_cb_data struct.
Definition: curl.c:42
void curl_cb_data_free(struct curl_cb_data *data)
Free a curl_cb_data struct.
Definition: curl.c:51
char * curl_cb_data_get_cache_control(const struct curl_cb_data *data)
Get the cache_control field from a curl_cb_data struct.
Definition: curl.c:63
char * curl_cb_data_get_expires(const struct curl_cb_data *data)
Get the expires field from a curl_cb_data struct.
Definition: curl.c:72
char * curl_public_key(const char *public_cert_url, const char *path, struct curl_cb_data *data)
CURL the public key from the provided URL to the specified path.
Definition: curl.c:185