Asterisk - The Open Source Telephony Project  18.5.0
Functions | Variables
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)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static const char dt_app [] = "DBdeltree"
 

Detailed Description

Database access functions.

Author
Mark Spencer marks.nosp@m.ter@.nosp@m.digiu.nosp@m.m.co.nosp@m.m
Jefferson Noxon jeff@.nosp@m.debi.nosp@m.an.or.nosp@m.g

Definition in file app_db.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 109 of file app_db.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 109 of file app_db.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module* AST_MODULE_SELF_SYM ( void  )

Definition at line 109 of file app_db.c.

◆ deltree_exec()

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

Definition at line 66 of file app_db.c.

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

Referenced by load_module().

67 {
68  char *argv, *family, *keytree;
69 
70  argv = ast_strdupa(data);
71 
72  if (strchr(argv, '/')) {
73  family = strsep(&argv, "/");
74  keytree = strsep(&argv, "\0");
75  if (!family || !keytree) {
76  ast_debug(1, "Ignoring; Syntax error in argument\n");
77  return 0;
78  }
79  if (ast_strlen_zero(keytree))
80  keytree = 0;
81  } else {
82  family = argv;
83  keytree = 0;
84  }
85 
86  if (keytree) {
87  ast_verb(3, "DBdeltree: family=%s, keytree=%s\n", family, keytree);
88  } else {
89  ast_verb(3, "DBdeltree: family=%s\n", family);
90  }
91 
92  if (ast_db_deltree(family, keytree) < 0) {
93  ast_verb(3, "DBdeltree: Error deleting key from database.\n");
94  }
95 
96  return 0;
97 }
#define ast_verb(level,...)
Definition: logger.h:463
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
char * strsep(char **str, const char *delims)
int ast_db_deltree(const char *family, const char *keytree)
Delete one or more entries in astdb.
Definition: main/db.c:457

◆ load_module()

static int load_module ( void  )
static

Definition at line 104 of file app_db.c.

References ast_register_application_xml, deltree_exec(), and dt_app.

105 {
107 }
static const char dt_app[]
Definition: app_db.c:64
static int deltree_exec(struct ast_channel *chan, const char *data)
Definition: app_db.c:66
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:626

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 99 of file app_db.c.

References ast_unregister_application(), and dt_app.

100 {
102 }
static const char dt_app[]
Definition: app_db.c:64
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392

Variable Documentation

◆ __mod_info

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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 109 of file app_db.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 109 of file app_db.c.

◆ dt_app

const char dt_app[] = "DBdeltree"
static

Definition at line 64 of file app_db.c.

Referenced by load_module(), and unload_module().