pacemaker  2.1.0-7c3f660
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions | Variables
xml_internal.h File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <crm/crm.h>
Include dependency graph for xml_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PCMK__XML_LOG_BASE(priority, dechunk, postemit, prefix, fmt, ap)
 Base for directing lib{xml2,xslt} log into standard libqb backend. More...
 
#define PCMK__XP_MEMBER_NODE_CONFIG
 
#define PCMK__XP_GUEST_NODE_CONFIG
 
#define PCMK__XP_REMOTE_NODE_CONFIG
 
#define PCMK__XP_REMOTE_NODE_STATUS
 

Enumerations

enum  pcmk__xml_artefact_ns { pcmk__xml_artefact_ns_legacy_rng = 1, pcmk__xml_artefact_ns_legacy_xslt, pcmk__xml_artefact_ns_base_rng, pcmk__xml_artefact_ns_base_xslt }
 

Functions

void pcmk__strip_xml_text (xmlNode *xml)
 
const char * pcmk__xe_add_last_written (xmlNode *xe)
 
xmlNode * pcmk__xe_match (xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
 
void pcmk__xe_remove_matching_attrs (xmlNode *element, bool(*match)(xmlAttrPtr, void *), void *user_data)
 
char * pcmk__xml_artefact_root (enum pcmk__xml_artefact_ns ns)
 
char * pcmk__xml_artefact_path (enum pcmk__xml_artefact_ns ns, const char *filespec)
 
void pcmk__xe_set_propv (xmlNodePtr node, va_list pairs)
 
char * pcmk__xpath_node_id (const char *xpath, const char *node)
 

Variables

void G_GNUC_NULL_TERMINATED
 

Macro Definition Documentation

#define PCMK__XML_LOG_BASE (   priority,
  dechunk,
  postemit,
  prefix,
  fmt,
  ap 
)

Base for directing lib{xml2,xslt} log into standard libqb backend.

This macro implements the core of what can be needed for directing libxml2 or libxslt error messaging into standard, preconfigured libqb-backed log stream.

It's a bit unfortunate that libxml2 (and more sparsely, also libxslt) emits a single message by chunks (location is emitted separatedly from the message itself), so we have to take the effort to combine these chunks back to single message. Whether to do this or not is driven with dechunk toggle.

The form of a macro was chosen for implicit deriving of FILE, etc. and also because static dechunking buffer should be differentiated per library (here we assume different functions referring to this macro will not ever be using both at once), preferably also per-library context of use to avoid clashes altogether.

Note that we cannot use qb_logt, because callsite data have to be known at the moment of compilation, which it is not always the case – xml_log (and unfortunately there's no clear explanation of the fail to compile).

Also note that there's no explicit guard against said libraries producing never-newline-terminated chunks (which would just keep consuming memory), as it's quite improbable. Termination of the program in between the same-message chunks will raise a flag with valgrind and the likes, though.

And lastly, regarding how dechunking combines with other non-message parameters – for priority, most important running specification wins (possibly elevated to LOG_ERR in case of nonconformance with the newline-termination "protocol"), dechunk is expected to always be on once it was at the start, and the rest (postemit and prefix) are picked directly from the last chunk entry finalizing the message (also reasonable to always have it the same with all related entries).

Parameters
[in]prioritySyslog priority for the message to be logged
[in]dechunkWhether to dechunk new-line terminated message
[in]postemitCode to be executed once message is sent out
[in]prefixHow to prefix the message or NULL for raw passing
[in]fmtFormat string as with printf-like functions
[in]apVariable argument list to supplement fmt format string

Definition at line 67 of file xml_internal.h.

#define PCMK__XP_GUEST_NODE_CONFIG
Value:
"[@name='" XML_RSC_ATTR_REMOTE_NODE "']"
#define XML_CIB_TAG_NVPAIR
Definition: msg_xml.h:200
#define XML_CIB_TAG_RESOURCE
Definition: msg_xml.h:214
#define XML_TAG_META_SETS
Definition: msg_xml.h:204
#define XML_RSC_ATTR_REMOTE_NODE
Definition: msg_xml.h:244
#define XML_TAG_CIB
Definition: msg_xml.h:109
#define XML_CIB_TAG_CONFIGURATION
Definition: msg_xml.h:178

Definition at line 134 of file xml_internal.h.

#define PCMK__XP_MEMBER_NODE_CONFIG
Value:
"/" XML_CIB_TAG_NODE "[not(@type) or @type='member']"
#define XML_CIB_TAG_NODES
Definition: msg_xml.h:181
#define XML_CIB_TAG_NODE
Definition: msg_xml.h:199
#define XML_TAG_CIB
Definition: msg_xml.h:109
#define XML_CIB_TAG_CONFIGURATION
Definition: msg_xml.h:178

Definition at line 129 of file xml_internal.h.

#define PCMK__XP_REMOTE_NODE_CONFIG
Value:
"[@type='remote'][@provider='pacemaker']"
#define XML_CIB_TAG_RESOURCE
Definition: msg_xml.h:214
#define XML_TAG_CIB
Definition: msg_xml.h:109
#define XML_CIB_TAG_CONFIGURATION
Definition: msg_xml.h:178

Definition at line 140 of file xml_internal.h.

#define PCMK__XP_REMOTE_NODE_STATUS
Value:
"[@" XML_NODE_IS_REMOTE "='true']"
#define XML_CIB_TAG_STATE
Definition: msg_xml.h:198
#define XML_NODE_IS_REMOTE
Definition: msg_xml.h:279
#define XML_TAG_CIB
Definition: msg_xml.h:109
#define XML_CIB_TAG_STATUS
Definition: msg_xml.h:179

Definition at line 145 of file xml_internal.h.

Enumeration Type Documentation

Enumerator
pcmk__xml_artefact_ns_legacy_rng 
pcmk__xml_artefact_ns_legacy_xslt 
pcmk__xml_artefact_ns_base_rng 
pcmk__xml_artefact_ns_base_xslt 

Definition at line 149 of file xml_internal.h.

Function Documentation

void pcmk__strip_xml_text ( xmlNode *  xml)

Definition at line 1015 of file xml.c.

const char* pcmk__xe_add_last_written ( xmlNode *  xe)

Definition at line 1113 of file xml.c.

xmlNode* pcmk__xe_match ( xmlNode *  parent,
const char *  node_name,
const char *  attr_n,
const char *  attr_v 
)

Definition at line 496 of file xml.c.

void pcmk__xe_remove_matching_attrs ( xmlNode *  element,
bool(*)(xmlAttrPtr, void *)  match,
void *  user_data 
)

Definition at line 630 of file xml.c.

void pcmk__xe_set_propv ( xmlNodePtr  node,
va_list  pairs 
)

Definition at line 2952 of file xml.c.

char* pcmk__xml_artefact_path ( enum pcmk__xml_artefact_ns  ns,
const char *  filespec 
)

Definition at line 2930 of file xml.c.

char* pcmk__xml_artefact_root ( enum pcmk__xml_artefact_ns  ns)

Definition at line 2902 of file xml.c.

char* pcmk__xpath_node_id ( const char *  xpath,
const char *  node 
)

Definition at line 303 of file xpath.c.

Variable Documentation

void G_GNUC_NULL_TERMINATED

Definition at line 283 of file xml_internal.h.