RTS API Documentation  1.10.11
Data Structures | Macros | Enumerations | Functions
switch_xml.h File Reference
#include <switch.h>
+ Include dependency graph for switch_xml.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  switch_xml
 A representation of an XML tree. More...
 

Macros

#define USE_UTF_8_ENCODING   SWITCH_TRUE
 
#define SWITCH_XML_BUFSIZE   1024
 
#define switch_xml_parse_str_dup(x)   switch_xml_parse_str_dynamic(x, SWITCH_TRUE)
 Parses a string into a switch_xml_t. More...
 
#define switch_xml_next(xml)   ((xml) ? xml->next : NULL)
 returns the next tag of the same name in the same section and depth or NULL \ if not found More...
 
#define switch_xml_name(xml)   ((xml) ? xml->name : NULL)
 returns the name of the given tag More...
 
#define switch_xml_txt(xml)   ((xml) ? xml->txt : "")
 returns the given tag's character content or empty string if none More...
 
#define switch_xml_toxml(xml, prn_header)   switch_xml_toxml_ex(xml, prn_header, USE_UTF_8_ENCODING)
 Converts an switch_xml structure back to xml in html format. Returns a string of html data that \ must be freed. More...
 
#define switch_xml_toxml_nolock(xml, prn_header)   switch_xml_toxml_nolock_ex(xml, prn_header, USE_UTF_8_ENCODING)
 
#define switch_xml_tohtml(xml, prn_header)   switch_xml_tohtml_ex(xml, prn_header, USE_UTF_8_ENCODING)
 
#define switch_xml_toxml_buf(xml, buf, buflen, offset, prn_header)   switch_xml_toxml_buf_ex(xml, buf, buflen, offset, prn_header, USE_UTF_8_ENCODING);
 Converts an switch_xml structure back to xml using the buffer passed in the parameters. More...
 
#define switch_xml_new_d(name)   switch_xml_set_flag(switch_xml_new(strdup(name)), SWITCH_XML_NAMEM)
 wrapper for switch_xml_new() that strdup()s name More...
 
#define switch_xml_move(xml, dest, off)   switch_xml_insert(switch_xml_cut(xml), dest, off)
 Moves an existing tag to become a subtag of dest at the given offset from \ the start of dest's character content. Returns the moved tag. More...
 
#define switch_xml_remove(xml)   switch_xml_free(switch_xml_cut(xml))
 removes a tag along with all its subtags More...
 
#define switch_xml_bind_search_function(_f, _s, _u)   switch_xml_bind_search_function_ret(_f, _s, _u, NULL)
 

Enumerations

enum  switch_xml_flag_t {
  SWITCH_XML_ROOT = (1 << 0), SWITCH_XML_NAMEM = (1 << 1), SWITCH_XML_TXTM = (1 << 2), SWITCH_XML_DUP = (1 << 3),
  SWITCH_XML_CDATA = (1 << 4)
}
 

Functions

switch_xml_t switch_xml_parse_str_dynamic (_In_z_ char *s, _In_ switch_bool_t dup)
 Parses a string into a switch_xml_t, ensuring the memory will be freed with switch_xml_free. More...
 
switch_xml_t switch_xml_parse_str (_In_z_ char *s, _In_ switch_size_t len)
 Given a string of xml data and its length, parses it and creates an switch_xml \ structure. For efficiency, modifies the data by adding null terminators \ and decoding ampersand sequences. If you don't want this, copy the data and \ pass in the copy. Returns NULL on failure. More...
 
switch_xml_t switch_xml_parse_fd (int fd)
 A wrapper for switch_xml_parse_str() that accepts a file descriptor. First \ attempts to mem map the file. Failing that, reads the file into memory. \ Returns NULL on failure. More...
 
switch_xml_t switch_xml_parse_file (_In_z_ const char *file)
 a wrapper for switch_xml_parse_fd() that accepts a file name More...
 
switch_xml_t switch_xml_parse_file_simple (_In_z_ const char *file)
 
switch_xml_t switch_xml_parse_fp (_In_ FILE *fp)
 Wrapper for switch_xml_parse_str() that accepts a file stream. Reads the entire \ stream into memory and then parses it. For xml files, use switch_xml_parse_file() \ or switch_xml_parse_fd() More...
 
switch_xml_t switch_xml_child (_In_ switch_xml_t xml, _In_z_ const char *name)
 returns the first child tag (one level deeper) with the given name or NULL \ if not found More...
 
