146 char *parse,
char *
buf,
size_t len)
216 char *parse,
char *
buf,
size_t len)
255 size_t parselen = strlen(parse);
258 const char *
last =
"";
261 while (parse[0] ==
'/') {
265 while (parse[parselen - 1] ==
'/') {
266 parse[--parselen] =
'\0';
276 for (; dbe; dbe = dbe->
next) {
278 char *curkey = &dbe->
key[parselen + 1], *slash;
279 if (*curkey ==
'/') {
283 if ((slash = strchr(curkey,
'/'))) {
288 if (!strcasecmp(
last, curkey)) {
293 if (orig_dbe != dbe) {
310 size_t parselen = strlen(parse);
312 const char *
last =
"";
316 while (parse[0] ==
'/') {
320 while (parse[parselen - 1] ==
'/') {
321 parse[--parselen] =
'\0';
326 snprintf(
buf,
len,
"%d", keycount);
330 for (; dbe; dbe = dbe->
next) {
332 char *curkey = &dbe->
key[parselen + 1], *slash;
333 if (*curkey ==
'/') {
337 if ((slash = strchr(curkey,
'/'))) {
342 if (!strcasecmp(
last, curkey)) {
350 snprintf(
buf,
len,
"%d", keycount);
355 .
name =
"DB_KEYCOUNT",
360 char *parse,
char *
buf,
size_t len)
382 ast_debug(1,
"DB_DELETE: %s/%s not found in database.\n",
args.family,
args.key);
385 ast_debug(1,
"DB_DELETE: %s/%s could not be deleted from the database\n",
args.family,
args.key);
struct sla_ringing_trunk * last
Persistent data storage (akin to *doze registry)
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
struct ast_db_entry * ast_db_gettree(const char *family, const char *keytree)
Get a list of values within the astdb tree.
void ast_db_freetree(struct ast_db_entry *entry)
Free structure created by ast_db_gettree()
Asterisk main include file. File version handling, generic pbx functions.
General Asterisk PBX channel definitions.
static struct ast_custom_function db_function
static int function_db_read(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...
static int function_db_exists(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
static int function_db_keycount(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
static struct ast_custom_function db_keys_function
static struct ast_custom_function db_delete_function
static int function_db_keys(struct ast_channel *chan, const char *cmd, char *parse, struct ast_str **result, ssize_t maxlen)
static struct ast_custom_function db_exists_function
static struct ast_custom_function db_keycount_function
static int load_module(void)
static int function_db_write(struct ast_channel *chan, const char *cmd, char *parse, const char *value)
static int unload_module(void)
static int function_db_delete(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
#define ast_debug(level,...)
Log a DEBUG message.
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Core PBX routines and definitions.
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.
#define ast_custom_function_register_escalating(acf, escalation)
Register a custom function which requires escalated privileges.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
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.
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
Main Channel structure associated with a channel.
Data structure associated with a custom dialplan function.
struct ast_db_entry * next
Support for dynamic strings.