Thu Jul 9 13:40:44 2009

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, 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 = "068e67f60f50dd9ee86464c05884a49d" , .load = load_module, .unload = unload_module, }
static const struct ast_module_infoast_module_info = &__mod_info
static char * d_app = "DBdel"
static char * d_descrip
static char * d_synopsis = "Delete a key from the database"
static char * dt_app = "DBdeltree"
static char * dt_descrip
static char * dt_synopsis = "Delete a family or keytree from the database"


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 139 of file app_db.c.

static void __unreg_module ( void   )  [static]

Definition at line 139 of file app_db.c.

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

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

00091 {
00092    char *argv, *family, *key;
00093    static int deprecation_warning = 0;
00094 
00095    if (!deprecation_warning) {
00096       deprecation_warning = 1;
00097       ast_log(LOG_WARNING, "The DBdel application has been deprecated in favor of the DB_DELETE dialplan function!\n");
00098    }
00099 
00100    argv = ast_strdupa(data);
00101 
00102    if (strchr(argv, '/')) {
00103       family = strsep(&argv, "/");
00104       key = strsep(&argv, "\0");
00105       if (!family || !key) {
00106          ast_debug(1, "Ignoring; Syntax error in argument\n");
00107          return 0;
00108       }
00109       ast_verb(3, "DBdel: family=%s, key=%s\n", family, key);
00110       if (ast_db_del(family, key))
00111          ast_verb(3, "DBdel: Error deleting key from database.\n");
00112    } else {
00113       ast_debug(1, "Ignoring, no parameters\n");
00114    }
00115 
00116    return 0;
00117 }

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

Definition at line 59 of file app_db.c.

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

Referenced by load_module().

00060 {
00061    char *argv, *family, *keytree;
00062 
00063    argv = ast_strdupa(data);
00064 
00065    if (strchr(argv, '/')) {
00066       family = strsep(&argv, "/");
00067       keytree = strsep(&argv, "\0");
00068       if (!family || !keytree) {
00069          ast_debug(1, "Ignoring; Syntax error in argument\n");
00070          return 0;
00071       }
00072       if (ast_strlen_zero(keytree))
00073          keytree = 0;
00074    } else {
00075       family = argv;
00076       keytree = 0;
00077    }
00078 
00079    if (keytree)
00080       ast_verb(3, "DBdeltree: family=%s, keytree=%s\n", family, keytree);
00081    else
00082       ast_verb(3, "DBdeltree: family=%s\n", family);
00083 
00084    if (ast_db_deltree(family, keytree))
00085       ast_verb(3, "DBdeltree: Error deleting key from database.\n");
00086 
00087    return 0;
00088 }

static int load_module ( void   )  [static]

Definition at line 129 of file app_db.c.

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

00130 {
00131    int retval;
00132 
00133    retval = ast_register_application(d_app, del_exec, d_synopsis, d_descrip);
00134    retval |= ast_register_application(dt_app, deltree_exec, dt_synopsis, dt_descrip);
00135 
00136    return retval;
00137 }

static int unload_module ( void   )  [static]

Definition at line 119 of file app_db.c.

References ast_unregister_application().

00120 {
00121    int retval;
00122 
00123    retval = ast_unregister_application(dt_app);
00124    retval |= ast_unregister_application(d_app);
00125 
00126    return retval;
00127 }


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 = "068e67f60f50dd9ee86464c05884a49d" , .load = load_module, .unload = unload_module, } [static]

Definition at line 139 of file app_db.c.

const struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 139 of file app_db.c.

char* d_app = "DBdel" [static]

Definition at line 52 of file app_db.c.

char* d_descrip [static]

Initial value:

"  DBdel(family/key): This application will delete a key from the Asterisk\n"
"database.\n"
"  This application has been DEPRECATED in favor of the DB_DELETE function.\n"
Todo:
XXX Remove this application after 1.4 is relased

Definition at line 43 of file app_db.c.

char* d_synopsis = "Delete a key from the database" [static]

Definition at line 55 of file app_db.c.

char* dt_app = "DBdeltree" [static]

Definition at line 53 of file app_db.c.

char* dt_descrip [static]

Initial value:

"  DBdeltree(family[/keytree]): This application will delete a family or keytree\n"
"from the Asterisk database\n"

Definition at line 48 of file app_db.c.

char* dt_synopsis = "Delete a family or keytree from the database" [static]

Definition at line 56 of file app_db.c.


Generated on Thu Jul 9 13:40:44 2009 for Asterisk - the Open Source PBX by  doxygen 1.4.7