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) |
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, va_list ap) |
Execute an DELETE query. More... | |
static int | load_module (void) |
static struct ast_variable * | realtime_curl (const char *url, const char *unused, va_list ap) |
Execute a curl query and return ast_variable list. More... | |
static struct ast_config * | realtime_multi_curl (const char *url, const char *unused, va_list ap) |
Excute 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, va_list ap) |
Execute an INSERT query. More... | |
static int | unload_module (void) |
static int | update2_curl (const char *url, const char *unused, va_list ap) |
static int | update_curl (const char *url, const char *unused, const char *keyfield, const char *lookup, va_list ap) |
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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_REALTIME_DRIVER, } |
static 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
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 675 of file res_config_curl.c.
|
static |
Definition at line 675 of file res_config_curl.c.
|
static |
Definition at line 520 of file res_config_curl.c.
References ast_category_append(), ast_category_new(), 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_variable_append(), ast_variable_new(), buf1, LOG_ERROR, query_buf, result_buf, S_OR, and strsep().
|
static |
Execute an DELETE query.
url | |
unused | |
keyfield | where clause field |
lookup | value of field for where clause |
ap | 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 418 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(), buf1, buf2, LOG_ERROR, query_buf, and result_buf.
|
static |
Definition at line 647 of file res_config_curl.c.
References ast_config_engine_register(), ast_load_resource(), ast_log(), ast_module_check(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_verb, LOG_ERROR, 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 |
ap | 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_variable_new(), buf1, buf2, LOG_ERROR, query_buf, result_buf, S_OR, strsep(), and var.
|
static |
Excute an Select query and return ast_config list.
url | |
unused | |
ap | list containing one or more field/operator/value set. |
struct | ast_config pointer on success |
NULL | on failure |
Definition at line 133 of file res_config_curl.c.
References ast_category_append(), ast_category_new(), ast_category_rename(), ast_config_new(), ast_custom_function_find(), ast_log(), ast_str_append(), ast_str_buffer(), ast_str_set(), ast_str_substitute_variables(), ast_str_thread_get(), ast_strdupa, ast_strlen_zero(), ast_uri_decode(), ast_uri_encode(), ast_variable_append(), ast_variable_new(), buf1, buf2, LOG_ERROR, query_buf, result_buf, S_OR, strsep(), and var.
|
static |
Definition at line 608 of file res_config_curl.c.
References ast_config_destroy(), ast_config_load, ast_log(), ast_variable_browse(), CONFIG_FLAG_NOREALTIME, CONFIG_STATUS_FILEINVALID, LOG_WARNING, name, ast_variable::name, ast_variable::next, pbx_builtin_setvar_helper(), ast_variable::value, and var.
Referenced by load_module().
|
static |
Definition at line 468 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(), LOG_ERROR, 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, and type.
|
static |
Execute an INSERT query.
url | |
unused | |
ap | 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 356 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(), buf1, buf2, LOG_ERROR, query_buf, and result_buf.
|
static |
Definition at line 640 of file res_config_curl.c.
References ast_config_engine_deregister(), and ast_verb.
|
static |
Definition at line 280 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(), buf1, buf2, first, LOG_ERROR, query_buf, result_buf, and SENTINEL.
|
static |
Execute an UPDATE query.
url | |
unused | |
keyfield | where clause field |
lookup | value of field for where clause |
ap | 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 230 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(), buf1, buf2, LOG_ERROR, query_buf, and result_buf.
|
static |
Definition at line 675 of file res_config_curl.c.
|
static |
Definition at line 675 of file res_config_curl.c.
|
static |
Definition at line 596 of file res_config_curl.c.
|
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().