Asterisk - The Open Source Telephony Project
18.5.0
|
Go to the source code of this file.
Macros | |
#define | AST_PJSIP_XML_PROLOG_LEN 39 |
Length of the XML prolog when printing presence or other XML in PJSIP. More... | |
Enumerations | |
enum | ast_sip_pidf_state { NOTIFY_OPEN, NOTIFY_INUSE, NOTIFY_CLOSED } |
Functions | |
void | ast_sip_presence_exten_state_to_str (int state, char **statestring, char **pidfstate, char **pidfnote, enum ast_sip_pidf_state *local_state, unsigned int notify_early_inuse_ringing) |
Convert extension state to relevant PIDF strings. More... | |
pj_xml_attr * | ast_sip_presence_xml_create_attr (pj_pool_t *pool, pj_xml_node *node, const char *name, const char *value) |
Create XML attribute. More... | |
pj_xml_node * | ast_sip_presence_xml_create_node (pj_pool_t *pool, pj_xml_node *parent, const char *name) |
Create XML node. More... | |
void | ast_sip_presence_xml_find_node_attr (pj_pool_t *pool, pj_xml_node *parent, const char *node_name, const char *attr_name, pj_xml_node **node, pj_xml_attr **attr) |
Find an attribute within a given node. More... | |
void | ast_sip_sanitize_xml (const char *input, char *output, size_t len) |
Replace offensive XML characters with XML entities. More... | |
#define AST_PJSIP_XML_PROLOG_LEN 39 |
Length of the XML prolog when printing presence or other XML in PJSIP.
When calling any variant of pj_xml_print(), the documentation claims that it will return -1 if the provided buffer is not large enough. However, if the XML prolog is requested to be printed and the buffer is not large enough, then it will return -1 only if the buffer is not large enough to hold the XML prolog or return the length of the XML prolog on failure instead of -1.
This constant is useful to check against when trying to determine if printing XML succeeded or failed.
Definition at line 36 of file res_pjsip_presence_xml.h.
Referenced by dialog_info_to_string(), pidf_to_string(), rlmi_print_body(), and xpidf_to_string().
enum ast_sip_pidf_state |
PIDF state
Enumerator | |
---|---|
NOTIFY_OPEN | Device is not in use |
NOTIFY_INUSE | Device is in use or ringing |
NOTIFY_CLOSED | Device is unavailable, on hold, or busy |
Definition at line 41 of file res_pjsip_presence_xml.h.
void ast_sip_presence_exten_state_to_str | ( | int | state, |
char ** | statestring, | ||
char ** | pidfstate, | ||
char ** | pidfnote, | ||
enum ast_sip_pidf_state * | local_state, | ||
unsigned int | notify_early_inuse_ringing | ||
) |
Convert extension state to relevant PIDF strings.
state | The extension state | |
[out] | statestring | |
[out] | pidfstate | |
[out] | pidfnote | |
[out] | local_state |
Definition at line 84 of file presence_xml.c.
References AST_EXTENSION_BUSY, AST_EXTENSION_INUSE, AST_EXTENSION_NOT_INUSE, AST_EXTENSION_ONHOLD, AST_EXTENSION_RINGING, AST_EXTENSION_UNAVAILABLE, NOTIFY_CLOSED, NOTIFY_INUSE, and NOTIFY_OPEN.
Referenced by dialog_info_generate_body_content(), pidf_generate_body_content(), pidf_supplement_body(), and xpidf_generate_body_content().
pj_xml_attr* ast_sip_presence_xml_create_attr | ( | pj_pool_t * | pool, |
pj_xml_node * | node, | ||
const char * | name, | ||
const char * | value | ||
) |
Create XML attribute.
pool | Allocation pool |
node | Node to add attribute to |
name | The attribute name |
value | The attribute value |
Definition at line 140 of file presence_xml.c.
Referenced by add_eyebeam(), add_rlmi_resource(), ast_sip_presence_xml_find_node_attr(), build_rlmi_body(), dialog_info_generate_body_content(), pidf_supplement_body(), and xpidf_generate_body_content().
pj_xml_node* ast_sip_presence_xml_create_node | ( | pj_pool_t * | pool, |
pj_xml_node * | parent, | ||
const char * | name | ||
) |
Create XML node.
pool | Allocation pool |
parent | Optional node that will be parent to the created node |
name | The name for the new node |
Definition at line 152 of file presence_xml.c.
References NULL.
Referenced by add_eyebeam(), add_rlmi_resource(), ast_sip_presence_xml_find_node_attr(), build_rlmi_body(), dialog_info_allocate_body(), dialog_info_generate_body_content(), and pidf_supplement_body().
void ast_sip_presence_xml_find_node_attr | ( | pj_pool_t * | pool, |
pj_xml_node * | parent, | ||
const char * | node_name, | ||
const char * | attr_name, | ||
pj_xml_node ** | node, | ||
pj_xml_attr ** | attr | ||
) |
Find an attribute within a given node.
Given a starting node, this will find an attribute that belongs to a specific node. If the node does not exist, it will be created under the passed-in parent. If the attribute does not exist, then it will be created on the node with an empty string as its value.
pool | Allocation pool | |
parent | Starting node for search | |
node_name | Name of node where to find attribute | |
attr_name | Name of attribute to find | |
[out] | node | Node that was found or created |
[out] | attr | Attribute that was found or created |
Definition at line 172 of file presence_xml.c.
References ast_sip_presence_xml_create_attr(), ast_sip_presence_xml_create_node(), name, and NULL.
Referenced by xpidf_generate_body_content().
void ast_sip_sanitize_xml | ( | const char * | input, |
char * | output, | ||
size_t | len | ||
) |
Replace offensive XML characters with XML entities.
" = " < = <
= >
' = ' & = &
input | String to sanitize | |
[out] | output | Sanitized string |
len | Size of output buffer |
Definition at line 29 of file presence_xml.c.
References ast_strdupa, and copy().
Referenced by AST_TEST_DEFINE(), dialog_info_generate_body_content(), pidf_generate_body_content(), pidf_supplement_body(), and xpidf_generate_body_content().