Data retrieval API. More...
#include "asterisk/frame.h"
Go to the source code of this file.
Data Structures | |
struct | ast_data_entry |
This entries are for multiple registers. More... | |
struct | ast_data_handler |
The structure of the node handler. More... | |
struct | ast_data_mapping_structure |
Map the members of a structure. More... | |
struct | ast_data_query |
A query to the data API is specified in this structure. More... | |
struct | ast_data_retrieve |
structure retrieved from a node, with the nodes content. More... | |
Typedefs | |
typedef int(* | ast_data_get_cb )(const struct ast_data_search *search, struct ast_data *root) |
The get callback definition. More... | |
Enumerations | |
enum | ast_data_type { AST_DATA_CONTAINER, AST_DATA_INTEGER, AST_DATA_UNSIGNED_INTEGER, AST_DATA_DOUBLE, AST_DATA_BOOLEAN, AST_DATA_STRING, AST_DATA_CHARACTER, AST_DATA_PASSWORD, AST_DATA_IPADDR, AST_DATA_TIMESTAMP, AST_DATA_SECONDS, AST_DATA_MILLISECONDS, AST_DATA_POINTER } |
The data type of the data node. More... | |
Functions | |
int | __ast_data_add_structure (struct ast_data *root, const struct ast_data_mapping_structure *mapping, size_t mapping_len, void *structure) |
Add a complete structure to a node. More... | |
int | __ast_data_register (const char *path, const struct ast_data_handler *handler, const char *registrar, struct ast_module *mod) |
Register a data provider. More... | |
int | __ast_data_register_multiple (const struct ast_data_entry *data_entries, size_t entries, const char *registrar, struct ast_module *mod) |
Register multiple data providers at once. More... | |
int | __ast_data_search_cmp_structure (const struct ast_data_search *search, const struct ast_data_mapping_structure *mapping, size_t mapping_len, void *structure, const char *structure_name) |
Based on a search tree, evaluate every member of a structure against it. More... | |
int | __ast_data_unregister (const char *path, const char *registrar) |
Unregister a data provider. More... | |
struct ast_data * | ast_data_add_bool (struct ast_data *root, const char *childname, unsigned int boolean) |
Add a boolean node type. More... | |
struct ast_data * | ast_data_add_char (struct ast_data *root, const char *childname, char value) |
Add a char node type. More... | |
int | ast_data_add_codecs (struct ast_data *root, const char *node_name, format_t capability) |
Add the list of codecs in the root node based on the capability parameter. More... | |
struct ast_data * | ast_data_add_dbl (struct ast_data *root, const char *childname, double dbl) |
Add a floating point node type. More... | |
struct ast_data * | ast_data_add_int (struct ast_data *root, const char *childname, int value) |
Add an integer node type. More... | |
struct ast_data * | ast_data_add_ipaddr (struct ast_data *root, const char *childname, struct in_addr addr) |
Add a ipv4 address type. More... | |
struct ast_data * | ast_data_add_milliseconds (struct ast_data *root, const char *childname, unsigned int milliseconds) |
Add a milliseconds node type. More... | |
struct ast_data * | ast_data_add_node (struct ast_data *root, const char *childname) |
Add a container child. More... | |
struct ast_data * | ast_data_add_password (struct ast_data *root, const char *childname, const char *string) |
Add a password node type. More... | |
struct ast_data * | ast_data_add_ptr (struct ast_data *root, const char *childname, void *ptr) |
Add a ptr node type. More... | |
struct ast_data * | ast_data_add_seconds (struct ast_data *root, const char *childname, unsigned int seconds) |
Add a seconds node type. More... | |
struct ast_data * | ast_data_add_str (struct ast_data *root, const char *childname, const char *string) |
Add a string node type. More... | |
struct ast_data * | ast_data_add_timestamp (struct ast_data *root, const char *childname, unsigned int timestamp) |
Add a timestamp node type. More... | |
struct ast_data * | ast_data_add_uint (struct ast_data *root, const char *childname, unsigned int value) |
Add an unsigned integer node type. More... | |
void | ast_data_free (struct ast_data *root) |
Release the allocated memory of a tree. More... | |
struct ast_data * | ast_data_get (const struct ast_data_query *query) |
Retrieve a subtree from the asterisk data API. More... | |
struct ast_xml_doc * | ast_data_get_xml (const struct ast_data_query *query) |
Retrieve a subtree from the asterisk data API in XML format.. More... | |
void | ast_data_iterator_end (struct ast_data_iterator *iterator) |
Release (stop using) an iterator. More... | |
struct ast_data_iterator * | ast_data_iterator_init (struct ast_data *tree, const char *elements) |
Initialize an iterator. More... | |
struct ast_data * | ast_data_iterator_next (struct ast_data_iterator *iterator) |
Get the next node of the tree. More... | |
void | ast_data_remove_node (struct ast_data *root, struct ast_data *child) |
Remove a node that was added using ast_data_add_. More... | |
int | ast_data_retrieve (struct ast_data *tree, const char *path, struct ast_data_retrieve *content) |
Retrieve a value from a node in the tree. More... | |
static unsigned int | ast_data_retrieve_bool (struct ast_data *tree, const char *path) |
Retrieve the boolean value of a node. More... | |
static char | ast_data_retrieve_char (struct ast_data *tree, const char *path) |
Retrieve the character value of a node. More... | |
static double | ast_data_retrieve_dbl (struct ast_data *tree, const char *path) |
Retrieve the double value of a node. More... | |
static int | ast_data_retrieve_int (struct ast_data *tree, const char *path) |
Retrieve the integer value of a node. More... | |
static struct in_addr | ast_data_retrieve_ipaddr (struct ast_data *tree, const char *path) |
Retrieve the ipv4 address value of a node. More... | |
char * | ast_data_retrieve_name (struct ast_data *node) |
Get the node name. More... | |
static const char * | ast_data_retrieve_password (struct ast_data *tree, const char *path) |
Retrieve the password value of a node. More... | |
static void * | ast_data_retrieve_ptr (struct ast_data *tree, const char *path) |
Retrieve the ptr value of a node. More... | |
static const char * | ast_data_retrieve_string (struct ast_data *tree, const char *path) |
Retrieve the string value of a node. More... | |
enum ast_data_type | ast_data_retrieve_type (struct ast_data *res, const char *path) |
Get a node type. More... | |
static unsigned int | ast_data_retrieve_uint (struct ast_data *tree, const char *path) |
Retrieve the unsigned integer value of a node. More... | |
int | ast_data_search_match (const struct ast_data_search *search, struct ast_data *data) |
Check the current generated node to know if it matches the search condition. More... | |
Data retrieval API.
Definition in file data.h.
#define __AST_DATA_MAPPING_FUNCTION | ( | __structure, | |
__member, | |||
__type | |||
) | __AST_DATA_MAPPING_FUNCTION_##__type(__structure, __member) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_BOOLEAN | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_BOOLEAN, unsigned int) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_CHARACTER | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_CHARACTER, char) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_CONTAINER | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_CONTAINER, void *) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_DOUBLE | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_DBL, double) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_INTEGER | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_INTEGER, int) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_IPADDR | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_IPADDR, struct in_addr) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_MILLISECONDS | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_INTEGER, int) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_PASSWORD | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_PASSWORD, char *) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_POINTER | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_POINTER, void *) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_SECONDS | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_INTEGER, int) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_STRING | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_STRING, char *) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_TIMESTAMP | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_INTEGER, int) |
#define __AST_DATA_MAPPING_FUNCTION_AST_DATA_UNSIGNED_INTEGER | ( | __structure, | |
__member | |||
) | __AST_DATA_MAPPING_FUNCTION_TYPE(__structure, __member, AST_DATA_UNSIGNED_INTEGER, unsigned int) |
#define __AST_DATA_MAPPING_FUNCTION_TYPE | ( | __structure, | |
__member, | |||
__type, | |||
__real_type | |||
) |
#define __AST_DATA_MAPPING_STRUCTURE | ( | __structure, | |
__member, | |||
__type | |||
) |
#define ast_data_add_structure | ( | structure_name, | |
root, | |||
structure | |||
) |
Definition at line 620 of file data.h.
Referenced by agents_data_provider_get(), ast_channel_data_add_structure(), ast_tone_zone_data_add_structure(), dahdi_channels_data_provider_get(), data_odbc_provider_handler(), meetme_data_provider_get(), peers_data_provider_get(), queues_data_provider_get_helper(), user_add_provider_cb(), users_data_provider_get(), and vm_users_data_provider_get_helper().
#define AST_DATA_ENTRY | ( | __path, | |
__handler | |||
) | { .path = __path, .handler = __handler } |
#define AST_DATA_HANDLER_VERSION 1 |
#define AST_DATA_QUERY_VERSION 1 |
Definition at line 205 of file data.h.
Referenced by handle_cli_data_get(), and manager_data_get().
#define ast_data_register | ( | path, | |
handler | |||
) | __ast_data_register(path, handler, __FILE__, ast_module_info->self) |
#define ast_data_register_core | ( | path, | |
handler | |||
) | __ast_data_register(path, handler, __FILE__, NULL) |
#define ast_data_register_multiple | ( | data_entries, | |
entries | |||
) | __ast_data_register_multiple(data_entries, entries, __FILE__, ast_module_info->self) |
Definition at line 377 of file data.h.
Referenced by load_module().
#define ast_data_register_multiple_core | ( | data_entries, | |
entries | |||
) | __ast_data_register_multiple(data_entries, entries, __FILE__, NULL) |
Definition at line 379 of file data.h.
Referenced by ast_channels_init(), and load_pbx().
#define ast_data_search_cmp_structure | ( | search, | |
structure_name, | |||
structure, | |||
structure_name_cmp | |||
) |
Definition at line 420 of file data.h.
Referenced by ast_channel_data_cmp_structure().
#define AST_DATA_STRUCTURE | ( | __struct, | |
__name | |||
) |
#define ast_data_unregister | ( | path | ) | __ast_data_unregister(path, __FILE__) |
Definition at line 394 of file data.h.
Referenced by __unload_module(), channels_shutdown(), unload_module(), and unload_pbx().
typedef int(* ast_data_get_cb)(const struct ast_data_search *search, struct ast_data *root) |
enum ast_data_type |
The data type of the data node.
Definition at line 187 of file data.h.
int __ast_data_add_structure | ( | struct ast_data * | root, |
const struct ast_data_mapping_structure * | mapping, | ||
size_t | mapping_len, | ||
void * | structure | ||
) |
Add a complete structure to a node.
[in] | root | Where to add the structure. |
[in] | mapping | The structure mapping array. |
[in] | mapping_len | The lenght of the mapping array. |
[in] | structure | The structure pointer. |
0 | on success. |
1 | on error. |
Definition at line 2422 of file data.c.
References ast_data_add_bool(), ast_data_add_char(), ast_data_add_dbl(), ast_data_add_int(), ast_data_add_ipaddr(), ast_data_add_milliseconds(), ast_data_add_password(), ast_data_add_ptr(), ast_data_add_seconds(), ast_data_add_str(), ast_data_add_timestamp(), ast_data_add_uint(), AST_DATA_BOOLEAN, AST_DATA_CHARACTER, AST_DATA_CONTAINER, AST_DATA_DOUBLE, AST_DATA_INTEGER, AST_DATA_IPADDR, AST_DATA_MILLISECONDS, AST_DATA_PASSWORD, AST_DATA_POINTER, AST_DATA_SECONDS, AST_DATA_STRING, AST_DATA_TIMESTAMP, AST_DATA_UNSIGNED_INTEGER, data_filter::name, and type.
int __ast_data_register | ( | const char * | path, |
const struct ast_data_handler * | handler, | ||
const char * | registrar, | ||
struct ast_module * | mod | ||
) |
Register a data provider.
[in] | path | The path of the node to register. |
[in] | handler | The structure defining this node handler. |
[in] | registrar | Who is registering this node. |
[in] | mod | The module registering this handler. |
<0 | on error. |
0 | on success. |
Definition at line 518 of file data.c.
References ao2_container_count(), ao2_ref, ast_log(), data_provider::children, data_provider_create(), data_structure_compatible(), data_unlock, data_write_lock, data_provider::handler, LOG_ERROR, data_provider::module, data_provider::name, root_data, and ast_data_handler::version.
Referenced by __ast_data_register_multiple().
int __ast_data_register_multiple | ( | const struct ast_data_entry * | data_entries, |
size_t | entries, | ||
const char * | registrar, | ||
struct ast_module * | mod | ||
) |
Register multiple data providers at once.
[in] | data_entries | An array of data_entries structures. |
[in] | entries | The number of entries in the data_entries array. |
[in] | registrar | Who is registering this nodes. |
[in] | mod | The module registering this handlers. |
<0 | on error (none of the nodes are being registered on error). |
0 | on success. |
Definition at line 565 of file data.c.
References __ast_data_register(), __ast_data_unregister(), and data_provider::handler.
int __ast_data_search_cmp_structure | ( | const struct ast_data_search * | search, |
const struct ast_data_mapping_structure * | mapping, | ||
size_t | mapping_len, | ||
void * | structure, | ||
const char * | structure_name | ||
) |
Based on a search tree, evaluate every member of a structure against it.
[in] | search | The search tree. |
[in] | mapping | The structure mapping. |
[in] | mapping_len | The lenght of the structure mapping. |
[in] | structure | The structure pointer. |
[in] | structure_name | The name of the structure to compare. |
0 | If the structure matches. |
1 | If the structure doesn't match. |
Definition at line 1272 of file data.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, AST_DATA_BOOLEAN, ast_data_mapping_structure::AST_DATA_BOOLEAN, AST_DATA_CHARACTER, ast_data_mapping_structure::AST_DATA_CHARACTER, AST_DATA_CONTAINER, AST_DATA_DOUBLE, ast_data_mapping_structure::AST_DATA_DOUBLE, AST_DATA_INTEGER, ast_data_mapping_structure::AST_DATA_INTEGER, AST_DATA_IPADDR, ast_data_mapping_structure::AST_DATA_IPADDR, AST_DATA_MILLISECONDS, ast_data_mapping_structure::AST_DATA_MILLISECONDS, AST_DATA_PASSWORD, ast_data_mapping_structure::AST_DATA_PASSWORD, AST_DATA_POINTER, ast_data_mapping_structure::AST_DATA_POINTER, AST_DATA_SECONDS, ast_data_mapping_structure::AST_DATA_SECONDS, AST_DATA_STRING, ast_data_mapping_structure::AST_DATA_STRING, AST_DATA_TIMESTAMP, ast_data_mapping_structure::AST_DATA_TIMESTAMP, AST_DATA_UNSIGNED_INTEGER, ast_data_mapping_structure::AST_DATA_UNSIGNED_INTEGER, ast_data_search::children, data_search_cmp_bool(), data_search_cmp_char(), data_search_cmp_dbl(), data_search_cmp_int(), data_search_cmp_ipaddr(), data_search_cmp_ptr(), data_search_cmp_string(), data_search_cmp_uint(), data_search_get_node(), data_search_mapping_find(), ast_data_mapping_structure::get, ast_data_search::name, and type.
int __ast_data_unregister | ( | const char * | path, |
const char * | registrar | ||
) |
Unregister a data provider.
[in] | path | Which node to unregister, if path is NULL unregister every node registered by the passed 'registrar'. |
[in] | registrar | Who is trying to unregister this node, only the owner (the one who registered the node) will be able to unregister it. |
<0 | on error. |
0 | on success. |
Definition at line 586 of file data.c.
References ast_log(), data_provider_release(), data_provider_release_all(), data_unlock, data_write_lock, LOG_ERROR, and root_data.
Referenced by __ast_data_register_multiple().
struct ast_data* ast_data_add_bool | ( | struct ast_data * | root, |
const char * | childname, | ||
unsigned int | boolean | ||
) |
Add a boolean node type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | boolean | The value for the new node. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2344 of file data.c.
References __ast_data_add(), and AST_DATA_BOOLEAN.
Referenced by __ast_data_add_structure(), agents_data_provider_get(), ast_channel_data_add_structure(), channel_data_add_flags(), dahdi_status_data_provider_get(), data_channeltypes_provider_handler(), data_odbc_provider_handler(), peers_data_provider_get(), and users_data_provider_get().
Add a char node type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | value | The value for the new node. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2327 of file data.c.
References __ast_data_add(), and AST_DATA_CHARACTER.
Referenced by __ast_data_add_structure().
Add the list of codecs in the root node based on the capability parameter.
[in] | root | The astdata root node where to add the codecs node. |
[in] | node_name | The name of the node where we are going to add the list of codecs. |
[in] | capability | The codecs allowed. |
Definition at line 3112 of file data.c.
References ast_data_add_int(), ast_data_add_node(), ast_data_add_str(), ast_get_format_list(), ast_format_list::bits, desc, ast_format_list::fr_len, data_filter::name, and ast_format_list::samplespersecond.
Referenced by ast_channel_data_add_structure(), data_channeltypes_provider_handler(), peers_data_provider_get(), and users_data_provider_get().
Add a floating point node type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | dbl | The value for the new node. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2338 of file data.c.
References __ast_data_add(), and AST_DATA_DOUBLE.
Referenced by __ast_data_add_structure().
Add an integer node type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | value | The value for the new node. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2322 of file data.c.
References __ast_data_add(), and AST_DATA_INTEGER.
Referenced by __ast_data_add_structure(), ast_cdr_data_add_structure(), ast_channel_data_add_structure(), ast_data_add_codecs(), dahdi_status_data_provider_get(), data_odbc_provider_handler(), hints_data_provider_get(), peers_data_provider_get(), queues_data_provider_get_helper(), user_add_provider_cb(), users_data_provider_get(), and vm_users_data_provider_get_helper().
struct ast_data* ast_data_add_ipaddr | ( | struct ast_data * | root, |
const char * | childname, | ||
struct in_addr | addr | ||
) |
Add a ipv4 address type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | addr | The ipv4 address value. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2350 of file data.c.
References __ast_data_add(), and AST_DATA_IPADDR.
Referenced by __ast_data_add_structure().
struct ast_data* ast_data_add_milliseconds | ( | struct ast_data * | root, |
const char * | childname, | ||
unsigned int | milliseconds | ||
) |
Add a milliseconds node type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | milliseconds | The value for the new node. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2374 of file data.c.
References __ast_data_add(), and AST_DATA_MILLISECONDS.
Referenced by __ast_data_add_structure().
Add a container child.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2317 of file data.c.
References __ast_data_add(), and AST_DATA_CONTAINER.
Referenced by agents_data_provider_get(), ast_cdr_data_add_structure(), ast_channel_data_add_structure(), ast_data_add_codecs(), ast_tone_zone_data_add_structure(), dahdi_channels_data_provider_get(), dahdi_status_data_provider_get(), data_channels_provider_handler(), data_channeltypes_provider_handler(), data_odbc_provider_handler(), hints_data_provider_get(), meetme_data_provider_get(), peers_data_provider_get(), queues_data_provider_get_helper(), user_add_provider_cb(), users_data_provider_get(), and vm_users_data_provider_get_helper().
struct ast_data* ast_data_add_password | ( | struct ast_data * | root, |
const char * | childname, | ||
const char * | string | ||
) |
Add a password node type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | string | The value for the new node. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2380 of file data.c.
References __ast_data_add(), AST_DATA_PASSWORD, ast_free, ast_malloc, ast_strlen_zero(), and data_filter::name.
Referenced by __ast_data_add_structure(), and users_data_provider_get().
Add a ptr node type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | ptr | The pointer value to add. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2356 of file data.c.
References __ast_data_add(), and AST_DATA_POINTER.
Referenced by __ast_data_add_structure().
struct ast_data* ast_data_add_seconds | ( | struct ast_data * | root, |
const char * | childname, | ||
unsigned int | seconds | ||
) |
Add a seconds node type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | seconds | The value for the new node. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2368 of file data.c.
References __ast_data_add(), and AST_DATA_SECONDS.
Referenced by __ast_data_add_structure().
struct ast_data* ast_data_add_str | ( | struct ast_data * | root, |
const char * | childname, | ||
const char * | string | ||
) |
Add a string node type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | string | The value for the new node. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2401 of file data.c.
References __ast_data_add(), AST_DATA_STRING, ast_free, ast_malloc, ast_strlen_zero(), and data_filter::name.
Referenced by __ast_data_add_structure(), agents_data_provider_get(), ast_cdr_data_add_structure(), ast_channel_data_add_structure(), ast_data_add_codecs(), dahdi_status_data_provider_get(), dahdi_version_data_provider_get(), data_channeltypes_provider_handler(), data_odbc_provider_handler(), hints_data_provider_get(), peers_data_provider_get(), queues_data_provider_get_helper(), and users_data_provider_get().
struct ast_data* ast_data_add_timestamp | ( | struct ast_data * | root, |
const char * | childname, | ||
unsigned int | timestamp | ||
) |
Add a timestamp node type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | timestamp | The value for the new node. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2362 of file data.c.
References __ast_data_add(), and AST_DATA_TIMESTAMP.
Referenced by __ast_data_add_structure().
struct ast_data* ast_data_add_uint | ( | struct ast_data * | root, |
const char * | childname, | ||
unsigned int | value | ||
) |
Add an unsigned integer node type.
[in] | root | The root of the ast_data to insert into. |
[in] | childname | The name of the child element to be added. |
[in] | value | The value for the new node. |
NULL | on error (memory exhaustion only). |
non-NULL | a newly allocated node. |
Definition at line 2332 of file data.c.
References __ast_data_add(), and AST_DATA_UNSIGNED_INTEGER.
Referenced by __ast_data_add_structure(), and ast_channel_data_add_structure().
void ast_data_free | ( | struct ast_data * | root | ) |
Release the allocated memory of a tree.
[in] | root | The sub-tree pointer returned by a call to ast_data_get. |
Definition at line 2491 of file data.c.
References ao2_ref.
Referenced by ast_data_get_xml(), handle_cli_data_get(), and manager_data_get().
struct ast_data* ast_data_get | ( | const struct ast_data_query * | query | ) |
Retrieve a subtree from the asterisk data API.
[in] | query | The query structure specifying what nodes to retrieve. |
NULL | on error. |
non-NULL | The dynamically allocated requested sub-tree (it needs to be released using ast_data_free. |
Definition at line 2065 of file data.c.
References ast_log(), data_read_lock, data_result_generate(), data_structure_compatible(), data_unlock, LOG_ERROR, ast_data_query::path, and ast_data_query::version.
Referenced by ast_data_get_xml(), handle_cli_data_get(), and manager_data_get().
struct ast_xml_doc* ast_data_get_xml | ( | const struct ast_data_query * | query | ) |
Retrieve a subtree from the asterisk data API in XML format..
[in] | query | The query structure specifying what nodes to retrieve. |
NULL | on error. |
non-NULL | The dynamically allocated requested sub-tree (it needs to be released using ast_data_free. |
Definition at line 2181 of file data.c.
References ast_data_free(), ast_data_get(), ast_xml_close(), ast_xml_new(), ast_xml_new_node(), ast_xml_set_root(), data_get_xml_add_child(), and ast_data::name.
void ast_data_iterator_end | ( | struct ast_data_iterator * | iterator | ) |
Release (stop using) an iterator.
[in] | iterator | The iterator created by ast_data_iterator_start. |
Definition at line 2542 of file data.c.
References ao2_iterator_destroy(), ao2_ref, ast_free, ast_data_iterator::internal_iterator, ast_data_iterator::is_pattern, ast_data_iterator::last, and ast_data_iterator::regex_pattern.
struct ast_data_iterator* ast_data_iterator_init | ( | struct ast_data * | tree, |
const char * | elements | ||
) |
Initialize an iterator.
[in] | tree | The returned tree by a call to ast_data_get. |
[in] | elements | Which elements to iterate through. |
NULL | on error. |
non-NULL | A dinamically allocated iterator structure. |
Definition at line 2497 of file data.c.
References ao2_iterator_init(), ast_calloc, ast_strdupa, data_result_get_node(), ast_data_iterator::internal_iterator, ast_data_iterator::is_pattern, ast_data_iterator::pattern, ast_data::ptr, and ast_data_iterator::regex_pattern.
struct ast_data* ast_data_iterator_next | ( | struct ast_data_iterator * | iterator | ) |
Get the next node of the tree.
[in] | iterator | The iterator structure returned by ast_data_iterator_start. |
NULL | when no more nodes to return. |
non-NULL | A node of the ast_data tree. |
Definition at line 2560 of file data.c.
References ao2_iterator_next, ao2_ref, ast_data_iterator::internal_iterator, ast_data_iterator::is_pattern, ast_data_iterator::last, ast_data::name, ast_data_iterator::pattern, and ast_data_iterator::regex_pattern.
Remove a node that was added using ast_data_add_.
[in] | root | The root node of the node to be removed. |
[in] | child | The node pointer to remove. |
Definition at line 2486 of file data.c.
References ao2_unlink, and ast_data::children.
Referenced by agents_data_provider_get(), dahdi_channels_data_provider_get(), dahdi_status_data_provider_get(), data_channels_provider_handler(), data_channeltypes_provider_handler(), data_odbc_provider_handler(), hints_data_provider_get(), meetme_data_provider_get(), peers_data_provider_get(), queues_data_provider_get_helper(), users_data_provider_get(), and vm_users_data_provider_get_helper().
int ast_data_retrieve | ( | struct ast_data * | tree, |
const char * | path, | ||
struct ast_data_retrieve * | content | ||
) |
Retrieve a value from a node in the tree.
[in] | tree | The structure returned by a call to ast_data_get. |
[in] | path | The path to the node. |
[out] | content | The node content. |
0 | on success. |
<0 | on error. |
Definition at line 2598 of file data.c.
References AST_DATA_BOOLEAN, ast_data_retrieve::AST_DATA_BOOLEAN, AST_DATA_CHARACTER, ast_data_retrieve::AST_DATA_CHARACTER, AST_DATA_CONTAINER, AST_DATA_DOUBLE, ast_data_retrieve::AST_DATA_DOUBLE, AST_DATA_INTEGER, ast_data_retrieve::AST_DATA_INTEGER, AST_DATA_IPADDR, ast_data_retrieve::AST_DATA_IPADDR, AST_DATA_MILLISECONDS, ast_data_retrieve::AST_DATA_MILLISECONDS, AST_DATA_PASSWORD, ast_data_retrieve::AST_DATA_PASSWORD, AST_DATA_POINTER, ast_data_retrieve::AST_DATA_POINTER, AST_DATA_SECONDS, ast_data_retrieve::AST_DATA_SECONDS, AST_DATA_STRING, ast_data_retrieve::AST_DATA_STRING, AST_DATA_TIMESTAMP, ast_data_retrieve::AST_DATA_TIMESTAMP, AST_DATA_UNSIGNED_INTEGER, ast_data_retrieve::AST_DATA_UNSIGNED_INTEGER, ast_log(), ast_data::boolean, ast_data::character, data_result_get_node(), ast_data::dbl, ast_data::ipaddr, LOG_ERROR, ast_data::payload, ast_data::ptr, ast_data::sint, ast_data::str, ast_data_retrieve::type, ast_data::type, ast_data::uint, and ast_data_retrieve::value.
Referenced by ast_data_retrieve_bool(), ast_data_retrieve_char(), ast_data_retrieve_dbl(), ast_data_retrieve_int(), ast_data_retrieve_ipaddr(), ast_data_retrieve_password(), ast_data_retrieve_ptr(), ast_data_retrieve_string(), and ast_data_retrieve_uint().
|
inlinestatic |
Retrieve the boolean value of a node.
[in] | tree | The tree from where to get the value. |
[in] | path | The node name or path. |
Definition at line 703 of file data.h.
References ast_data_retrieve::AST_DATA_BOOLEAN, ast_data_retrieve(), and ast_data_retrieve::value.
|
inlinestatic |
Retrieve the character value of a node.
[in] | tree | The tree from where to get the value. |
[in] | path | The node name or path. |
Definition at line 688 of file data.h.
References ast_data_retrieve::AST_DATA_CHARACTER, ast_data_retrieve(), and ast_data_retrieve::value.
|
inlinestatic |
Retrieve the double value of a node.
[in] | tree | The tree from where to get the value. |
[in] | path | The node name or path. |
Definition at line 778 of file data.h.
References ast_data_retrieve::AST_DATA_DOUBLE, ast_data_retrieve(), and ast_data_retrieve::value.
|
inlinestatic |
Retrieve the integer value of a node.
[in] | tree | The tree from where to get the value. |
[in] | path | The node name or path. |
Definition at line 673 of file data.h.
References ast_data_retrieve::AST_DATA_INTEGER, ast_data_retrieve(), and ast_data_retrieve::value.
|
static |
Retrieve the ipv4 address value of a node.
[in] | tree | The tree from where to get the value. |
[in] | path | The node name or path. |
Definition at line 793 of file data.h.
References ast_data_retrieve::AST_DATA_IPADDR, ast_data_retrieve(), and ast_data_retrieve::value.
char* ast_data_retrieve_name | ( | struct ast_data * | node | ) |
Get the node name.
[in] | node | The node pointer. |
Definition at line 2225 of file data.c.
References ast_data::name.
|
inlinestatic |
Retrieve the password value of a node.
[in] | tree | The tree from where to get the value. |
[in] | path | The node name or path. |
Definition at line 733 of file data.h.
References ast_data_retrieve::AST_DATA_PASSWORD, ast_data_retrieve(), and ast_data_retrieve::value.
|
inlinestatic |
Retrieve the ptr value of a node.
[in] | tree | The tree from where to get the value. |
[in] | path | The node name or path. |
Definition at line 763 of file data.h.
References ast_data_retrieve::AST_DATA_POINTER, ast_data_retrieve(), and ast_data_retrieve::value.
|
inlinestatic |
Retrieve the string value of a node.
[in] | tree | The tree from where to get the value. |
[in] | path | The node name or path. |
Definition at line 748 of file data.h.
References ast_data_retrieve(), ast_data_retrieve::AST_DATA_STRING, and ast_data_retrieve::value.
enum ast_data_type ast_data_retrieve_type | ( | struct ast_data * | res, |
const char * | path | ||
) |
Get a node type.
[in] | res | A pointer to the ast_data result set. |
[in] | path | A path to the node to get the type. |
Definition at line 2213 of file data.c.
References data_result_get_node().
|
inlinestatic |
Retrieve the unsigned integer value of a node.
[in] | tree | The tree from where to get the value. |
[in] | path | The node name or path. |
Definition at line 718 of file data.h.
References ast_data_retrieve(), ast_data_retrieve::AST_DATA_UNSIGNED_INTEGER, and ast_data_retrieve::value.
int ast_data_search_match | ( | const struct ast_data_search * | search, |
struct ast_data * | data | ||
) |
Check the current generated node to know if it matches the search condition.
[in] | search | The search condition. |
[in] | data | The AstData node generated. |
Definition at line 1458 of file data.c.
References ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, AST_DATA_BOOLEAN, AST_DATA_CHARACTER, AST_DATA_CONTAINER, AST_DATA_DOUBLE, AST_DATA_INTEGER, AST_DATA_IPADDR, AST_DATA_MILLISECONDS, AST_DATA_PASSWORD, AST_DATA_POINTER, ast_data_search_match(), AST_DATA_SECONDS, AST_DATA_STRING, AST_DATA_TIMESTAMP, AST_DATA_UNSIGNED_INTEGER, ast_data::boolean, ast_data::character, ast_data::children, ast_data_search::children, data_result_find_child(), data_search_cmp_bool(), data_search_cmp_char(), data_search_cmp_int(), data_search_cmp_ipaddr(), data_search_cmp_ptr(), data_search_cmp_string(), data_search_cmp_uint(), data_search_find(), ast_data::dbl, ast_data::ipaddr, ast_data::name, ast_data_search::name, ast_data::payload, ast_data::ptr, ast_data::sint, ast_data::str, ast_data::type, and ast_data::uint.
Referenced by agents_data_provider_get(), ast_data_search_match(), dahdi_channels_data_provider_get(), dahdi_status_data_provider_get(), data_channels_provider_handler(), data_channeltypes_provider_handler(), data_odbc_provider_handler(), hints_data_provider_get(), meetme_data_provider_get(), peers_data_provider_get(), queues_data_provider_get_helper(), users_data_provider_get(), and vm_users_data_provider_get_helper().