pacemaker
2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
|
#include <crm_internal.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <bzlib.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xmlIO.h>
#include <crm/crm.h>
#include <crm/msg_xml.h>
#include <crm/common/xml.h>
#include <crm/common/xml_internal.h>
#include "crmcommon_private.h"
#include <crm/common/xml_compat.h>
Go to the source code of this file.
Macros | |
#define | XML_PARSER_DEBUG 0 |
#define | PCMK__XML_PARSE_OPTS_WITHOUT_RECOVER (XML_PARSE_NOBLANKS) |
#define | PCMK__XML_PARSE_OPTS_WITH_RECOVER (XML_PARSE_NOBLANKS | XML_PARSE_RECOVER) |
#define | XML_DOC_PRIVATE_MAGIC 0x81726354UL |
#define | XML_NODE_PRIVATE_MAGIC 0x54637281UL |
#define | attr_matches(c, n, v) |
#define | XPATH_MAX 512 |
Functions | |
bool | pcmk__tracking_xml_changes (xmlNode *xml, bool lazy) |
void | pcmk__set_xml_doc_flag (xmlNode *xml, enum xml_private_flags flag) |
void | pcmk__mark_xml_node_dirty (xmlNode *xml) |
void | pcmk__mark_xml_created (xmlNode *xml) |
void | xml_track_changes (xmlNode *xml, const char *user, xmlNode *acl_source, bool enforce_acls) |
bool | xml_tracking_changes (xmlNode *xml) |
bool | xml_document_dirty (xmlNode *xml) |
int | pcmk__xml_position (const xmlNode *xml, enum xml_private_flags ignore_if_set) |
xmlNode * | pcmk__xml_match (const xmlNode *haystack, const xmlNode *needle, bool exact) |
void | xml_accept_changes (xmlNode *xml) |
xmlNode * | find_xml_node (const xmlNode *root, const char *search_path, gboolean must_find) |
xmlNode * | pcmk__xe_match (const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v) |
void | copy_in_properties (xmlNode *target, const xmlNode *src) |
void | fix_plus_plus_recursive (xmlNode *target) |
Parse integer assignment statements on this node and all its child nodes. More... | |
void | expand_plus_plus (xmlNode *target, const char *name, const char *value) |
Update current XML attribute value per parsed integer assignment statement. More... | |
void | pcmk__xe_remove_matching_attrs (xmlNode *element, bool(*match)(xmlAttrPtr, void *), void *user_data) |
xmlNode * | add_node_copy (xmlNode *parent, xmlNode *src_node) |
xmlNode * | create_xml_node (xmlNode *parent, const char *name) |
xmlNode * | pcmk_create_xml_text_node (xmlNode *parent, const char *name, const char *content) |
xmlNode * | pcmk_create_html_node (xmlNode *parent, const char *element_name, const char *id, const char *class_name, const char *text) |
void | pcmk_free_xml_subtree (xmlNode *xml) |
void | free_xml (xmlNode *child) |
xmlNode * | copy_xml (xmlNode *src) |
xmlNode * | string2xml (const char *input) |
xmlNode * | stdin2xml (void) |
void | pcmk__strip_xml_text (xmlNode *xml) |
xmlNode * | filename2xml (const char *filename) |
const char * | pcmk__xe_add_last_written (xmlNode *xe) |
void | crm_xml_sanitize_id (char *id) |
Sanitize a string so it is usable as an XML ID. More... | |
void | crm_xml_set_id (xmlNode *xml, const char *format,...) |
Set the ID of an XML element using a format. More... | |
int | write_xml_fd (const xmlNode *xml, const char *filename, int fd, gboolean compress) |
Write XML to a file descriptor. More... | |
int | write_xml_file (const xmlNode *xml, const char *filename, gboolean compress) |
Write XML to a file. More... | |
char * | crm_xml_escape (const char *text) |
Replace special characters with their XML escape sequences. More... | |
void | pcmk__xml2text (const xmlNode *data, uint32_t options, GString *buffer, int depth) |
char * | dump_xml_formatted_with_text (const xmlNode *xml) |
char * | dump_xml_formatted (const xmlNode *xml) |
char * | dump_xml_unformatted (const xmlNode *xml) |
int | pcmk__xml2fd (int fd, xmlNode *cur) |
void | xml_remove_prop (xmlNode *obj, const char *name) |
void | save_xml_to_file (const xmlNode *xml, const char *desc, const char *filename) |
void | xml_calculate_significant_changes (xmlNode *old_xml, xmlNode *new_xml) |
void | xml_calculate_changes (xmlNode *old_xml, xmlNode *new_xml) |
gboolean | can_prune_leaf (xmlNode *xml_node) |
xmlNode * | pcmk__xc_match (const xmlNode *root, const xmlNode *search_comment, bool exact) |
void | pcmk__xc_update (xmlNode *parent, xmlNode *target, xmlNode *update) |
void | pcmk__xml_update (xmlNode *parent, xmlNode *target, xmlNode *update, bool as_diff) |
gboolean | update_xml_child (xmlNode *child, xmlNode *to_update) |
int | find_xml_children (xmlNode **children, xmlNode *root, const char *tag, const char *field, const char *value, gboolean search_matches) |
gboolean | replace_xml_child (xmlNode *parent, xmlNode *child, xmlNode *update, gboolean delete_only) |
xmlNode * | sorted_xml (xmlNode *input, xmlNode *parent, gboolean recursive) |
xmlNode * | first_named_child (const xmlNode *parent, const char *name) |
xmlNode * | crm_next_same_xml (const xmlNode *sibling) |
Get next instance of same XML tag. More... | |
void | crm_xml_init (void) |
Initialize the CRM XML subsystem. More... | |
void | crm_xml_cleanup (void) |
xmlNode * | expand_idref (xmlNode *input, xmlNode *top) |
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) |
void | pcmk__xe_set_props (xmlNodePtr node,...) |
int | pcmk__xe_foreach_child (xmlNode *xml, const char *child_element_name, int(*handler)(xmlNode *xml, void *userdata), void *userdata) |
xmlNode * | find_entity (xmlNode *parent, const char *node_name, const char *id) |
void | crm_destroy_xml (gpointer data) |
xmlDoc * | getDocPtr (xmlNode *node) |
int | add_node_nocopy (xmlNode *parent, const char *name, xmlNode *child) |
gboolean | xml_has_children (const xmlNode *xml_root) |
#define attr_matches | ( | c, | |
n, | |||
v | |||
) |
#define PCMK__XML_PARSE_OPTS_WITH_RECOVER (XML_PARSE_NOBLANKS | XML_PARSE_RECOVER) |
#define PCMK__XML_PARSE_OPTS_WITHOUT_RECOVER (XML_PARSE_NOBLANKS) |
xmlNode* add_node_copy | ( | xmlNode * | parent, |
xmlNode * | src_node | ||
) |
int add_node_nocopy | ( | xmlNode * | parent, |
const char * | name, | ||
xmlNode * | child | ||
) |
void copy_in_properties | ( | xmlNode * | target, |
const xmlNode * | src | ||
) |
xmlNode* create_xml_node | ( | xmlNode * | parent, |
const char * | name | ||
) |
void crm_destroy_xml | ( | gpointer | data | ) |
xmlNode* crm_next_same_xml | ( | const xmlNode * | sibling | ) |
char* crm_xml_escape | ( | const char * | text | ) |
void crm_xml_init | ( | void | ) |
void crm_xml_sanitize_id | ( | char * | id | ) |
void crm_xml_set_id | ( | xmlNode * | xml, |
const char * | format, | ||
... | |||
) |
void expand_plus_plus | ( | xmlNode * | target, |
const char * | name, | ||
const char * | value | ||
) |
Update current XML attribute value per parsed integer assignment statement.
[in,out] | target | an XML node, containing a XML attribute that is initialized to some numeric value, to be processed |
[in] | name | name of the XML attribute, e.g. X, whose value should be updated |
[in] | value | assignment statement, e.g. "X++" or "X+=5", to be applied to the initialized value. |
xmlNode* find_entity | ( | xmlNode * | parent, |
const char * | node_name, | ||
const char * | id | ||
) |
int find_xml_children | ( | xmlNode ** | children, |
xmlNode * | root, | ||
const char * | tag, | ||
const char * | field, | ||
const char * | value, | ||
gboolean | search_matches | ||
) |
xmlNode* find_xml_node | ( | const xmlNode * | root, |
const char * | search_path, | ||
gboolean | must_find | ||
) |
xmlNode* first_named_child | ( | const xmlNode * | parent, |
const char * | name | ||
) |
void fix_plus_plus_recursive | ( | xmlNode * | target | ) |
xmlDoc* getDocPtr | ( | xmlNode * | node | ) |
void pcmk__set_xml_doc_flag | ( | xmlNode * | xml, |
enum xml_private_flags | flag | ||
) |
xmlNode* pcmk__xc_match | ( | const xmlNode * | root, |
const xmlNode * | search_comment, | ||
bool | exact | ||
) |
void pcmk__xc_update | ( | xmlNode * | parent, |
xmlNode * | target, | ||
xmlNode * | update | ||
) |
int pcmk__xe_foreach_child | ( | xmlNode * | xml, |
const char * | child_element_name, | ||
int(*)(xmlNode *xml, void *userdata) | handler, | ||
void * | userdata | ||
) |
xmlNode* pcmk__xe_match | ( | const xmlNode * | parent, |
const char * | node_name, | ||
const char * | attr_n, | ||
const char * | attr_v | ||
) |
void pcmk__xe_remove_matching_attrs | ( | xmlNode * | element, |
bool(*)(xmlAttrPtr, void *) | match, | ||
void * | user_data | ||
) |
void pcmk__xml2text | ( | const xmlNode * | data, |
uint32_t | options, | ||
GString * | buffer, | ||
int | depth | ||
) |
char* pcmk__xml_artefact_path | ( | enum pcmk__xml_artefact_ns | ns, |
const char * | filespec | ||
) |
char* pcmk__xml_artefact_root | ( | enum pcmk__xml_artefact_ns | ns | ) |
xmlNode* pcmk__xml_match | ( | const xmlNode * | haystack, |
const xmlNode * | needle, | ||
bool | exact | ||
) |
int pcmk__xml_position | ( | const xmlNode * | xml, |
enum xml_private_flags | ignore_if_set | ||
) |
void pcmk__xml_update | ( | xmlNode * | parent, |
xmlNode * | target, | ||
xmlNode * | update, | ||
bool | as_diff | ||
) |
xmlNode* pcmk_create_html_node | ( | xmlNode * | parent, |
const char * | element_name, | ||
const char * | id, | ||
const char * | class_name, | ||
const char * | text | ||
) |
xmlNode* pcmk_create_xml_text_node | ( | xmlNode * | parent, |
const char * | name, | ||
const char * | content | ||
) |
void pcmk_free_xml_subtree | ( | xmlNode * | xml | ) |
gboolean replace_xml_child | ( | xmlNode * | parent, |
xmlNode * | child, | ||
xmlNode * | update, | ||
gboolean | delete_only | ||
) |
void save_xml_to_file | ( | const xmlNode * | xml, |
const char * | desc, | ||
const char * | filename | ||
) |
xmlNode* sorted_xml | ( | xmlNode * | input, |
xmlNode * | parent, | ||
gboolean | recursive | ||
) |
gboolean update_xml_child | ( | xmlNode * | child, |
xmlNode * | to_update | ||
) |
int write_xml_fd | ( | const xmlNode * | xml, |
const char * | filename, | ||
int | fd, | ||
gboolean | compress | ||
) |
Write XML to a file descriptor.
[in] | xml | XML to write |
[in] | filename | Name of file being written (for logging only) |
[in] | fd | Open file descriptor corresponding to filename |
[in] | compress | Whether to compress XML before writing |
int write_xml_file | ( | const xmlNode * | xml, |
const char * | filename, | ||
gboolean | compress | ||
) |
void xml_calculate_changes | ( | xmlNode * | old_xml, |
xmlNode * | new_xml | ||
) |
void xml_calculate_significant_changes | ( | xmlNode * | old_xml, |
xmlNode * | new_xml | ||
) |
gboolean xml_has_children | ( | const xmlNode * | root | ) |
void xml_track_changes | ( | xmlNode * | xml, |
const char * | user, | ||
xmlNode * | acl_source, | ||
bool | enforce_acls | ||
) |