Coverage Report

Created: 2026-01-02 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pacemaker/include/crm/common/xml_compat.h
Line
Count
Source
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 <stdbool.h>                // bool
14
15
#include <glib.h>               // gboolean
16
#include <libxml/tree.h>        // xmlNode
17
#include <libxml/xpath.h>           // xmlXPathObject
18
19
#ifdef __cplusplus
20
extern "C" {
21
#endif
22
23
/**
24
 * \file
25
 * \brief Deprecated Pacemaker XML API
26
 * \ingroup core
27
 * \deprecated Do not include this header directly. The XML APIs in this
28
 *             header, and the header itself, will be removed in a future
29
 *             release.
30
 */
31
32
// NOTE: sbd (as of at least 1.5.2) uses this
33
//! \deprecated Use name member directly
34
static inline const char *
35
crm_element_name(const xmlNode *xml)
36
0
{
37
0
    return (xml == NULL)? NULL : (const char *) xml->name;
38
0
}
Unexecuted instantiation: scores_fuzzer.c:crm_element_name
Unexecuted instantiation: schemas.c:crm_element_name
Unexecuted instantiation: xml.c:crm_element_name
Unexecuted instantiation: xml_element.c:crm_element_name
Unexecuted instantiation: xpath.c:crm_element_name
Unexecuted instantiation: acl.c:crm_element_name
Unexecuted instantiation: digest.c:crm_element_name
Unexecuted instantiation: patchset.c:crm_element_name
Unexecuted instantiation: iso8601_fuzzer.c:crm_element_name
39
40
// NOTE: sbd (as of at least 1.5.2) uses this
41
//! \deprecated Do not use Pacemaker for general-purpose XML manipulation
42
xmlNode *copy_xml(xmlNode *src_node);
43
44
// NOTE: sbd (as of at least 1.5.2) uses this
45
//! \deprecated Do not use
46
gboolean cli_config_update(xmlNode **xml, int *best_version, gboolean to_logs);
47
48
// NOTE: sbd (as of at least 1.5.2) uses this
49
//! \deprecated Call \c crm_log_init() or \c crm_log_cli_init() instead
50
void crm_xml_init(void);
51
52
//! \deprecated Exit with \c crm_exit() instead
53
void crm_xml_cleanup(void);
54
55
//! \deprecated Do not use Pacemaker for general-purpose XML manipulation
56
void pcmk_free_xml_subtree(xmlNode *xml);
57
58
// NOTE: sbd (as of at least 1.5.2) uses this
59
//! \deprecated Do not use Pacemaker for general-purpose XML manipulation
60
void free_xml(xmlNode *child);
61
62
//! \deprecated Do not use Pacemaker for general-purpose XML manipulation
63
void crm_xml_sanitize_id(char *id);
64
65
//! \deprecated Do not use
66
char *calculate_on_disk_digest(xmlNode *input);
67
68
//! \deprecated Do not use
69
char *calculate_operation_digest(xmlNode *input, const char *version);
70
71
//! \deprecated Do not use
72
char *calculate_xml_versioned_digest(xmlNode *input, gboolean sort,
73
                                     gboolean do_filter, const char *version);
74
75
//! \deprecated Do not use
76
xmlXPathObjectPtr xpath_search(const xmlNode *xml_top, const char *path);
77
78
//! \deprecated Do not use
79
static inline int numXpathResults(xmlXPathObjectPtr xpathObj)
80
0
{
81
0
    if ((xpathObj == NULL) || (xpathObj->nodesetval == NULL)) {
82
0
        return 0;
83
0
    }
84
0
    return xpathObj->nodesetval->nodeNr;
85
0
}
Unexecuted instantiation: scores_fuzzer.c:numXpathResults
Unexecuted instantiation: schemas.c:numXpathResults
Unexecuted instantiation: xml.c:numXpathResults
Unexecuted instantiation: xml_element.c:numXpathResults
Unexecuted instantiation: xpath.c:numXpathResults
Unexecuted instantiation: acl.c:numXpathResults
Unexecuted instantiation: digest.c:numXpathResults
Unexecuted instantiation: patchset.c:numXpathResults
Unexecuted instantiation: iso8601_fuzzer.c:numXpathResults
86
87
//! \deprecated Do not use
88
xmlNode *getXpathResult(xmlXPathObjectPtr xpathObj, int index);
89
90
//! \deprecated Do not use
91
void freeXpathObject(xmlXPathObjectPtr xpathObj);
92
93
//! \deprecated Do not use
94
void dedupXpathResults(xmlXPathObjectPtr xpathObj);
95
96
//! \deprecated Do not use
97
void crm_foreach_xpath_result(xmlNode *xml, const char *xpath,
98
                              void (*helper)(xmlNode*, void*), void *user_data);
99
100
// NOTE: sbd (as of at least 1.5.2) uses this
101
//! \deprecated Do not use
102
xmlNode *get_xpath_object(const char *xpath, xmlNode *xml_obj, int error_level);
103
104
//! \deprecated Do not use
105
typedef const xmlChar *pcmkXmlStr;
106
107
//! \deprecated Do not use
108
bool xml_tracking_changes(xmlNode *xml);
109
110
//! \deprecated Do not use
111
bool xml_document_dirty(xmlNode *xml);
112
113
//! \deprecated Do not use
114
void xml_accept_changes(xmlNode *xml);
115
116
//! \deprecated Do not use
117
void xml_track_changes(xmlNode *xml, const char *user, xmlNode *acl_source,
118
                       bool enforce_acls);
119
120
//! \deprecated Do not use
121
void xml_calculate_changes(xmlNode *old_xml, xmlNode *new_xml);
122
123
//! \deprecated Do not use
124
void xml_calculate_significant_changes(xmlNode *old_xml, xmlNode *new_xml);
125
126
//! \deprecated Do not use
127
bool xml_patch_versions(const xmlNode *patchset, int add[3], int del[3]);
128
129
//! \deprecated Do not use
130
void patchset_process_digest(xmlNode *patch, const xmlNode *source,
131
                             const xmlNode *target, bool with_digest);
132
133
#ifdef __cplusplus
134
}
135
#endif
136
137
#endif // PCMK__CRM_COMMON_XML_COMPAT__H