Asterisk - The Open Source Telephony Project GIT-master-27fb039
Loading...
Searching...
No Matches
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 = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .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 112 of file app_db.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 112 of file app_db.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 112 of file app_db.c.

◆ deltree_exec()

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

Definition at line 69 of file app_db.c.

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

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

Referenced by load_module().

◆ load_module()

static int load_module ( void  )
static

Definition at line 107 of file app_db.c.

108{
110}
static const char dt_app[]
Definition app_db.c:67
static int deltree_exec(struct ast_channel *chan, const char *data)
Definition app_db.c:69
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition module.h:640

References ast_register_application_xml, deltree_exec(), and dt_app.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 102 of file app_db.c.

103{
105}
int ast_unregister_application(const char *app)
Unregister an application.
Definition pbx_app.c:392

References ast_unregister_application(), and dt_app.

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Database Access Functions" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 112 of file app_db.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 112 of file app_db.c.

◆ dt_app

const char dt_app[] = "DBdeltree"
static

Definition at line 67 of file app_db.c.

Referenced by load_module(), and unload_module().