Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
curl plugin for portable configuration engine More...
#include "asterisk.h"
#include <curl/curl.h>
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/utils.h"
#include "asterisk/threadstorage.h"
Go to the source code of this file.
Functions | |
static void | __init_query_buf (void) |
static void | __init_result_buf (void) |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static struct ast_config * | config_curl (const char *url, const char *unused, const char *file, struct ast_config *cfg, struct ast_flags flags, const char *sugg_incl, const char *who_asked) |
static int | destroy_curl (const char *url, const char *unused, const char *keyfield, const char *lookup, const struct ast_variable *fields) |
Execute an DELETE query. More... | |
static int | load_module (void) |
static struct ast_variable * | realtime_curl (const char *url, const char *unused, const struct ast_variable *fields) |
Execute a curl query and return ast_variable list. More... | |
static struct ast_config * | realtime_multi_curl (const char *url, const char *unused, const struct ast_variable *fields) |
Execute an Select query and return ast_config list. More... | |
static int | reload_module (void) |
static int | require_curl (const char *url, const char *unused, va_list ap) |
static int | store_curl (const char *url, const char *unused, const struct ast_variable *fields) |
Execute an INSERT query. More... | |
static int | unload_module (void) |
static int | update2_curl (const char *url, const char *unused, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields) |
static int | update_curl (const char *url, const char *unused, const char *keyfield, const char *lookup, const struct ast_variable *fields) |
Execute an UPDATE query. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Realtime Curl configuration" , .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 = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_REALTIME_DRIVER, .requires = "extconfig,res_curl,func_curl", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_config_engine | curl_engine |
static struct ast_threadstorage | query_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_query_buf , .custom_init = NULL , } |
static struct ast_threadstorage | result_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_result_buf , .custom_init = NULL , } |
curl plugin for portable configuration engine
Depends on the CURL library - http://curl.haxx.se/
Definition in file res_config_curl.c.
|
static |
Definition at line 49 of file res_config_curl.c.
|
static |
Definition at line 50 of file res_config_curl.c.
|
static |
Definition at line 659 of file res_config_curl.c.
|
static |
Definition at line 659 of file res_config_curl.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 659 of file res_config_curl.c.
|
static |
Definition at line 515 of file res_config_curl.c.
References ast_category_append(), ast_category_new_dynamic, ast_config_get_current_category(), ast_config_internal_load(), ast_custom_function_find(), ast_log, ast_str_buffer(), ast_str_set(), ast_str_substitute_variables(), ast_str_thread_get(), ast_strlen_zero(), ast_uri_decode(), ast_uri_encode(), ast_uri_http, ast_variable_append(), ast_variable_new, buf1, make_ari_stubs::file, LOG_ERROR, NULL, query_buf, result_buf, S_OR, strsep(), and url.
|
static |
Execute an DELETE query.
url | |
unused | |
keyfield | where clause field |
lookup | value of field for where clause |
fields | list containing one or more field/value set(s) |
Delete a row from a database table, prepare the sql statement using keyfield and lookup control the number of records to change. Additional params to match rows are stored in ap list. Sub-in the values to the prepared statement and execute it.
number | of rows affected |
-1 | on failure |
Definition at line 415 of file res_config_curl.c.
References ast_custom_function_find(), ast_log, ast_str_append(), ast_str_buffer(), ast_str_set(), ast_str_substitute_variables(), ast_str_thread_get(), ast_uri_encode(), ast_uri_http, buf1, buf2, LOG_ERROR, ast_variable::name, ast_variable::next, NULL, query_buf, result_buf, url, and ast_variable::value.
|
static |
Definition at line 643 of file res_config_curl.c.
References ast_config_engine_register(), curl_engine, and reload_module().
|
static |
Execute a curl query and return ast_variable list.
url | The base URL from which to retrieve data |
unused | Not currently used |
fields | list containing one or more field/operator/value set. |
var | on success |
NULL | on failure |
Definition at line 61 of file res_config_curl.c.
References ast_custom_function_find(), ast_log, ast_str_append(), ast_str_buffer(), ast_str_set(), ast_str_substitute_variables(), ast_str_thread_get(), ast_strlen_zero(), ast_uri_decode(), ast_uri_encode(), ast_uri_http, ast_variable_new, buf1, buf2, LOG_ERROR, ast_variable::name, ast_variable::next, NULL, query_buf, result_buf, S_OR, strsep(), url, ast_variable::value, and var.
|
static |
Execute an Select query and return ast_config list.
url | |
unused | |
fields | list containing one or more field/operator/value set. |
struct | ast_config pointer on success |
NULL | on failure |
Definition at line 132 of file res_config_curl.c.
References ast_category_append(), ast_category_new_anonymous, ast_category_rename(), ast_config_new(), ast_custom_function_find(), ast_free, ast_log, ast_str_append(), ast_str_buffer(), ast_str_set(), ast_str_substitute_variables(), ast_str_thread_get(), ast_strdup, ast_strlen_zero(), ast_uri_decode(), ast_uri_encode(), ast_uri_http, ast_variable_append(), ast_variable_new, buf1, buf2, LOG_ERROR, ast_variable::name, ast_variable::next, NULL, query_buf, result_buf, S_OR, strsep(), url, ast_variable::value, and var.
|
static |
Definition at line 604 of file res_config_curl.c.
References ast_config_destroy(), ast_config_load, ast_log, ast_variable_browse(), CONFIG_FLAG_NOREALTIME, CONFIG_STATUS_FILEINVALID, ast_flags::flags, LOG_WARNING, name, NULL, pbx_builtin_setvar_helper(), and var.
Referenced by load_module().
|
static |
Definition at line 464 of file res_config_curl.c.
References ast_custom_function_find(), ast_log, ast_str_append(), ast_str_buffer(), ast_str_set(), ast_str_substitute_variables(), ast_str_thread_get(), ast_uri_encode(), ast_uri_http, LOG_ERROR, NULL, query_buf, result_buf, RQ_CHAR, RQ_DATE, RQ_DATETIME, RQ_FLOAT, RQ_INTEGER1, RQ_INTEGER2, RQ_INTEGER3, RQ_INTEGER4, RQ_INTEGER8, RQ_UINTEGER1, RQ_UINTEGER2, RQ_UINTEGER3, RQ_UINTEGER4, RQ_UINTEGER8, type, and url.
|
static |
Execute an INSERT query.
url | |
unused | |
fields | list containing one or more field/value set(s) |
Insert a new record into database table, prepare the sql statement. All values to be changed are stored in ap list. Sub-in the values to the prepared statement and execute it.
number | of rows affected |
-1 | on failure |
Definition at line 354 of file res_config_curl.c.
References ast_custom_function_find(), ast_log, ast_str_append(), ast_str_buffer(), ast_str_set(), ast_str_substitute_variables(), ast_str_thread_get(), ast_uri_encode(), ast_uri_http, buf1, buf2, LOG_ERROR, ast_variable::name, ast_variable::next, NULL, query_buf, result_buf, url, and ast_variable::value.
|
static |
Definition at line 636 of file res_config_curl.c.
References ast_config_engine_deregister(), and curl_engine.
|
static |
Definition at line 281 of file res_config_curl.c.
References ast_custom_function_find(), ast_log, ast_str_append(), ast_str_buffer(), ast_str_set(), ast_str_substitute_variables(), ast_str_thread_get(), ast_uri_encode(), ast_uri_http, buf1, buf2, LOG_ERROR, ast_variable::name, ast_variable::next, NULL, query_buf, result_buf, url, and ast_variable::value.
|
static |
Execute an UPDATE query.
url | |
unused | |
keyfield | where clause field |
lookup | value of field for where clause |
fields | list containing one or more field/value set(s). |
Update a database table, prepare the sql statement using keyfield and lookup control the number of records to change. All values to be changed are stored in ap list. Sub-in the values to the prepared statement and execute it.
number | of rows affected |
-1 | on failure |
Definition at line 232 of file res_config_curl.c.
References ast_custom_function_find(), ast_log, ast_str_append(), ast_str_buffer(), ast_str_set(), ast_str_substitute_variables(), ast_str_thread_get(), ast_uri_encode(), ast_uri_http, buf1, buf2, LOG_ERROR, ast_variable::name, ast_variable::next, NULL, query_buf, result_buf, url, and ast_variable::value.
|
static |
Definition at line 659 of file res_config_curl.c.
|
static |
Definition at line 659 of file res_config_curl.c.
|
static |
Definition at line 592 of file res_config_curl.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 49 of file res_config_curl.c.
Referenced by config_curl(), destroy_curl(), realtime_curl(), realtime_multi_curl(), require_curl(), store_curl(), update2_curl(), and update_curl().
|
static |
Definition at line 50 of file res_config_curl.c.
Referenced by config_curl(), destroy_curl(), realtime_curl(), realtime_multi_curl(), require_curl(), store_curl(), update2_curl(), and update_curl().