Wed Apr 6 11:29:49 2011

Asterisk developer's documentation


app_db.c File Reference

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, const char *data)
static int deltree_exec (struct ast_channel *chan, const char *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_LOAD_ORDER , .description = "Database Access Functions" , .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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
static struct ast_module_infoast_module_info = &__mod_info
static const char d_app [] = "DBdel"
static const char dt_app [] = "DBdeltree"


Detailed Description

Database access functions.

Author:
Mark Spencer <markster@digium.com>

Jefferson Noxon <jeff@debian.org>

Definition in file app_db.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 165 of file app_db.c.

static void __unreg_module ( void   )  [static]

Definition at line 165 of file app_db.c.

static int del_exec ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 116 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().

00117 {
00118    char *argv, *family, *key;
00119    static int deprecation_warning = 0;
00120 
00121    if (!deprecation_warning) {
00122       deprecation_warning = 1;
00123       ast_log(LOG_WARNING, "The DBdel application has been deprecated in favor of the DB_DELETE dialplan function!\n");
00124    }
00125 
00126    argv = ast_strdupa(data);
00127 
00128    if (strchr(argv, '/')) {
00129       family = strsep(&argv, "/");
00130       key = strsep(&argv, "\0");
00131       if (!family || !key) {
00132          ast_debug(1, "Ignoring; Syntax error in argument\n");
00133          return 0;
00134       }
00135       ast_verb(3, "DBdel: family=%s, key=%s\n", family, key);
00136       if (ast_db_del(family, key))
00137          ast_verb(3, "DBdel: Error deleting key from database.\n");
00138    } else {
00139       ast_debug(1, "Ignoring, no parameters\n");
00140    }
00141 
00142    return 0;
00143 }

static int deltree_exec ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 85 of file app_db.c.

References ast_db_deltree(), ast_debug, ast_strdupa, ast_strlen_zero(), ast_verb, and strsep().

Referenced by load_module().

00086 {
00087    char *argv, *family, *keytree;
00088 
00089    argv = ast_strdupa(data);
00090 
00091    if (strchr(argv, '/')) {
00092       family = strsep(&argv, "/");
00093       keytree = strsep(&argv, "\0");
00094       if (!family || !keytree) {
00095          ast_debug(1, "Ignoring; Syntax error in argument\n");
00096          return 0;
00097       }
00098       if (ast_strlen_zero(keytree))
00099          keytree = 0;
00100    } else {
00101       family = argv;
00102       keytree = 0;
00103    }
00104 
00105    if (keytree)
00106       ast_verb(3, "DBdeltree: family=%s, keytree=%s\n", family, keytree);
00107    else
00108       ast_verb(3, "DBdeltree: family=%s\n", family);
00109 
00110    if (ast_db_deltree(family, keytree))
00111       ast_verb(3, "DBdeltree: Error deleting key from database.\n");
00112 
00113    return 0;
00114 }

static int load_module ( void   )  [static]

Definition at line 155 of file app_db.c.

References ast_register_application_xml, del_exec(), and deltree_exec().

00156 {
00157    int retval;
00158 
00159    retval = ast_register_application_xml(d_app, del_exec);
00160    retval |= ast_register_application_xml(dt_app, deltree_exec);
00161 
00162    return retval;
00163 }

static int unload_module ( void   )  [static]

Definition at line 145 of file app_db.c.

References ast_unregister_application().

00146 {
00147    int retval;
00148 
00149    retval = ast_unregister_application(dt_app);
00150    retval |= ast_unregister_application(d_app);
00151 
00152    return retval;
00153 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Database Access Functions" , .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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static]

Definition at line 165 of file app_db.c.

struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 165 of file app_db.c.

const char d_app[] = "DBdel" [static]

Definition at line 82 of file app_db.c.

const char dt_app[] = "DBdeltree" [static]

Definition at line 83 of file app_db.c.


Generated on Wed Apr 6 11:29:49 2011 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7