FreeSWITCH API Documentation  1.7.0
switch_xml.h
Go to the documentation of this file.
1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Anthony Minessale II <anthm@freeswitch.org>
27  *
28  *
29  * switch_xml.h -- XML PARSER
30  *
31  * Derived from EZXML http://ezxml.sourceforge.net
32  * Original Copyright
33  *
34  * Copyright 2004, 2005 Aaron Voisine <aaron@voisine.org>
35  *
36  * Permission is hereby granted, free of charge, to any person obtaining
37  * a copy of this software and associated documentation files (the
38  * "Software"), to deal in the Software without restriction, including
39  * without limitation the rights to use, copy, modify, merge, publish,
40  * distribute, sublicense, and/or sell copies of the Software, and to
41  * permit persons to whom the Software is furnished to do so, subject to
42  * the following conditions:
43  *
44  * The above copyright notice and this permission notice shall be included
45  * in all copies or substantial portions of the Software.
46  *
47  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
48  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
49  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
50  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
51  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
52  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
53  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
54  */
55 
56 #ifndef FREESWITCH_XML_H
57 #define FREESWITCH_XML_H
58 #include <switch.h>
59 
60 
61 struct switch_xml_binding;
62 
63 ///\defgroup xml1 XML Library Functions
64 ///\ingroup core1
65 ///\{
67 #define SWITCH_XML_BUFSIZE 1024 // size of internal memory buffers
68  typedef enum {
69  SWITCH_XML_ROOT = (1 << 0), // root
70  SWITCH_XML_NAMEM = (1 << 1), // name is malloced
71  SWITCH_XML_TXTM = (1 << 2), // txt is malloced
72  SWITCH_XML_DUP = (1 << 3) // attribute name and value are strduped
74 
75 /*! \brief A representation of an XML tree */
76 struct switch_xml {
77  /*! tag name */
78  char *name;
79  /*! tag attributes { name, value, name, value, ... NULL } */
80  char **attr;
81  /*! tag character content, empty string if none */
82  char *txt;
83  /*! path to free on destroy */
84  char *free_path;
85  /*! tag offset from start of parent tag character content */
87  /*! next tag with same name in this section at this depth */
89  /*! next tag with different name in same section and depth */
91  /*! next tag, same section and depth, in original order */
93  /*! head of sub tag list, NULL if none */
95  /*! parent tag, NULL if current tag is root tag */
97  /*! flags */
98  uint32_t flags;
99  /*! is_switch_xml_root bool */
101  uint32_t refs;
102 };
103 
104 /*!
105  * \brief Parses a string into a switch_xml_t, ensuring the memory will be freed with switch_xml_free
106  * \param s The string to parse
107  * \param dup true if you want the string to be strdup()'d automatically
108  * \return the switch_xml_t or NULL if an error occured
109  */
111 
112 /*!
113  * \brief Parses a string into a switch_xml_t
114  * \param s The string to parse
115  * \return the switch_xml_t or NULL if an error occured
116  */
117 #define switch_xml_parse_str_dup(x) switch_xml_parse_str_dynamic(x, SWITCH_TRUE)
118 
119 ///\brief Given a string of xml data and its length, parses it and creates an switch_xml
120 ///\ structure. For efficiency, modifies the data by adding null terminators
121 ///\ and decoding ampersand sequences. If you don't want this, copy the data and
122 ///\ pass in the copy. Returns NULL on failure.
123 ///\param s a string
124 ///\param len the length of the string
125 ///\return a formated xml node or NULL
127 
128 ///\brief A wrapper for switch_xml_parse_str() that accepts a file descriptor. First
129 ///\ attempts to mem map the file. Failing that, reads the file into memory.
130 ///\ Returns NULL on failure.
131 ///\param fd
132 ///\return a formated xml node or NULL
134 
135 ///\brief a wrapper for switch_xml_parse_fd() that accepts a file name
136 ///\param file a file to parse
137 ///\return a formated xml node or NULL
139 
141 
142 ///\brief Wrapper for switch_xml_parse_str() that accepts a file stream. Reads the entire
143 ///\ stream into memory and then parses it. For xml files, use switch_xml_parse_file()
144 ///\ or switch_xml_parse_fd()
145 ///\param fp a FILE pointer to parse
146 ///\return an xml node or NULL
148 
149 ///\brief returns the first child tag (one level deeper) with the given name or NULL
150 ///\ if not found
151 ///\param xml an xml node
152 ///\param name the name of the child tag
153 ///\return an xml node or NULL
155 
156 ///\brief find a child tag in a node called 'childname' with an attribute 'attrname' which equals 'value'
157 ///\param node the xml node
158 ///\param childname the child tag name
159 ///\param attrname the attribute name
160 ///\param value the value
161 ///\return an xml node or NULL
162 SWITCH_DECLARE(switch_xml_t) switch_xml_find_child(_In_ switch_xml_t node, _In_z_ const char *childname, _In_opt_z_ const char *attrname,
163  _In_opt_z_ const char *value);
165 
166 ///\brief returns the next tag of the same name in the same section and depth or NULL
167 ///\ if not found
168 ///\param xml an xml node
169 ///\return an xml node or NULL
170 #define switch_xml_next(xml) ((xml) ? xml->next : NULL)
171 
172 ///\brief Returns the Nth tag with the same name in the same section at the same depth
173 ///\ or NULL if not found. An index of 0 returns the tag given.
174 ///\param xml the xml node
175 ///\param idx the index
176 ///\return an xml node or NULL
178 
179 ///\brief returns the name of the given tag
180 ///\param xml the xml node
181 ///\return the name
182 #define switch_xml_name(xml) ((xml) ? xml->name : NULL)
183 
184 ///\brief returns the given tag's character content or empty string if none
185 ///\param xml the xml node
186 ///\return the content
187 #define switch_xml_txt(xml) ((xml) ? xml->txt : "")
188 
189 ///\brief returns the value of the requested tag attribute, or NULL if not found
190 ///\param xml the xml node
191 ///\param attr the attribute
192 ///\return the value
193 SWITCH_DECLARE(const char *) switch_xml_attr(_In_opt_ switch_xml_t xml, _In_opt_z_ const char *attr);
194 
195 ///\brief returns the value of the requested tag attribute, or "" if not found
196 ///\param xml the xml node
197 ///\param attr the attribute
198 ///\return the value
199 SWITCH_DECLARE(const char *) switch_xml_attr_soft(_In_ switch_xml_t xml, _In_z_ const char *attr);
200 
201 ///\brief Traverses the switch_xml structure to retrieve a specific subtag. Takes a
202 ///\ variable length list of tag names and indexes. The argument list must be
203 ///\ terminated by either an index of -1 or an empty string tag name. Example:
204 ///\ title = switch_xml_get(library, "shelf", 0, "book", 2, "title", -1);
205 ///\ This retrieves the title of the 3rd book on the 1st shelf of library.
206 ///\ Returns NULL if not found.
207 ///\param xml the xml node
208 ///\return an xml node or NULL
210 
211 ///\brief Converts an switch_xml structure back to xml in html format. Returns a string of html data that
212 ///\ must be freed.
213 ///\param xml the xml node
214 ///\param prn_header add <?xml version..> header too
215 ///\return the ampersanded html text string to display xml
219 
220 ///\brief Converts an switch_xml structure back to xml using the buffer passed in the parameters.
221 ///\param xml the xml node
222 ///\param buf buffer to use
223 ///\param buflen size of buffer
224 ///\param offset offset to start at
225 ///\param prn_header add <?xml version..> header too
226 ///\return the xml text string
228  _In_ switch_bool_t prn_header);
229 
230 ///\brief returns a NULL terminated array of processing instructions for the given
231 ///\ target
232 ///\param xml the xml node
233 ///\param target the instructions
234 ///\return the array
235 SWITCH_DECLARE(const char **) switch_xml_pi(_In_ switch_xml_t xml, _In_z_ const char *target);
236 
237 ///\brief frees the memory allocated for an switch_xml structure
238 ///\param xml the xml node
239 ///\note in the case of the root node the readlock will be lifted
242 
243 ///\brief returns parser error message or empty string if none
244 ///\param xml the xml node
245 ///\return the error string or nothing
247 
248 ///\brief returns a new empty switch_xml structure with the given root tag name
249 ///\param name the name of the new root tag
251 
252 ///\brief wrapper for switch_xml_new() that strdup()s name
253 ///\param name the name of the root
254 ///\return an xml node or NULL
255 #define switch_xml_new_d(name) switch_xml_set_flag(switch_xml_new(strdup(name)), SWITCH_XML_NAMEM)
256 
257 ///\brief Adds a child tag. off is the offset of the child tag relative to the start
258 ///\ of the parent tag's character content. Returns the child tag.
259 ///\param xml the xml node
260 ///\param name the name of the tag
261 ///\param off the offset
262 ///\return an xml node or NULL
264 
265 ///\brief wrapper for switch_xml_add_child() that strdup()s name
266 ///\param xml the xml node
267 ///\param name the name of the child
268 ///\param off the offset
269 #define switch_xml_add_child_d(xml, name, off) \
270  switch_xml_set_flag(switch_xml_add_child(xml, strdup(name), off), SWITCH_XML_NAMEM)
271 
272 ///\brief sets the character content for the given tag and returns the tag
273 ///\param xml the xml node
274 ///\param txt the text
275 ///\return an xml node or NULL
277 
278 ///\brief wrapper for switch_xml_set_txt() that strdup()s txt
279 ///\ sets the character content for the given tag and returns the tag
280 ///\param xml the xml node
281 ///\param txt the text
282 ///\return an xml node or NULL
283 #define switch_xml_set_txt_d(xml, txt) \
284  switch_xml_set_flag(switch_xml_set_txt(xml, strdup(txt)), SWITCH_XML_TXTM)
285 
286 ///\brief Sets the given tag attribute or adds a new attribute if not found. A value
287 ///\ of NULL will remove the specified attribute.
288 ///\param xml the xml node
289 ///\param name the attribute name
290 ///\param value the attribute value
291 ///\return the tag given
292 SWITCH_DECLARE(switch_xml_t) switch_xml_set_attr(switch_xml_t xml, const char *name, const char *value);
293 
294 ///\brief Wrapper for switch_xml_set_attr() that strdup()s name/value. Value cannot be NULL
295 ///\param xml the xml node
296 ///\param name the attribute name
297 ///\param value the attribute value
298 ///\return an xml node or NULL
299 #define switch_xml_set_attr_d(xml, name, value) \
300  switch_xml_set_attr(switch_xml_set_flag(xml, SWITCH_XML_DUP), strdup(name), strdup(switch_str_nil(value)))
301 
302 #define switch_xml_set_attr_d_buf(xml, name, value) \
303  switch_xml_set_attr(switch_xml_set_flag(xml, SWITCH_XML_DUP), strdup(name), strdup(value))
304 
305 ///\brief sets a flag for the given tag and returns the tag
306 ///\param xml the xml node
307 ///\param flag the flag to set
308 ///\return an xml node or NULL
310 
311 ///\brief removes a tag along with its subtags without freeing its memory
312 ///\param xml the xml node
314 
315 ///\brief inserts an existing tag into an ezxml structure
317 
318 ///\brief Moves an existing tag to become a subtag of dest at the given offset from
319 ///\ the start of dest's character content. Returns the moved tag.
320 #define switch_xml_move(xml, dest, off) switch_xml_insert(switch_xml_cut(xml), dest, off)
321 
322 ///\brief removes a tag along with all its subtags
323 #define switch_xml_remove(xml) switch_xml_free(switch_xml_cut(xml))
324 
325 ///\brief set new core xml root
327 
328 ///\brief Set and alternate function for opening xml root
330 
331 ///\brief open the Core xml root
332 ///\param reload if it's is already open close it and open it again as soon as permissable (blocking)
333 ///\param err a pointer to set error strings
334 ///\return the xml root node or NULL
335 SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(_In_ uint8_t reload, _Out_ const char **err);
336 
337 ///\brief initilize the core XML backend
338 ///\param pool a memory pool to use
339 ///\param err a pointer to set error strings
340 ///\return SWITCH_STATUS_SUCCESS if successful
342 
344 
346 
347 ///\brief retrieve the core XML root node
348 ///\return the xml root node
349 ///\note this will cause a readlock on the root until it's released with \see switch_xml_free
351 
352 ///\brief locate an xml pointer in the core registry
353 ///\param section the section to look in
354 ///\param tag_name the type of tag in that section
355 ///\param key_name the name of the key
356 ///\param key_value the value of the key
357 ///\param root a pointer to point at the root node
358 ///\param node a pointer to the requested node
359 ///\param params optional URL formatted params to pass to external gateways
360 ///\return SWITCH_STATUS_SUCCESS if successful root and node will be assigned
362  _In_opt_z_ const char *tag_name,
363  _In_opt_z_ const char *key_name,
364  _In_opt_z_ const char *key_value,
365  _Out_ switch_xml_t *root,
367 
369  _Out_ switch_xml_t *domain);
370 
372  _In_z_ const char *domain_name,
373  _Out_ switch_xml_t *root,
374  _Out_ switch_xml_t *domain, _Out_ switch_xml_t *group, _In_opt_ switch_event_t *params);
375 
377  _In_z_ const char *user_name,
378  _In_z_ const char *domain_name,
379  _In_opt_z_ const char *ip,
380  _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain, _Out_ switch_xml_t *user,
381  _Out_opt_ switch_xml_t *ingroup, _In_opt_ switch_event_t *params);
382 
384  _Out_opt_ switch_xml_t *ingroup);
385 
386 
387 SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_merged(const char *key, const char *user_name, const char *domain_name,
388  const char *ip, switch_xml_t *user, switch_event_t *params);
389 SWITCH_DECLARE(uint32_t) switch_xml_clear_user_cache(const char *key, const char *user_name, const char *domain_name);
391 
393 
394 ///\brief open a config in the core registry
395 ///\param file_path the name of the config section e.g. modules.conf
396 ///\param node a pointer to point to the node if it is found
397 ///\param params optional URL formatted params to pass to external gateways
398 ///\return the root xml node associated with the current request or NULL
400 
401 ///\brief bind a search function to an external gateway
402 ///\param function the search function to bind
403 ///\param sections a bitmask of sections you wil service
404 ///\param user_data a pointer to private data to be used during the callback
405 ///\return SWITCH_STATUS_SUCCESS if successful
406 ///\note gateway functions will be executed in the order they were binded until a success is found else the root registry will be used
407 
412 
414  _In_opt_ void *user_data, switch_xml_binding_t **ret_binding);
415 #define switch_xml_bind_search_function(_f, _s, _u) switch_xml_bind_search_function_ret(_f, _s, _u, NULL)
416 
417 
420 
421 ///\brief parse a string for a list of sections
422 ///\param str a | delimited list of section names
423 ///\return the section mask
425 
426 SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond, int *offset, const char *tzname);
427 
428 SWITCH_DECLARE(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);
429 
431 ///\}
432 #endif // _SWITCH_XML_H
433 /* For Emacs:
434  * Local Variables:
435  * mode:c
436  * indent-tabs-mode:t
437  * tab-width:4
438  * c-basic-offset:4
439  * End:
440  * For VIM:
441  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
442  */
switch_xml_t sibling
Definition: switch_xml.h:90
void switch_xml_free(_In_opt_ switch_xml_t xml)
frees the memory allocated for an switch_xml structure
uint32_t refs
Definition: switch_xml.h:101
char * switch_xml_toxml_buf(_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)
Converts an switch_xml structure back to xml using the buffer passed in the parameters.
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
char * name
Definition: switch_xml.h:78
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 ...
Definition: switch_xml.c:2884
switch_size_t off
Definition: switch_xml.h:86
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)
char * switch_xml_toxml(_In_ switch_xml_t xml, _In_ switch_bool_t prn_header)
Converts an switch_xml structure back to xml in html format. Returns a string of html data that \ mus...
void switch_xml_set_binding_user_data(_In_ switch_xml_binding_t *binding, _In_opt_ void *user_data)
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.
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' ...
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
char * switch_xml_tohtml(_In_ switch_xml_t xml, _In_ switch_bool_t prn_header)
switch_xml_flag_t
Definition: switch_xml.h:68
switch_xml_t switch_xml_find_child_multi(_In_ switch_xml_t node, _In_z_ const char *childname,...)
#define SWITCH_END_EXTERN_C
Definition: switch.h:43
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 char...
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)
Definition: switch_xml.c:3147
switch_xml_t child
Definition: switch_xml.h:94
switch_xml_t(* switch_xml_open_root_function_t)(uint8_t reload, const char **err, void *user_data)
switch_bool_t
Definition: switch_types.h:405
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 ...
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)
Definition: switch_xml.c:2034
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 ...
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
Definition: switch_xml.c:2934
switch_memory_pool_t * pool
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
Representation of an event.
Definition: switch_event.h:80
switch_xml_section_t switch_xml_parse_section_string(_In_opt_z_ const char *str)
parse a string for a list of sections
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
Definition: switch_xml.c:2871
switch_bool_t is_switch_xml_root_t
Definition: switch_xml.h:100
A representation of an XML tree.
Definition: switch_xml.h:76
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
switch_status_t switch_xml_reload(const char **err)
Definition: switch_xml.c:2321
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.
char * txt
Definition: switch_xml.h:82
switch_xml_t switch_xml_dup(switch_xml_t xml)
Definition: switch_xml.c:1862
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)
#define _Out_opt_
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_xml_t switch_xml_open_root(_In_ uint8_t reload, _Out_ const char **err)
open the Core xml root
switch_xml_t next
Definition: switch_xml.h:88
switch_byte_t switch_byte_t * buf
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_unbind_search_function_ptr(_In_ switch_xml_search_function_t function)
int switch_xml_std_datetime_check(switch_xml_t xcond, int *offset, const char *tzname)
Definition: switch_xml.c:2980
uint32_t switch_xml_section_t
Definition: switch_types.h:598
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
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
#define _In_opt_
switch_xml_section_t switch_xml_get_binding_sections(_In_ switch_xml_binding_t *binding)
uintptr_t switch_size_t
switch_xml_t ordered
Definition: switch_xml.h:92
switch_byte_t switch_byte_t uint32_t buflen
#define _In_z_
switch_status_t switch_xml_unbind_search_function(_In_ switch_xml_binding_t **binding)
switch_xml_t parent
Definition: switch_xml.h:96
void * switch_xml_get_binding_user_data(_In_ switch_xml_binding_t *binding)
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...
switch_status_t switch_xml_destroy(void)
Definition: switch_xml.c:2358
uint32_t switch_xml_clear_user_cache(const char *key, const char *user_name, const char *domain_name)
Definition: switch_xml.c:1920
switch_xml_t switch_xml_cut(_In_ switch_xml_t xml)
removes a tag along with its subtags without freeing its memory
#define _Out_
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)
char * free_path
Definition: switch_xml.h:84
switch_xml_t switch_xml_parse_file(_In_z_ const char *file)
a wrapper for switch_xml_parse_fd() that accepts a file name
switch_status_t
Common return values.
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 t...
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
switch_status_t switch_xml_set_root(switch_xml_t new_main)
set new core xml root
Definition: switch_xml.c:2215
Main Library Header.
#define SWITCH_DECLARE(type)
char * switch_xml_toxml_nolock(switch_xml_t xml, _In_ switch_bool_t prn_header)
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 ...
void switch_xml_free_in_thread(_In_ switch_xml_t xml, _In_ int stacksize)
void switch_xml_merge_user(switch_xml_t user, switch_xml_t domain, switch_xml_t group)
Definition: switch_xml.c:1904
char ** attr
Definition: switch_xml.h:80
const char * switch_xml_error(_In_ switch_xml_t xml)
returns parser error message or empty string if none
struct apr_pool_t switch_memory_pool_t
switch_xml_t switch_xml_parse_file_simple(_In_z_ const char *file)
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 ...
Definition: switch_xml.c:1157
#define _In_opt_z_
uint32_t flags
Definition: switch_xml.h:98
switch_xml_t(* switch_xml_search_function_t)(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
switch_status_t switch_xml_init(_In_ switch_memory_pool_t *pool, _Out_ const char **err)
initilize the core XML backend
#define _In_
#define SWITCH_BEGIN_EXTERN_C
Definition: switch.h:42
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.
Definition: switch_xml.c:2241