2 * asterisk -- An open source telephony toolkit.
4 * Copyright (C) 2014, Digium, Inc.
6 * Mark Michelson <mmichelson@digium.com>
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
22 enum ast_sip_pidf_state {
23 /*! Device is not in use */
25 /*! Device is in use or ringing */
27 /*! Device is unavailable, on hold, or busy */
32 * \brief Replace offensive XML characters with XML entities
40 * \param input String to sanitize
41 * \param[out] output Sanitized string
42 * \param len Size of output buffer
44 void ast_sip_sanitize_xml(const char *input, char *output, size_t len);
47 * \brief Convert extension state to relevant PIDF strings
49 * \param state The extension state
50 * \param[out] statestring
51 * \param[out] pidfstate
52 * \param[out] pidfnote
53 * \param[out] local_state
55 void ast_sip_presence_exten_state_to_str(int state, char **statestring,
56 char **pidfstate, char **pidfnote, enum ast_sip_pidf_state *local_state);
59 * \brief Create XML attribute
61 * \param pool Allocation pool
62 * \param node Node to add attribute to
63 * \param name The attribute name
64 * \param value The attribute value
66 * \return The created attribute
68 pj_xml_attr *ast_sip_presence_xml_create_attr(pj_pool_t *pool,
69 pj_xml_node *node, const char *name, const char *value);
72 * \brief Create XML node
74 * \param pool Allocation pool
75 * \param parent Node that will be parent to the created node
76 * \param name The name for the new node
77 * \return The created node
79 pj_xml_node *ast_sip_presence_xml_create_node(pj_pool_t *pool,
80 pj_xml_node *parent, const char* name);
83 * \brief Find an attribute within a given node
85 * Given a starting node, this will find an attribute that belongs
86 * to a specific node. If the node does not exist, it will be created
87 * under the passed-in parent. If the attribute does not exist, then
88 * it will be created on the node with an empty string as its value.
90 * \param pool Allocation pool
91 * \param parent Starting node for search
92 * \param node_name Name of node where to find attribute
93 * \param attr_name Name of attribute to find
94 * \param[out] node Node that was found or created
95 * \param[out] attr Attribute that was found or created
96 * \return The found attribute
98 void ast_sip_presence_xml_find_node_attr(pj_pool_t* pool,
99 pj_xml_node *parent, const char *node_name, const char *attr_name,
100 pj_xml_node **node, pj_xml_attr **attr);