230 size_t parselen = strlen(parse);
233 const char *
last =
"";
236 while (parse[0] ==
'/') {
240 while (parse[parselen - 1] ==
'/') {
241 parse[--parselen] =
'\0';
251 for (; dbe; dbe = dbe->
next) {
253 char *curkey = &dbe->
key[parselen + 1], *slash;
254 if (*curkey ==
'/') {
258 if ((slash = strchr(curkey,
'/'))) {
263 if (!strcasecmp(last, curkey)) {
268 if (orig_dbe != dbe) {
306 ast_debug(1,
"DB_DELETE: %s/%s not found in database.\n",
args.family,
args.key);
309 ast_debug(1,
"DB_DELETE: %s/%s could not be deleted from the database\n",
args.family,
args.key);
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Asterisk main include file. File version handling, generic pbx functions.
void ast_db_freetree(struct ast_db_entry *entry)
Free structure created by ast_db_gettree()
char * ast_str_append_escapecommas(struct ast_str **buf, ssize_t maxlen, const char *src, size_t maxsrc)
Append a non-NULL terminated substring to the end of a dynamic string, with escaping of commas...
static struct ast_custom_function db_delete_function
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
#define ast_strlen_zero(foo)
#define ast_custom_function_register_escalating(acf, escalation)
Register a custom function which requires escalated privileges.
#define ast_debug(level,...)
Log a DEBUG message.
static int function_db_exists(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
static int function_db_write(struct ast_channel *chan, const char *cmd, char *parse, const char *value)
struct ast_db_entry * next
General Asterisk PBX channel definitions.
struct sla_ringing_trunk * last
Data structure associated with a custom dialplan function.
static int function_db_delete(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
static int function_db_delete_write(struct ast_channel *chan, const char *cmd, char *parse, const char *value)
Wrapper to execute DB_DELETE from a write operation. Allows execution even if live_dangerously is dis...
Core PBX routines and definitions.
static int unload_module(void)
static struct ast_custom_function db_keys_function
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
struct ast_db_entry * ast_db_gettree(const char *family, const char *keytree)
Get a list of values within the astdb tree.
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static int function_db_keys(struct ast_channel *chan, const char *cmd, char *parse, struct ast_str **result, ssize_t maxlen)
static void parse(struct mgcp_request *req)
static int load_module(void)
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
static struct ast_custom_function db_exists_function
static struct ast_threadstorage escape_buf
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
#define ASTERISK_GPL_KEY
The text the key() function should return.
static int function_db_read(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
Asterisk module definitions.
Persistant data storage (akin to *doze registry)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define ast_custom_function_register(acf)
Register a custom function.
static struct ast_custom_function db_function
#define AST_APP_ARG(name)
Define an application argument.