Asterisk - The Open Source Telephony Project
18.5.0
|
#include "asterisk.h"
#include <curl/curl.h>
#include "asterisk/module.h"
#include "asterisk/bucket.h"
#include "asterisk/sorcery.h"
#include "asterisk/threadstorage.h"
Go to the source code of this file.
Data Structures | |
struct | curl_bucket_file_data |
Data passed to cURL callbacks. More... | |
Macros | |
#define | GLOBAL_USERAGENT "asterisk-libcurl-agent/1.0" |
#define | MAX_HEADER_LENGTH 1023 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | bucket_file_always_revalidate (struct ast_bucket_file *bucket_file) |
static int | bucket_file_expired (struct ast_bucket_file *bucket_file) |
static int | bucket_file_run_curl (struct ast_bucket_file *bucket_file) |
static void | bucket_file_set_expiration (struct ast_bucket_file *bucket_file) |
static int | bucket_http_wizard_create (const struct ast_sorcery *sorcery, void *data, void *object) |
static int | bucket_http_wizard_delete (const struct ast_sorcery *sorcery, void *data, void *object) |
static int | bucket_http_wizard_is_stale (const struct ast_sorcery *sorcery, void *data, void *object) |
static void * | bucket_http_wizard_retrieve_id (const struct ast_sorcery *sorcery, void *data, const char *type, const char *id) |
static size_t | curl_body_callback (void *ptr, size_t size, size_t nitems, void *data) |
static size_t | curl_header_callback (char *buffer, size_t size, size_t nitems, void *data) |
static long | execute_curl_instance (CURL *curl) |
Execute the CURL. More... | |
static CURL * | get_curl_instance (struct curl_bucket_file_data *cb_data) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "HTTP Media Cache Backend" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_curl", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_sorcery_wizard | http_bucket_file_wizard |
static struct ast_sorcery_wizard | http_bucket_wizard |
static struct ast_sorcery_wizard | https_bucket_file_wizard |
static struct ast_sorcery_wizard | https_bucket_wizard |
HTTP backend for the core media cache
Definition in file res_http_media_cache.c.
#define GLOBAL_USERAGENT "asterisk-libcurl-agent/1.0" |
Definition at line 43 of file res_http_media_cache.c.
Referenced by get_curl_instance().
#define MAX_HEADER_LENGTH 1023 |
Definition at line 45 of file res_http_media_cache.c.
Referenced by curl_header_callback().
|
static |
Definition at line 447 of file res_http_media_cache.c.
|
static |
Definition at line 447 of file res_http_media_cache.c.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 447 of file res_http_media_cache.c.
|
static |
Definition at line 161 of file res_http_media_cache.c.
References ao2_cleanup, ast_bucket_file_metadata_get(), and RAII_VAR.
Referenced by bucket_http_wizard_is_stale().
|
static |
Definition at line 182 of file res_http_media_cache.c.
References ao2_cleanup, ast_bucket_file_metadata_get(), ast_tvcmp(), ast_tvnow(), and RAII_VAR.
Referenced by bucket_http_wizard_is_stale().
|
static |
Definition at line 251 of file res_http_media_cache.c.
References ast_log, ast_sorcery_object_get_id(), curl_bucket_file_data::bucket_file, bucket_file_set_expiration(), curl_body_callback(), errno, execute_curl_instance(), get_curl_instance(), LOG_WARNING, curl_bucket_file_data::out_file, and ast_bucket_file::path.
Referenced by bucket_http_wizard_create(), and bucket_http_wizard_retrieve_id().
|
static |
Definition at line 116 of file res_http_media_cache.c.
References ao2_ref, ast_bucket_file_metadata_get(), ast_bucket_file_metadata_set(), ast_tvnow(), and ast_bucket_metadata::value.
Referenced by bucket_file_run_curl(), and bucket_http_wizard_is_stale().
|
static |
Definition at line 333 of file res_http_media_cache.c.
References curl_bucket_file_data::bucket_file, and bucket_file_run_curl().
|
static |
Definition at line 378 of file res_http_media_cache.c.
References curl_bucket_file_data::bucket_file, and ast_bucket_file::path.
|
static |
Definition at line 290 of file res_http_media_cache.c.
References ao2_ref, ast_bucket_file_metadata_get(), curl_bucket_file_data::bucket_file, bucket_file_always_revalidate(), bucket_file_expired(), bucket_file_set_expiration(), execute_curl_instance(), get_curl_instance(), NULL, and ast_bucket_metadata::value.
|
static |
Definition at line 341 of file res_http_media_cache.c.
References ao2_ref, ast_bucket_file_alloc(), ast_bucket_file_temporary_create(), ast_log, ast_sorcery_delete(), ast_strlen_zero, curl_bucket_file_data::bucket_file, bucket_file_run_curl(), LOG_WARNING, and NULL.
|
static |
Definition at line 103 of file res_http_media_cache.c.
References curl_bucket_file_data::out_file.
Referenced by bucket_file_run_curl().
|
static |
Definition at line 58 of file res_http_media_cache.c.
References ast_alloca, ast_bucket_file_metadata_set(), ast_log, ast_skip_blanks(), ast_str_to_lower(), ast_trim_blanks(), curl_bucket_file_data::bucket_file, LOG_WARNING, MAX_HEADER_LENGTH, and value.
Referenced by get_curl_instance().
|
static |
Execute the CURL.
Definition at line 228 of file res_http_media_cache.c.
References ast_log, and LOG_WARNING.
Referenced by bucket_file_run_curl(), and bucket_http_wizard_is_stale().
|
static |
Definition at line 204 of file res_http_media_cache.c.
References ast_sorcery_object_get_id(), curl_bucket_file_data::bucket_file, curl_header_callback(), GLOBAL_USERAGENT, and NULL.
Referenced by bucket_file_run_curl(), and bucket_http_wizard_is_stale().
|
static |
Definition at line 425 of file res_http_media_cache.c.
References ast_bucket_scheme_register, ast_log, AST_MODFLAG_DEFAULT, AST_MODULE_INFO(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_MODULE_SUPPORT_CORE, ASTERISK_GPL_KEY, ast_sorcery_wizard::load, LOG_ERROR, NULL, and unload_module().
|
static |
Definition at line 420 of file res_http_media_cache.c.
Referenced by load_module().
|
static |
Definition at line 447 of file res_http_media_cache.c.
|
static |
Definition at line 447 of file res_http_media_cache.c.
|
static |
Definition at line 396 of file res_http_media_cache.c.
|
static |
Definition at line 388 of file res_http_media_cache.c.
|
static |
Definition at line 412 of file res_http_media_cache.c.
|
static |
Definition at line 404 of file res_http_media_cache.c.