1 /*
2 * Copyright 2015-2024 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_DIGEST_INTERNAL__H
11 #define PCMK__CRM_COMMON_DIGEST_INTERNAL__H
12
13 /*
14 * Internal-only functions to create digest strings from XML
15 */
16
17 #include <stdbool.h>
18
19 #include <libxml/tree.h> // xmlNode
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 // Digest comparison results
26 enum pcmk__digest_result {
27 pcmk__digest_unknown, // No digest available for comparison
28 pcmk__digest_match, // Digests match
29 pcmk__digest_mismatch, // Any parameter changed (potentially reloadable)
30 pcmk__digest_restart, // Parameters that require a restart changed
31 };
32
33 // Information needed to compare operation digests
34 typedef struct {
35 enum pcmk__digest_result rc; // Result of digest comparison
36 xmlNode *params_all; // All operation parameters
37 xmlNode *params_secure; // Parameters marked private
38 xmlNode *params_restart; // Parameters marked not reloadable
39 char *digest_all_calc; // Digest of params_all
40 char *digest_secure_calc; // Digest of params_secure
41 char *digest_restart_calc; // Digest of params_restart
42 } pcmk__op_digest_t;
43
44 char *pcmk__digest_on_disk_cib(xmlNode *input);
45 char *pcmk__digest_operation(xmlNode *input);
46 char *pcmk__digest_xml(xmlNode *input, bool filter);
47
48 bool pcmk__verify_digest(xmlNode *input, const char *expected);
49
50 #ifdef __cplusplus
51 }
52 #endif
53
54 #endif // PCMK__CRM_COMMON_DIGEST_INTERNAL__H