switch_xml_t switch_xml_find_child (_In_ switch_xml_t node, _In_z_ const char *childname, _In_opt_z_ const char *attrname, _In_opt_z_ const char *value)
 find a child tag in a node called 'childname' with an attribute 'attrname' which equals 'value' More...
 
switch_xml_t switch_xml_find_child_multi (_In_ switch_xml_t node, _In_z_ const char *childname,...)
 
switch_xml_t switch_xml_idx (_In_ switch_xml_t xml, _In_ int idx)
 Returns the Nth tag with the same name in the same section at the same depth \ or NULL if not found. An index of 0 returns the tag given. More...
 
const char * switch_xml_attr (_In_opt_ switch_xml_t xml, _In_opt_z_ const char *attr)
 returns the value of the requested tag attribute, or NULL if not found More...
 
const char * switch_xml_attr_soft (_In_ switch_xml_t xml, _In_z_ const char *attr)
 returns the value of the requested tag attribute, or "" if not found More...
 
switch_xml_t switch_xml_get (_In_ switch_xml_t xml,...)
 Traverses the switch_xml structure to retrieve a specific subtag. Takes a \ variable length list of tag names and indexes. The argument list must be \ terminated by either an index of -1 or an empty string tag name. Example: \ title = switch_xml_get(library, "shelf", 0, "book", 2, "title", -1); \ This retrieves the title of the 3rd book on the 1st shelf of library. \ Returns NULL if not found. More...
 
char * switch_xml_toxml_ex (_In_ switch_xml_t xml, _In_ switch_bool_t prn_header, switch_bool_t use_utf8_encoding)
 
char * switch_xml_toxml_nolock_ex (switch_xml_t xml, _In_ switch_bool_t prn_header, switch_bool_t use_utf8_encoding)
 
char * switch_xml_tohtml_ex (_In_ switch_xml_t xml, _In_ switch_bool_t prn_header, switch_bool_t use_utf8_encoding)
 
char * switch_xml_toxml_buf_ex (_In_ switch_xml_t xml, _In_z_ char *buf, _In_ switch_size_t buflen, _In_ switch_size_t offset, _In_ switch_bool_t prn_header, switch_bool_t use_utf8_encoding)
 
const char ** switch_xml_pi (_In_ switch_xml_t xml, _In_z_ const char *target)
 returns a NULL terminated array of processing instructions for the given \ target More...
 
void switch_xml_free (_In_opt_ switch_xml_t xml)
 frees the memory allocated for an switch_xml structure More...
 
void switch_xml_free_in_thread (_In_ switch_xml_t xml, _In_ int stacksize)
 
const char * switch_xml_error (_In_ switch_xml_t xml)
 returns parser error message or empty string if none More...
 
switch_xml_t switch_xml_new (_In_opt_z_ const char *name)
 returns a new empty switch_xml structure with the given root tag name More...
 
switch_xml_t switch_xml_add_child (_In_ switch_xml_t xml, _In_z_ const char *name, _In_ switch_size_t off)
 Adds a child tag. off is the offset of the child tag relative to the start \ of the parent tag's character content. Returns the child tag. More...
 
switch_xml_t switch_xml_add_child_d (_In_ switch_xml_t xml, _In_z_ const char *name, _In_ switch_size_t off)
 wrapper for switch_xml_add_child() that strdup()s name More...
 
switch_xml_t switch_xml_set_txt (switch_xml_t xml, const char *txt)
 sets the character content for the given tag and returns the tag More...
 
switch_xml_t switch_xml_set_txt_d (switch_xml_t xml, const char *txt)
 wrapper for switch_xml_set_txt() that strdup()s txt \ sets the character content for the given tag and returns the tag More...
 
switch_xml_t switch_xml_set_attr (switch_xml_t xml, const char *name, const char *value)
 Sets the given tag attribute or adds a new attribute if not found. A value \ of NULL will remove the specified attribute. More...
 
switch_xml_t switch_xml_set_attr_d (switch_xml_t xml, const char *name, const char *value)
 Wrapper for switch_xml_set_attr() that strdup()s name/value. Value cannot be NULL. More...
 
switch_xml_t switch_xml_set_attr_d_buf (switch_xml_t xml, const char *name, const char *value)
 Wrapper for switch_xml_set_attr() that strdup()s name/value. Value cannot be NULL. More...
 
switch_xml_t switch_xml_set_flag (switch_xml_t xml, switch_xml_flag_t flag)
 sets a flag for the given tag and returns the tag More...
 
switch_xml_t switch_xml_cut (_In_ switch_xml_t xml)
 removes a tag along with its subtags without freeing its memory More...
 
