| 
									
										
										
										
											2020-04-15 13:15:21 -05:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Asterisk -- An open source telephony toolkit. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2020, Sangoma Technologies Corporation | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Ben Ford <bford@sangoma.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * See http://www.asterisk.org for more information about
 | 
					
						
							|  |  |  |  * the Asterisk project. Please do not directly contact | 
					
						
							|  |  |  |  * any of the maintainers of this project for assistance; | 
					
						
							|  |  |  |  * the project provides a web site, mailing lists and IRC | 
					
						
							|  |  |  |  * channels for your use. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software, distributed under the terms of | 
					
						
							|  |  |  |  * the GNU General Public License Version 2. See the LICENSE file | 
					
						
							|  |  |  |  * at the top of the source tree. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #ifndef _STIR_SHAKEN_CURL_H
 | 
					
						
							|  |  |  | #define _STIR_SHAKEN_CURL_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-28 11:19:54 -06:00
										 |  |  | struct ast_acl_list; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-30 21:04:36 -04:00
										 |  |  | /* Forward declaration for CURL callback data */ | 
					
						
							| 
									
										
										
										
											2020-04-15 13:15:21 -05:00
										 |  |  | struct curl_cb_data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*!
 | 
					
						
							|  |  |  |  * \brief Allocate memory for a curl_cb_data struct | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * \note This will need to be freed by the consumer using curl_cb_data_free | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * \retval NULL on failure | 
					
						
							|  |  |  |  * \retval curl_cb_struct on success | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | struct curl_cb_data *curl_cb_data_create(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*!
 | 
					
						
							|  |  |  |  * \brief Free a curl_cb_data struct | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * \param data The curl_cb_data struct to free | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | void curl_cb_data_free(struct curl_cb_data *data); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*!
 | 
					
						
							|  |  |  |  * \brief Get the cache_control field from a curl_cb_data struct | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * \param data The curl_cb_data | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * \retval cache_control on success | 
					
						
							|  |  |  |  * \retval NULL otherwise | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | char *curl_cb_data_get_cache_control(const struct curl_cb_data *data); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*!
 | 
					
						
							|  |  |  |  * \brief Get the expires field from a curl_cb_data struct | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * \param data The curl_cb_data | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * \retval expires on success | 
					
						
							|  |  |  |  * \retval NULL otherwise | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | char *curl_cb_data_get_expires(const struct curl_cb_data *data); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*!
 | 
					
						
							|  |  |  |  * \brief CURL the public key from the provided URL to the specified path | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-04-21 11:12:55 -05:00
										 |  |  |  * \note The returned string will need to be freed by the caller | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * \param public_cert_url The public cert URL | 
					
						
							| 
									
										
										
										
											2020-04-15 13:15:21 -05:00
										 |  |  |  * \param path The path to download the file to | 
					
						
							|  |  |  |  * \param data The curl_cb_data | 
					
						
							| 
									
										
										
										
											2022-02-28 11:19:54 -06:00
										 |  |  |  * \param acl The ACL to use for cURL (if not NULL) | 
					
						
							| 
									
										
										
										
											2020-04-15 13:15:21 -05:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-04-21 11:12:55 -05:00
										 |  |  |  * \retval NULL on failure | 
					
						
							|  |  |  |  * \retval full path filename on success | 
					
						
							| 
									
										
										
										
											2020-04-15 13:15:21 -05:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2022-02-28 11:19:54 -06:00
										 |  |  | char *curl_public_key(const char *public_cert_url, const char *path, struct curl_cb_data *data, const struct ast_acl_list *acl); | 
					
						
							| 
									
										
										
										
											2020-04-15 13:15:21 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif /* _STIR_SHAKEN_CURL_H */
 |