pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
Typedefs | Functions
xml.h File Reference

Wrappers for and extensions to libxml2. More...

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <crm/crm.h>
#include <crm/common/nvpair.h>
#include <crm/common/schemas.h>
#include <crm/common/xml_io.h>
#include <crm/common/xml_names.h>
#include <crm/common/xml_compat.h>
Include dependency graph for xml.h:

Go to the source code of this file.

Typedefs

typedef const xmlChar * pcmkXmlStr
 

Functions

xmlNode * get_xpath_object (const char *xpath, xmlNode *xml_obj, int error_level)
 
char * calculate_on_disk_digest (xmlNode *local_cib)
 Calculate and return digest of XML tree, suitable for storing on disk. More...
 
char * calculate_operation_digest (xmlNode *local_cib, const char *version)
 Calculate and return digest of XML operation. More...
 
char * calculate_xml_versioned_digest (xmlNode *input, gboolean sort, gboolean do_filter, const char *version)
 Calculate and return digest of XML tree. More...
 
void crm_xml_init (void)
 Initialize the CRM XML subsystem. More...
 
void crm_xml_cleanup (void)
 
void pcmk_free_xml_subtree (xmlNode *xml)
 
void free_xml (xmlNode *child)
 
xmlNode * sorted_xml (xmlNode *input, xmlNode *parent, gboolean recursive)
 
xmlXPathObjectPtr xpath_search (const xmlNode *xml_top, const char *path)
 
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. More...
 
xmlNode * expand_idref (xmlNode *input, xmlNode *top)
 
void freeXpathObject (xmlXPathObjectPtr xpathObj)
 
xmlNode * getXpathResult (xmlXPathObjectPtr xpathObj, int index)
 
void dedupXpathResults (xmlXPathObjectPtr xpathObj)
 
bool xml_tracking_changes (xmlNode *xml)
 
bool xml_document_dirty (xmlNode *xml)
 
void xml_track_changes (xmlNode *xml, const char *user, xmlNode *acl_source, bool enforce_acls)
 
void xml_calculate_changes (xmlNode *old_xml, xmlNode *new_xml)
 
void xml_calculate_significant_changes (xmlNode *old_xml, xmlNode *new_xml)
 
void xml_accept_changes (xmlNode *xml)
 
bool xml_patch_versions (const xmlNode *patchset, int add[3], int del[3])
 
xmlNode * xml_create_patchset (int format, xmlNode *source, xmlNode *target, bool *config, bool manage_version)
 
int xml_apply_patchset (xmlNode *xml, xmlNode *patchset, bool check_version)
 
void patchset_process_digest (xmlNode *patch, xmlNode *source, xmlNode *target, bool with_digest)
 
void crm_xml_sanitize_id (char *id)
 Sanitize a string so it is usable as an XML ID. More...
 
