 |
pacemaker
2.0.4-2deceaa3ae
Scalable High-Availability cluster resource manager
|
Go to the documentation of this file.
10 #ifndef CRM_COMMON_XML__H
11 # define CRM_COMMON_XML__H
24 # include <sys/types.h>
31 # include <libxml/tree.h>
32 # include <libxml/xpath.h>
45 # define CRM_BZ2_BLOCKS 4
46 # define CRM_BZ2_WORK 20
47 # define CRM_BZ2_THRESHOLD 128 * 1024
49 # define XML_PARANOIA_CHECKS 0
53 gboolean
add_message_xml(xmlNode * msg,
const char *field, xmlNode * xml);
97 const char *class_name,
const char *text);
108 xmlNode *
copy_xml(xmlNode * src_node);
113 xmlNode *
add_node_copy(xmlNode * new_parent, xmlNode * xml_node);
128 int write_xml_fd(xmlNode * xml_node,
const char *filename,
int fd, gboolean compress);
129 int write_xml_file(xmlNode * xml_node,
const char *filename, gboolean compress);
140 xmlNode *
diff_xml_object(xmlNode * left, xmlNode * right, gboolean suppress);
143 gboolean full, gboolean * changed,
const char *marker);
147 gboolean
apply_xml_diff(xmlNode *old_xml, xmlNode *diff, xmlNode **new_xml);
152 xmlNode *
find_xml_node(xmlNode * cib,
const char *node_path, gboolean must_find);
154 xmlNode *
find_entity(xmlNode * parent,
const char *node_name,
const char *
id);
159 gboolean delete_only);
164 const char *tag,
const char *field,
const char *value,
165 gboolean search_matches);
167 xmlNode *
get_xpath_object(
const char *xpath, xmlNode * xml_obj,
int error_level);
170 static inline const char *
171 crm_element_name(
const xmlNode *xml)
173 return xml? (
const char *)(xml->name) : NULL;
176 static inline const char *
177 crm_map_element_name(
const xmlNode *xml)
179 const char *
name = crm_element_name(xml);
196 gboolean
validate_xml(xmlNode * xml_blob,
const char *validation, gboolean to_logs);
237 gboolean transform, gboolean to_logs);
247 static inline xmlNode *
248 __xml_first_child(
const xmlNode *parent)
250 xmlNode *child = parent? parent->children : NULL;
252 while (child && (child->type == XML_TEXT_NODE)) {
258 static inline xmlNode *
259 __xml_next(
const xmlNode *child)
261 xmlNode *next = child? child->next : NULL;
263 while (next && (next->type == XML_TEXT_NODE)) {
269 static inline xmlNode *
270 __xml_first_child_element(
const xmlNode *parent)
272 xmlNode *child = parent? parent->children : NULL;
274 while (child && (child->type != XML_ELEMENT_NODE)) {
280 static inline xmlNode *
281 __xml_next_element(
const xmlNode *child)
283 xmlNode *next = child? child->next : NULL;
285 while (next && (next->type != XML_ELEMENT_NODE)) {
297 xmlNode *
sorted_xml(xmlNode * input, xmlNode * parent, gboolean recursive);
298 xmlXPathObjectPtr
xpath_search(xmlNode * xml_top,
const char *path);
300 void (*helper)(xmlNode*,
void*),
void *user_data);
307 static inline int numXpathResults(xmlXPathObjectPtr xpathObj)
309 if(xpathObj == NULL || xpathObj->nodesetval == NULL) {
312 return xpathObj->nodesetval->nodeNr;
317 void xml_track_changes(xmlNode * xml,
const char *user, xmlNode *acl_source,
bool enforce_acls);
321 void xml_log_changes(uint8_t level,
const char *
function, xmlNode *xml);
326 int format, xmlNode *
source, xmlNode *
target,
bool *config,
bool manage_version);
331 void save_xml_to_file(xmlNode * xml,
const char *desc,
const char *filename);
char * calculate_operation_digest(xmlNode *local_cib, const char *version)
Calculate and return digest of XML operation.
gboolean replace_xml_child(xmlNode *parent, xmlNode *child, xmlNode *update, gboolean delete_only)
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
int find_xml_children(xmlNode **children, xmlNode *root, const char *tag, const char *field, const char *value, gboolean search_matches)
char * dump_xml_unformatted(xmlNode *msg)
void save_xml_to_file(xmlNode *xml, const char *desc, const char *filename)
void xml_log_changes(uint8_t level, const char *function, xmlNode *xml)
int xml_apply_patchset(xmlNode *xml, xmlNode *patchset, bool check_version)
int get_schema_version(const char *name)
int add_node_nocopy(xmlNode *parent, const char *name, xmlNode *child)
bool xml_patch_versions(xmlNode *patchset, int add[3], int del[3])
xmlNode * diff_xml_object(xmlNode *left, xmlNode *right, gboolean suppress)
void xml_calculate_significant_changes(xmlNode *old_xml, xmlNode *new_xml)
xmlDoc * getDocPtr(xmlNode *node)
void pcmk_free_xml_subtree(xmlNode *xml)
xmlNode * create_xml_node(xmlNode *parent, const char *name)
void expand_plus_plus(xmlNode *target, const char *name, const char *value)
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
bool xml_document_dirty(xmlNode *xml)
xmlNode * copy_xml(xmlNode *src_node)
void patchset_process_digest(xmlNode *patch, xmlNode *source, xmlNode *target, bool with_digest)
xmlNode * filename2xml(const char *filename)
int write_xml_file(xmlNode *xml_node, const char *filename, gboolean compress)
Write XML to a file.
void free_xml(xmlNode *child)
xmlXPathObjectPtr xpath_search(xmlNode *xml_top, const char *path)
gboolean update_xml_child(xmlNode *child, xmlNode *to_update)
gboolean xml_has_children(const xmlNode *root)
int write_xml_fd(xmlNode *xml_node, const char *filename, int fd, gboolean compress)
Write XML to a file descriptor.
gboolean add_message_xml(xmlNode *msg, const char *field, xmlNode *xml)
void xml_calculate_changes(xmlNode *old_xml, xmlNode *new_xml)
xmlNode * sorted_xml(xmlNode *input, xmlNode *parent, gboolean recursive)
char * crm_xml_escape(const char *text)
xmlNode * first_named_child(const xmlNode *parent, const char *name)
xmlNode * pcmk_create_html_node(xmlNode *parent, const char *element_name, const char *id, const char *class_name, const char *text)
xmlNode * find_entity(xmlNode *parent, const char *node_name, const char *id)
void purge_diff_markers(xmlNode *a_node)
void crm_xml_set_id(xmlNode *xml, const char *format,...) __attribute__((__format__(__printf__
int update_validation(xmlNode **xml_blob, int *best, int max, gboolean transform, gboolean to_logs)
Update CIB XML to most recent schema version.
enum crm_proc_flag __attribute__
xmlNode * stdin2xml(void)
xmlNode * xml_create_patchset(int format, xmlNode *source, xmlNode *target, bool *config, bool manage_version)
xmlNode * string2xml(const char *input)
xmlNode * expand_idref(xmlNode *input, xmlNode *top)
char * calculate_xml_versioned_digest(xmlNode *input, gboolean sort, gboolean do_filter, const char *version)
Calculate and return digest of XML tree.
void dedupXpathResults(xmlXPathObjectPtr xpathObj)
xmlNode * get_message_xml(xmlNode *msg, const char *field)
xmlNode * getXpathResult(xmlXPathObjectPtr xpathObj, int index)
void xml_track_changes(xmlNode *xml, const char *user, xmlNode *acl_source, bool enforce_acls)
xmlNode * subtract_xml_object(xmlNode *parent, xmlNode *left, xmlNode *right, gboolean full, gboolean *changed, const char *marker)
gboolean validate_xml(xmlNode *xml_blob, const char *validation, gboolean to_logs)
void xml_accept_changes(xmlNode *xml)
char * dump_xml_formatted_with_text(xmlNode *msg)
const typedef xmlChar * pcmkXmlStr
void fix_plus_plus_recursive(xmlNode *target)
void xml_remove_prop(xmlNode *obj, const char *name)
char * xml_get_path(xmlNode *xml)
Functionality for manipulating name/value pairs.
xmlNode * get_xpath_object_relative(const char *xpath, xmlNode *xml_obj, int error_level)
void crm_xml_cleanup(void)
gboolean apply_xml_diff(xmlNode *old_xml, xmlNode *diff, xmlNode **new_xml)
xmlNode * find_xml_node(xmlNode *cib, const char *node_path, gboolean must_find)
const char * xml_latest_schema(void)
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.
gboolean validate_xml_verbose(xmlNode *xml_blob)
void copy_in_properties(xmlNode *target, xmlNode *src)
void xml_log_patchset(uint8_t level, const char *function, xmlNode *xml)
gboolean can_prune_leaf(xmlNode *xml_node)
gboolean cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs)
char * dump_xml_formatted(xmlNode *msg)
const char * get_schema_name(int version)
xmlNode * add_node_copy(xmlNode *new_parent, xmlNode *xml_node)
bool xml_tracking_changes(xmlNode *xml)
void void crm_destroy_xml(gpointer data)
xmlNode destructor which can be used in glib collections
void freeXpathObject(xmlXPathObjectPtr xpathObj)
xmlNode * pcmk_create_xml_text_node(xmlNode *parent, const char *name, const char *content)
char * calculate_on_disk_digest(xmlNode *local_cib)
Calculate and return digest of XML tree, suitable for storing on disk.
void crm_xml_sanitize_id(char *id)
Sanitize a string so it is usable as an XML ID.
void crm_foreach_xpath_result(xmlNode *xml, const char *xpath, void(*helper)(xmlNode *, void *), void *user_data)
Run a supplied function for each result of an xpath search.