Fri Nov 12 11:48:50 2010

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"
Include dependency graph for app_db.c:

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 __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .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 = "0901e4e500243c855563a2d78b0c03e4" , .load = load_module, .unload = unload_module, }
static struct ast_module_infoast_module_info = &__mod_info
static char * d_app = "DBdel"
static 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 166 of file app_db.c.

static void __unreg_module ( void   )  [static]

Definition at line 166 of 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_verb, and LOG_WARNING.

Referenced by load_module().

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

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_strlen_zero(), and ast_verb.

Referenced by load_module().

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

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().

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

static int unload_module ( void   )  [static]

Definition at line 146 of file app_db.c.

References ast_unregister_application().

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


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .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 = "0901e4e500243c855563a2d78b0c03e4" , .load = load_module, .unload = unload_module, } [static]

Definition at line 166 of file app_db.c.

Definition at line 166 of file app_db.c.

char* d_app = "DBdel" [static]
Todo:
XXX Remove this application after 1.4 is relased

Definition at line 83 of file app_db.c.

char* dt_app = "DBdeltree" [static]

Definition at line 84 of file app_db.c.


Generated by  doxygen 1.6.2