Database access functions. More...
#include "asterisk.h"#include "asterisk/file.h"#include "asterisk/channel.h"#include "asterisk/pbx.h"#include "asterisk/module.h"#include "asterisk/astdb.h"#include "asterisk/lock.h"
Go to the source code of this file.
Functions | |
| static void | __reg_module (void) |
| static void | __unreg_module (void) |
| static int | del_exec (struct ast_channel *chan, void *data) |
| static int | deltree_exec (struct ast_channel *chan, void *data) |
| static int | load_module (void) |
| static int | unload_module (void) |
Variables | |
| static struct ast_module_info __MODULE_INFO_SECTION | __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Database Access Functions" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } |
| static struct ast_module_info * | ast_module_info = &__mod_info |
| static char * | d_app = "DBdel" |
| static char * | dt_app = "DBdeltree" |
Database access functions.
Definition in file app_db.c.
| static int del_exec | ( | struct ast_channel * | chan, |
| void * | data | ||
| ) | [static] |
Definition at line 117 of file app_db.c.
References ast_db_del(), ast_debug, ast_log(), ast_strdupa, ast_verb, LOG_WARNING, and strsep().
Referenced by load_module().
{
char *argv, *family, *key;
static int deprecation_warning = 0;
if (!deprecation_warning) {
deprecation_warning = 1;
ast_log(LOG_WARNING, "The DBdel application has been deprecated in favor of the DB_DELETE dialplan function!\n");
}
argv = ast_strdupa(data);
if (strchr(argv, '/')) {
family = strsep(&argv, "/");
key = strsep(&argv, "\0");
if (!family || !key) {
ast_debug(1, "Ignoring; Syntax error in argument\n");
return 0;
}
ast_verb(3, "DBdel: family=%s, key=%s\n", family, key);
if (ast_db_del(family, key))
ast_verb(3, "DBdel: Error deleting key from database.\n");
} else {
ast_debug(1, "Ignoring, no parameters\n");
}
return 0;
}
| static int deltree_exec | ( | struct ast_channel * | chan, |
| void * | data | ||
| ) | [static] |
Definition at line 86 of file app_db.c.
References ast_db_deltree(), ast_debug, ast_strdupa, ast_strlen_zero(), ast_verb, and strsep().
Referenced by load_module().
{
char *argv, *family, *keytree;
argv = ast_strdupa(data);
if (strchr(argv, '/')) {
family = strsep(&argv, "/");
keytree = strsep(&argv, "\0");
if (!family || !keytree) {
ast_debug(1, "Ignoring; Syntax error in argument\n");
return 0;
}
if (ast_strlen_zero(keytree))
keytree = 0;
} else {
family = argv;
keytree = 0;
}
if (keytree)
ast_verb(3, "DBdeltree: family=%s, keytree=%s\n", family, keytree);
else
ast_verb(3, "DBdeltree: family=%s\n", family);
if (ast_db_deltree(family, keytree))
ast_verb(3, "DBdeltree: Error deleting key from database.\n");
return 0;
}
| static int load_module | ( | void | ) | [static] |
Definition at line 156 of file app_db.c.
References ast_register_application_xml, del_exec(), and deltree_exec().
{
int retval;
retval = ast_register_application_xml(d_app, del_exec);
retval |= ast_register_application_xml(dt_app, deltree_exec);
return retval;
}
| static int unload_module | ( | void | ) | [static] |
Definition at line 146 of file app_db.c.
References ast_unregister_application().
{
int retval;
retval = ast_unregister_application(dt_app);
retval |= ast_unregister_application(d_app);
return retval;
}
struct ast_module_info __MODULE_INFO_SECTION __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Database Access Functions" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } [static] |
struct ast_module_info* ast_module_info = &__mod_info [static] |
char* d_app = "DBdel" [static] |