void crm_xml_set_id (xmlNode *xml, const char *format,...) G_GNUC_PRINTF(2
 

Detailed Description

Wrappers for and extensions to libxml2.

Definition in file xml.h.

Typedef Documentation

◆ pcmkXmlStr

typedef const xmlChar* pcmkXmlStr

Definition at line 41 of file xml.h.

Function Documentation

◆ calculate_on_disk_digest()

char* calculate_on_disk_digest ( xmlNode *  input)

Calculate and return digest of XML tree, suitable for storing on disk.

Parameters
[in]inputRoot of XML to digest
Returns
Newly allocated string containing digest

Definition at line 129 of file digest.c.

◆ calculate_operation_digest()

char* calculate_operation_digest ( xmlNode *  input,
const char *  version 
)

Calculate and return digest of XML operation.

Parameters
[in]inputRoot of XML to digest
[in]versionUnused
Returns
Newly allocated string containing digest

Definition at line 148 of file digest.c.

◆ calculate_xml_versioned_digest()

char* calculate_xml_versioned_digest ( xmlNode *  input,
gboolean  sort,
gboolean  do_filter,
const char *  version 
)

Calculate and return digest of XML tree.

Parameters
[in]inputRoot of XML to digest
[in]sortWhether to sort XML before calculating digest
[in]do_filterWhether to filter certain XML attributes
[in]versionCRM feature set version (used to select v1/v2 digest)
Returns
Newly allocated string containing digest

Definition at line 165 of file digest.c.

◆ crm_foreach_xpath_result()

void crm_foreach_xpath_result ( xmlNode *  xml,
const char *  xpath,
void(*)(xmlNode *, void *)  helper,
void *  user_data 
)

Run a supplied function for each result of an xpath search.

Parameters
[in,out]xmlXML to search
[in]xpathXPath search string
[in]helperFunction to call for each result
[in,out]user_dataData to pass to supplied function
Note
The helper function will be passed the XML node of the result, and the supplied user_data. This function does not otherwise use user_data.

Definition at line 170 of file xpath.c.

◆ crm_xml_cleanup()

void crm_xml_cleanup ( void  )

Definition at line 2161 of file xml.c.

◆ crm_xml_init()

void crm_xml_init ( void  )

Initialize the CRM XML subsystem.

This method sets global XML settings and loads pacemaker schemas into the cache.

Definition at line 2143 of file xml.c.

◆ crm_xml_sanitize_id()

void crm_xml_sanitize_id ( char *  id)

Sanitize a string so it is usable as an XML ID.

Parameters
[in,out]idString to sanitize

Definition at line 1065 of file xml.c.

◆ crm_xml_set_id()

void crm_xml_set_id ( xmlNode *  xml,
const char *  format,
  ... 
)

◆ dedupXpathResults()

void dedupXpathResults ( xmlXPathObjectPtr  xpathObj)

Definition at line 101 of file xpath.c.

◆ expand_idref()

xmlNode* expand_idref ( xmlNode *  input,
xmlNode *  top 
)

Definition at line 2170 of file xml.c.

◆ free_xml()

void free_xml ( xmlNode *  child)

Definition at line 958 of file xml.c.

◆ freeXpathObject()

void freeXpathObject ( xmlXPathObjectPtr  xpathObj)

Definition at line 39 of file xpath.c.

◆ get_xpath_object()

xmlNode* get_xpath_object ( const char *  xpath,
xmlNode *  xml_obj,
int  error_level 
)

Definition at line 189 of file xpath.c.

◆ getXpathResult()

xmlNode* getXpathResult ( xmlXPathObjectPtr  xpathObj,
int  index 
)

Definition at line 58 of file xpath.c.

◆ patchset_process_digest()

void patchset_process_digest ( xmlNode *  patch,
xmlNode *  source,
xmlNode *  target,
bool  with_digest 
)

Definition at line 386 of file patchset.c.

◆ pcmk_free_xml_subtree()

void pcmk_free_xml_subtree ( xmlNode *  xml)

Free an XML element and all of its children, removing it from its parent

Parameters
[in,out]xmlXML element to free

Definition at line 885 of file xml.c.

◆ sorted_xml()

xmlNode* sorted_xml ( xmlNode *  input,
xmlNode *  parent,
gboolean  recursive 
)

Definition at line 2094 of file xml.c.

◆ xml_accept_changes()

void xml_accept_changes ( xmlNode *  xml)

Definition at line 443 of file xml.c.

◆ xml_apply_patchset()

int xml_apply_patchset ( xmlNode *  xml,
xmlNode *  patchset,
bool  check_version 
)

Definition at line 1318 of file patchset.c.

◆ xml_calculate_changes()

void xml_calculate_changes ( xmlNode *  old_xml,
xmlNode *  new_xml 
)

Definition at line 1642 of file xml.c.

◆ xml_calculate_significant_changes()

void xml_calculate_significant_changes ( xmlNode *  old_xml,
xmlNode *  new_xml 
)

Definition at line 1634 of file xml.c.

◆ xml_create_patchset()

xmlNode* xml_create_patchset ( int  format,
xmlNode *  source,
xmlNode *  target,
bool *  config,
bool  manage_version 
)

Definition at line 328 of file patchset.c.

◆ xml_document_dirty()

bool xml_document_dirty ( xmlNode *  xml)

Definition at line 366 of file xml.c.

◆ xml_patch_versions()

bool xml_patch_versions ( const xmlNode *  patchset,
int  add[3],
int  del[3] 
)

Definition at line 787 of file patchset.c.

◆ xml_track_changes()

void xml_track_changes ( xmlNode *  xml,
const char *  user,
xmlNode *  acl_source,
bool  enforce_acls 
)

Definition at line 344 of file xml.c.

◆ xml_tracking_changes()

bool xml_tracking_changes ( xmlNode *  xml)

Definition at line 359 of file xml.c.

◆ xpath_search()

xmlXPathObjectPtr xpath_search ( const xmlNode *  xml_top,
const char *  path 
)

Definition at line 139 of file xpath.c.