Asterisk - The Open Source Telephony Project
18.5.0
|
Persistant data storage (akin to *doze registry) More...
Go to the source code of this file.
Data Structures | |
struct | ast_db_entry |
Functions | |
int | ast_db_del (const char *family, const char *key) |
Delete entry in astdb. More... | |
int | ast_db_deltree (const char *family, const char *keytree) |
Delete one or more entries in astdb. More... | |
void | ast_db_freetree (struct ast_db_entry *entry) |
Free structure created by ast_db_gettree() More... | |
int | ast_db_get (const char *family, const char *key, char *value, int valuelen) |
Get key value specified by family/key. More... | |
int | ast_db_get_allocated (const char *family, const char *key, char **out) |
Get key value specified by family/key as a heap allocated string. More... | |
struct ast_db_entry * | ast_db_gettree (const char *family, const char *keytree) |
Get a list of values within the astdb tree. More... | |
struct ast_db_entry * | ast_db_gettree_by_prefix (const char *family, const char *key_prefix) |
Get a list of values with the given key prefix. More... | |
int | ast_db_put (const char *family, const char *key, const char *value) |
Store value addressed by family/key. More... | |
Persistant data storage (akin to *doze registry)
Definition in file astdb.h.
int ast_db_del | ( | const char * | family, |
const char * | key | ||
) |
Delete entry in astdb.
Definition at line 429 of file main/db.c.
References ast_debug, ast_log, ast_mutex_lock, ast_mutex_unlock, astdb, db_sync(), dblock, LOG_WARNING, and MAX_DB_FIELD.
Referenced by __expire_registry(), ast_privacy_set(), AST_TEST_DEFINE(), auth_exec(), cache_lookup_internal(), dahdi_cc_callback(), destroy_all_channels(), destroy_association(), dialgroup_refreshdb(), do_register_expire(), dump_queue_members(), function_db_delete(), handle_cli_database_del(), handle_dbdel(), manager_dbdel(), media_cache_item_del_from_astdb(), media_cache_remove_from_astdb(), mkintf(), presence_change_common(), process_clearcache(), reload_queue_members(), remove_public_key_from_astdb(), sorcery_astdb_delete(), stasis_app_device_state_delete(), and update_registry().
int ast_db_deltree | ( | const char * | family, |
const char * | keytree | ||
) |
Delete one or more entries in astdb.
If both parameters are NULL, the entire database will be purged. If only keytree is NULL, all entries within the family will be purged. It is an error for keytree to have a value when family is NULL.
-1 | An error occurred |
>= | 0 Number of records deleted |
Definition at line 457 of file main/db.c.
References ast_log, ast_mutex_lock, ast_mutex_unlock, ast_strlen_zero, astdb, db_sync(), dblock, LOG_WARNING, MAX_DB_FIELD, and prefix.
Referenced by ast_privacy_reset(), AST_TEST_DEFINE(), deinitialize_sorcery(), deltree_exec(), dundi_flush(), handle_cli_database_deltree(), handle_dbdeltree(), iax_provision_reload(), manager_dbdeltree(), media_cache_item_del_from_astdb(), media_cache_remove_from_astdb(), and remove_public_key_from_astdb().
void ast_db_freetree | ( | struct ast_db_entry * | entry | ) |
Free structure created by ast_db_gettree()
Definition at line 598 of file main/db.c.
References ast_free, last, and ast_db_entry::next.
Referenced by AST_TEST_DEFINE(), dundi_show_cache(), dundi_show_hints(), function_db_keys(), handle_cli_devstate_list(), handle_cli_presencestate_list(), load_module(), media_cache_item_populate_from_astdb(), media_cache_populate_from_astdb(), populate_cache(), process_clearcache(), reload_queue_members(), sorcery_astdb_retrieve_fields_common(), sorcery_astdb_retrieve_prefix(), sorcery_astdb_retrieve_regex(), and stasis_app_device_states_to_json().
int ast_db_get | ( | const char * | family, |
const char * | key, | ||
char * | value, | ||
int | valuelen | ||
) |
Get key value specified by family/key.
Definition at line 412 of file main/db.c.
References ast_assert, db_get_common(), and NULL.
Referenced by ast_pbx_uuid_get(), ast_privacy_check(), AST_TEST_DEFINE(), auth_exec(), blacklist_read(), cache_lookup_internal(), check_access(), create_addr(), custom_devstate_callback(), custom_presence_callback(), database_increment(), destroy_all_channels(), function_db_delete(), function_db_exists(), function_db_read(), get_path_to_public_key(), handle_cli_database_get(), handle_dbget(), iax_provision_version(), load_password(), manager_dbget(), mkintf(), populate_addr(), public_key_is_expired(), refresh_all_favorite(), reg_source_db(), remove_public_key_from_astdb(), sorcery_astdb_delete(), sorcery_astdb_update(), and stasis_device_state_cb().
int ast_db_get_allocated | ( | const char * | family, |
const char * | key, | ||
char ** | out | ||
) |
Get key value specified by family/key as a heap allocated string.
Given a family and key, sets out to a pointer to a heap allocated string. In the event of an error, out will be set to NULL. The string must be freed by calling ast_free().
-1 | An error occurred |
0 | Success |
Definition at line 422 of file main/db.c.
References db_get_common(), and NULL.
Referenced by AST_TEST_DEFINE(), media_cache_item_del_from_astdb(), reload_queue_members(), and sorcery_astdb_retrieve_id().
struct ast_db_entry* ast_db_gettree | ( | const char * | family, |
const char * | keytree | ||
) |
Get a list of values within the astdb tree.
If family is specified, only those keys will be returned. If keytree is specified, subkeys are expected to exist (separated from the key with a slash). If subkeys do not exist and keytree is specified, the tree will consist of either a single entry or NULL will be returned.
Resulting tree should be freed by passing the return value to ast_db_freetree() when usage is concluded.
Definition at line 531 of file main/db.c.
References ast_log, ast_mutex_lock, ast_mutex_unlock, ast_strlen_zero, astdb, db_gettree_common(), dblock, LOG_WARNING, MAX_DB_FIELD, NULL, and prefix.
Referenced by AST_TEST_DEFINE(), dundi_show_cache(), dundi_show_hints(), function_db_keys(), handle_cli_devstate_list(), handle_cli_presencestate_list(), load_module(), media_cache_item_populate_from_astdb(), media_cache_populate_from_astdb(), populate_cache(), process_clearcache(), reload_queue_members(), sorcery_astdb_retrieve_fields_common(), sorcery_astdb_retrieve_regex(), and stasis_app_device_states_to_json().
struct ast_db_entry* ast_db_gettree_by_prefix | ( | const char * | family, |
const char * | key_prefix | ||
) |
Get a list of values with the given key prefix.
family | The family to search under |
key_prefix | The key prefix to search under |
NULL | An error occurred |
Definition at line 571 of file main/db.c.
References ast_log, ast_mutex_lock, ast_mutex_unlock, astdb, db_gettree_common(), dblock, LOG_WARNING, MAX_DB_FIELD, NULL, and prefix.
Referenced by sorcery_astdb_retrieve_prefix().
int ast_db_put | ( | const char * | family, |
const char * | key, | ||
const char * | value | ||
) |
Store value addressed by family/key.
Definition at line 327 of file main/db.c.
References ast_log, ast_mutex_lock, ast_mutex_unlock, astdb, db_sync(), dblock, LOG_WARNING, and MAX_DB_FIELD.
Referenced by __analog_ss_thread(), add_public_key_to_astdb(), ast_privacy_set(), AST_TEST_DEFINE(), asterisk_daemon(), cache_save(), cache_save_hint(), dahdi_cc_callback(), database_increment(), devstate_write(), dialgroup_refreshdb(), dump_queue_members(), function_db_write(), handle_cli_database_put(), handle_cli_devstate_change(), handle_cli_presencestate_change(), handle_command_response(), handle_dbput(), iax_provision_build(), manager_dbput(), media_cache_item_sync_to_astdb(), metadata_sync_to_astdb(), mgcp_ss(), parse_register_contact(), presence_write(), save_secret(), set_public_key_expiration(), sorcery_astdb_create(), stasis_app_device_state_update(), test_stir_shaken_add_fake_astdb_entry(), and update_registry().