10 #ifndef PCMK__CRM_COMMON_XML_INTERNAL__H    11 #define PCMK__CRM_COMMON_XML_INTERNAL__H    32 #include <libxml/relaxng.h>    81 #define PCMK__XML_LOG_BASE(priority, dechunk, postemit, prefix, fmt, ap)        \    83     if (!(dechunk) && (prefix) == NULL) {                       \    84         qb_log_from_external_source_va(__func__, __FILE__, (fmt),               \    85                                        (priority), __LINE__, 0, (ap));          \    89         char *CXLB_buf = NULL;                                                  \    90         static int CXLB_buffer_len = 0;                                         \    91         static char *CXLB_buffer = NULL;                                        \    92         static uint8_t CXLB_priority = 0;                                       \    94         CXLB_len = vasprintf(&CXLB_buf, (fmt), (ap));                           \    96         if (CXLB_len <= 0 || CXLB_buf[CXLB_len - 1] == '\n' || !(dechunk)) {    \    98                 CXLB_buf = (char *) "LOG CORRUPTION HAZARD"; \    99                 CXLB_priority = QB_MIN(CXLB_priority, LOG_ERR);                 \   100             } else if (CXLB_len > 0                           \   101                        && CXLB_buf[CXLB_len - 1] == '\n') {                     \   102                 CXLB_buf[CXLB_len - 1] = '\0';                                  \   105                 qb_log_from_external_source(__func__, __FILE__, "%s%s%s",       \   106                                             CXLB_priority, __LINE__, 0,         \   107                                             (prefix) != NULL ? (prefix) : "",   \   108                                             CXLB_buffer, CXLB_buf);             \   111                 qb_log_from_external_source(__func__, __FILE__, "%s%s",         \   112                                             (priority), __LINE__, 0,            \   113                                             (prefix) != NULL ? (prefix) : "",   \   116             if (CXLB_len < 0) {                                                 \   119             CXLB_buffer = NULL;                                                 \   120             CXLB_buffer_len = 0;                                                \   123         } else if (CXLB_buffer == NULL) {                                       \   124             CXLB_buffer_len = CXLB_len;                                         \   125             CXLB_buffer = CXLB_buf;                                             \   127             CXLB_priority = (priority);     \   130             CXLB_buffer = realloc(CXLB_buffer, 1 + CXLB_buffer_len + CXLB_len); \   131             memcpy(CXLB_buffer + CXLB_buffer_len, CXLB_buf, CXLB_len);          \   132             CXLB_buffer_len += CXLB_len;                                        \   133             CXLB_buffer[CXLB_buffer_len] = '\0';                                \   134             CXLB_priority = QB_MIN(CXLB_priority, (priority));   \   169                    int depth, uint32_t options);
   175 #define PCMK__XP_MEMBER_NODE_CONFIG                                 \   176     "//" PCMK_XE_CIB "/" PCMK_XE_CONFIGURATION "/" PCMK_XE_NODES    \   178     "[not(@" PCMK_XA_TYPE ") or @" PCMK_XA_TYPE "='" PCMK_VALUE_MEMBER "']"   181 #define PCMK__XP_GUEST_NODE_CONFIG \   182     "//" PCMK_XE_CIB "//" PCMK_XE_CONFIGURATION "//" PCMK_XE_PRIMITIVE  \   183     "//" PCMK_XE_META_ATTRIBUTES "//" PCMK_XE_NVPAIR                    \   184     "[@" PCMK_XA_NAME "='" PCMK_META_REMOTE_NODE "']"   187 #define PCMK__XP_REMOTE_NODE_CONFIG                                     \   188     "//" PCMK_XE_CIB "//" PCMK_XE_CONFIGURATION "//" PCMK_XE_PRIMITIVE  \   189     "[@" PCMK_XA_TYPE "='" PCMK_VALUE_REMOTE "']"                       \   190     "[@" PCMK_XA_PROVIDER "='pacemaker']"   193 #define PCMK__XP_REMOTE_NODE_STATUS                                 \   194     "//" PCMK_XE_CIB "//" PCMK_XE_STATUS "//" PCMK__XE_NODE_STATE   \   195     "[@" PCMK_XA_REMOTE_NODE "='" PCMK_VALUE_TRUE "']"   311                               const char *filespec);
   321 static inline xmlNode *
   322 pcmk__xml_first_child(
const xmlNode *
parent)
   326     while (child && (child->type == XML_TEXT_NODE)) {
   340 static inline xmlNode *
   341 pcmk__xml_next(
const xmlNode *child)
   343     xmlNode *next = (child? child->next : NULL);
   345     while (next && (next->type == XML_TEXT_NODE)) {
   431 static inline const char *
   432 pcmk__xml_attr_value(
const xmlAttr *attr)
   434     return ((attr == NULL) || (attr->children == NULL))? NULL
   435            : (
const char *) attr->children->content;
   450                                    const char *element);
   456 #endif // PCMK__CRM_COMMON_XML_INTERNAL__H char * pcmk__xml_artefact_root(enum pcmk__xml_artefact_ns ns)
 
xmlNode * pcmk__xml_copy(xmlNode *parent, xmlNode *src)
 
char * pcmk__xml_escape(const char *text, enum pcmk__xml_escape_type type)
 
enum pcmk_ipc_server type
 
bool pcmk__xml_needs_escape(const char *text, enum pcmk__xml_escape_type type)
 
void pcmk__xml_init(void)
 
Exclude certain XML attributes (for calculating digests) 
 
Include the opening tag of an XML element, and include XML comments. 
 
void pcmk__set_xml_doc_flag(xmlNode *xml, enum xml_private_flags flag)
 
char * pcmk__xpath_node_id(const char *xpath, const char *node)
 
Include indentation and newlines. 
 
void pcmk__xml_free(xmlNode *xml)
 
Formatted output for pacemaker tools. 
 
void pcmk__strip_xml_text(xmlNode *xml)
 
void pcmk__xml_cleanup(void)
 
Include the children of an XML element. 
 
Defined string constants for XML element and attribute names. 
 
int pcmk__xml_show(pcmk__output_t *out, const char *prefix, const xmlNode *data, int depth, uint32_t options)
 
Include the closing tag of an XML element. 
 
int pcmk__xml_show_changes(pcmk__output_t *out, const xmlNode *xml)
 
This structure contains everything that makes up a single output formatter. 
 
void pcmk__xml_free_doc(xmlDoc *doc)
 
bool pcmk__xml_tree_foreach(xmlNode *xml, bool(*fn)(xmlNode *, void *), void *user_data)
 
GString * pcmk__element_xpath(const xmlNode *xml)
 
void pcmk__warn_multiple_name_matches(pcmk__output_t *out, xmlNode *search, const char *name)
 
bool pcmk__cib_element_in_patchset(const xmlNode *patchset, const char *element)
 
void pcmk__xml_sanitize_id(char *id)
 
char * pcmk__xml_artefact_path(enum pcmk__xml_artefact_ns ns, const char *filespec)
 
Don't overwrite existing values.