pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
xml_compat.h
Go to the documentation of this file.
1/*
2 * Copyright 2004-2025 the Pacemaker project contributors
3 *
4 * The version control history for this file may have further details.
5 *
6 * This source code is licensed under the GNU Lesser General Public License
7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8 */
9
10#ifndef PCMK__CRM_COMMON_XML_COMPAT__H
11#define PCMK__CRM_COMMON_XML_COMPAT__H
12
13#include <glib.h> // gboolean
14#include <libxml/tree.h> // xmlNode
15#include <libxml/xpath.h> // xmlXPathObject
16
17#include <crm/common/nvpair.h> // crm_xml_add()
18#include <crm/common/xml_names.h> // PCMK_XE_CLONE
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
33// NOTE: sbd (as of at least 1.5.2) uses this
35static inline const char *
36crm_element_name(const xmlNode *xml)
37{
38 return (xml == NULL)? NULL : (const char *) xml->name;
39}
40
41// NOTE: sbd (as of at least 1.5.2) uses this
43xmlNode *copy_xml(xmlNode *src_node);
44
45// NOTE: sbd (as of at least 1.5.2) uses this
47gboolean cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs);
48
49// NOTE: sbd (as of at least 1.5.2) uses this
51void crm_xml_init(void);
52
54void crm_xml_cleanup(void);
55
57void pcmk_free_xml_subtree(xmlNode *xml);
58
59// NOTE: sbd (as of at least 1.5.2) uses this
61void free_xml(xmlNode *child);
62
64void crm_xml_sanitize_id(char *id);
65
67char *calculate_on_disk_digest(xmlNode *input);
68
70char *calculate_operation_digest(xmlNode *input, const char *version);
71
73char *calculate_xml_versioned_digest(xmlNode *input, gboolean sort,
74 gboolean do_filter, const char *version);
75
77xmlXPathObjectPtr xpath_search(const xmlNode *xml_top, const char *path);
78
80static inline int numXpathResults(xmlXPathObjectPtr xpathObj)
81{
82 if ((xpathObj == NULL) || (xpathObj->nodesetval == NULL)) {
83 return 0;
84 }
85 return xpathObj->nodesetval->nodeNr;
86}
87
89xmlNode *getXpathResult(xmlXPathObjectPtr xpathObj, int index);
90
92void freeXpathObject(xmlXPathObjectPtr xpathObj);
93
95void dedupXpathResults(xmlXPathObjectPtr xpathObj);
96
98void crm_foreach_xpath_result(xmlNode *xml, const char *xpath,
99 void (*helper)(xmlNode*, void*), void *user_data);
100
101// NOTE: sbd (as of at least 1.5.2) uses this
103xmlNode *get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level);
104
106typedef const xmlChar *pcmkXmlStr;
107
109bool xml_tracking_changes(xmlNode *xml);
110
112bool xml_document_dirty(xmlNode *xml);
113
115void xml_accept_changes(xmlNode *xml);
116
118void xml_track_changes(xmlNode *xml, const char *user, xmlNode *acl_source,
119 bool enforce_acls);
120
122void xml_calculate_changes(xmlNode *old_xml, xmlNode *new_xml);
123
125void xml_calculate_significant_changes(xmlNode *old_xml, xmlNode *new_xml);
126
127#ifdef __cplusplus
128}
129#endif
130
131#endif // PCMK__CRM_COMMON_XML_COMPAT__H
const char * path
Definition cib.c:28
uint32_t version
Definition remote.c:1
xmlNode * input
Functionality for manipulating name/value pairs.
void dedupXpathResults(xmlXPathObjectPtr xpathObj)
Definition xpath.c:463
void crm_foreach_xpath_result(xmlNode *xml, const char *xpath, void(*helper)(xmlNode *, void *), void *user_data)
Definition xpath.c:500
char * calculate_operation_digest(xmlNode *input, const char *version)
Definition digest.c:348
const xmlChar * pcmkXmlStr
Definition xml_compat.h:106
xmlNode * get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level)
Definition xpath.c:530
void xml_accept_changes(xmlNode *xml)
Definition xml.c:1786
xmlNode * getXpathResult(xmlXPathObjectPtr xpathObj, int index)
Definition xpath.c:401
void crm_xml_init(void)
Definition xml.c:1733
char * calculate_on_disk_digest(xmlNode *input)
Definition digest.c:342
void xml_calculate_changes(xmlNode *old_xml, xmlNode *new_xml)
Definition xml.c:1816
gboolean cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs)
Definition schemas.c:1584
void freeXpathObject(xmlXPathObjectPtr xpathObj)
Definition xpath.c:444
bool xml_tracking_changes(xmlNode *xml)
Definition xml.c:1772
void crm_xml_cleanup(void)
Definition xml.c:1739
bool xml_document_dirty(xmlNode *xml)
Definition xml.c:1779
char * calculate_xml_versioned_digest(xmlNode *input, gboolean sort, gboolean do_filter, const char *version)
Definition digest.c:358
void xml_track_changes(xmlNode *xml, const char *user, xmlNode *acl_source, bool enforce_acls)
Definition xml.c:1794
void xml_calculate_significant_changes(xmlNode *old_xml, xmlNode *new_xml)
Definition xml.c:1833
void free_xml(xmlNode *child)
Definition xml.c:1752
void crm_xml_sanitize_id(char *id)
Definition xml.c:1758
void pcmk_free_xml_subtree(xmlNode *xml)
Definition xml.c:1746
xmlXPathObjectPtr xpath_search(const xmlNode *xml_top, const char *path)
Definition xpath.c:393
xmlNode * copy_xml(xmlNode *src_node)
Definition xml.c:1719
Defined string constants for XML element and attribute names.