30 #define BEST_EFFORT_STATUS 0
40 dump_xml_for_digest(xmlNode * an_xml_node)
43 int offset = 0, max = 0;
64 calculate_xml_digest_v1(xmlNode * input, gboolean sort, gboolean ignored)
77 buffer = dump_xml_for_digest(input);
99 calculate_xml_digest_v2(xmlNode * source, gboolean do_filter)
105 static struct qb_log_callsite *digest_cs = NULL;
107 crm_trace(
"Begin digest %s", do_filter?
"filtered":
"");
128 if (digest_cs == NULL) {
129 digest_cs = qb_log_callsite_get(__func__, __FILE__,
"cib-digest",
LOG_TRACE, __LINE__,
132 if (digest_cs && digest_cs->targets) {
133 char *trace_file =
crm_concat(
"/tmp/digest", digest,
'-');
163 return calculate_xml_digest_v1(input, FALSE, FALSE);
178 return calculate_xml_digest_v1(input, TRUE, FALSE);
206 return calculate_xml_digest_v1(input, sort, do_filter);
209 return calculate_xml_digest_v2(input, do_filter);
224 char *calculated = NULL;
229 if (calculated == NULL) {
230 crm_perror(LOG_ERR,
"Could not calculate digest for comparison");
236 crm_trace(
"Digest comparison passed: %s", calculated);
238 crm_err(
"Digest comparison failed: expected %s, calculated %s",
239 expected, calculated);
#define CRM_CHECK(expr, failure_action)
#define XML_ATTR_NUMUPDATES
void crm_buffer_add_char(char **buffer, int *offset, int *max, char c)
gboolean crm_digest_verify(xmlNode *input, const char *expected)
unsigned int crm_trace_nonlog
#define XML_ATTR_GENERATION
char * calculate_operation_digest(xmlNode *local_cib, const char *version)
Calculate and return digest of XML operation.
#define crm_trace(fmt, args...)
Wrappers for and extensions to libxml2.
const char * crm_element_value(xmlNode *data, const char *name)
void free_xml(xmlNode *child)
char * calculate_on_disk_digest(xmlNode *local_cib)
Calculate and return digest of XML tree, suitable for storing on disk.
xmlNode * sorted_xml(xmlNode *input, xmlNode *parent, gboolean recursive)
#define crm_perror(level, fmt, args...)
Log a system error message.
#define crm_err(fmt, args...)
char * calculate_xml_versioned_digest(xmlNode *input, gboolean sort, gboolean do_filter, const char *version)
Calculate and return digest of XML tree.
int compare_version(const char *version1, const char *version2)
#define BEST_EFFORT_STATUS
#define XML_ATTR_GENERATION_ADMIN
void save_xml_to_file(xmlNode *xml, const char *desc, const char *filename)
#define crm_log_xml_trace(xml, text)
char * crm_md5sum(const char *buffer)
char * crm_concat(const char *prefix, const char *suffix, char join)
#define safe_str_eq(a, b)
void crm_xml_dump(xmlNode *data, int options, char **buffer, int *offset, int *max, int depth)