switch_xml_t switch_xml_insert (_In_ switch_xml_t xml, _In_ switch_xml_t dest, _In_ switch_size_t off)
 inserts an existing tag into an ezxml structure More...
 
switch_status_t switch_xml_set_root (switch_xml_t new_main)
 set new core xml root More...
 
switch_status_t switch_xml_set_open_root_function (switch_xml_open_root_function_t func, void *user_data)
 Set and alternate function for opening xml root. More...
 
switch_xml_t switch_xml_open_root (_In_ uint8_t reload, _Out_ const char **err)
 open the Core xml root More...
 
switch_status_t switch_xml_init (_In_ switch_memory_pool_t *pool, _Out_ const char **err)
 initilize the core XML backend More...
 
switch_status_t switch_xml_reload (const char **err)
 
switch_status_t switch_xml_destroy (void)
 
switch_xml_t switch_xml_root (void)
 retrieve the core XML root node More...
 
switch_status_t switch_xml_locate (_In_z_ const char *section, _In_opt_z_ const char *tag_name, _In_opt_z_ const char *key_name, _In_opt_z_ const char *key_value, _Out_ switch_xml_t *root, _Out_ switch_xml_t *node, _In_opt_ switch_event_t *params, _In_ switch_bool_t clone)
 locate an xml pointer in the core registry More...
 
switch_status_t switch_xml_locate_domain (_In_z_ const char *domain_name, _In_opt_ switch_event_t *params, _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain)
 
switch_status_t switch_xml_locate_group (_In_z_ const char *group_name, _In_z_ const char *domain_name, _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain, _Out_ switch_xml_t *group, _In_opt_ switch_event_t *params)
 
switch_status_t switch_xml_locate_user (_In_z_ const char *key, _In_z_ const char *user_name, _In_z_ const char *domain_name, _In_opt_z_ const char *ip, _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain, _Out_ switch_xml_t *user, _Out_opt_ switch_xml_t *ingroup, _In_opt_ switch_event_t *params)
 
switch_status_t switch_xml_locate_user_in_domain (_In_z_ const char *user_name, _In_ switch_xml_t domain, _Out_ switch_xml_t *user, _Out_opt_ switch_xml_t *ingroup)
 
switch_status_t switch_xml_locate_user_merged (const char *key, const char *user_name, const char *domain_name, const char *ip, switch_xml_t *user, switch_event_t *params)
 
uint32_t switch_xml_clear_user_cache (const char *key, const char *user_name, const char *domain_name)
 
void switch_xml_merge_user (switch_xml_t user, switch_xml_t domain, switch_xml_t group)
 
switch_xml_t switch_xml_dup (switch_xml_t xml)
 
switch_xml_t switch_xml_open_cfg (_In_z_ const char *file_path, _Out_ switch_xml_t *node, _In_opt_ switch_event_t *params)
 open a config in the core registry More...
 
void switch_xml_set_binding_sections (_In_ switch_xml_binding_t *binding, _In_ switch_xml_section_t sections)
 bind a search function to an external gateway More...
 
void switch_xml_set_binding_user_data (_In_ switch_xml_binding_t *binding, _In_opt_ void *user_data)
 
switch_xml_section_t switch_xml_get_binding_sections (_In_ switch_xml_binding_t *binding)
 
void * switch_xml_get_binding_user_data (_In_ switch_xml_binding_t *binding)
 
switch_status_t switch_xml_bind_search_function_ret (_In_ switch_xml_search_function_t function, _In_ switch_xml_section_t sections, _In_opt_ void *user_data, switch_xml_binding_t **ret_binding)
 
switch_status_t switch_xml_unbind_search_function (_In_ switch_xml_binding_t **binding)
 
switch_status_t switch_xml_unbind_search_function_ptr (_In_ switch_xml_search_function_t function)
 
switch_xml_section_t switch_xml_parse_section_string (_In_opt_z_ const char *str)
 parse a string for a list of sections More...
 
int switch_xml_std_datetime_check (switch_xml_t xcond, int *offset, const char *tzname)
 
switch_status_t switch_xml_locate_language (switch_xml_t *root, switch_xml_t *node, switch_event_t *params, switch_xml_t *language, switch_xml_t *phrases, switch_xml_t *macros, const char *str_language)
 

Macro Definition Documentation

◆ USE_UTF_8_ENCODING

#define USE_UTF_8_ENCODING   SWITCH_TRUE

Definition at line 61 of file switch_xml.h.