10 #ifndef CRM_COMMON_NVPAIR__H
11 # define CRM_COMMON_NVPAIR__H
23 # include <sys/time.h>
25 # include <libxml/tree.h>
40 const char *
name,
const char *value);
41 void hash2nvpair(gpointer key, gpointer value, gpointer user_data);
42 void hash2field(gpointer key, gpointer value, gpointer user_data);
43 void hash2metafield(gpointer key, gpointer value, gpointer user_data);
45 GHashTable *
xml2list(xmlNode *parent);
47 const char *
crm_xml_add(xmlNode *node,
const char *
name,
const char *value);
53 const char *name_usec,
54 const struct timeval *value);
62 const char *name_usec,
struct timeval *dest);
74 static inline const char *
75 crm_copy_xml_element(xmlNode *obj1, xmlNode *obj2,
const char *element)
95 static inline const char *
96 crm_xml_add_boolean(xmlNode *node,
const char *
name, gboolean value)
98 return crm_xml_add(node, name, (value?
"true" :
"false"));
105 #endif // CRM_COMMON_NVPAIR__H
GSList * pcmk_sort_nvpairs(GSList *list)
Sort a list of name/value pairs.
void hash2field(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry.
void pcmk_free_nvpairs(GSList *nvpairs)
Free a list of name/value pairs.
const char * crm_xml_add_ms(xmlNode *node, const char *name, guint ms)
Create an XML attribute with specified name and unsigned value.
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
GSList * pcmk_prepend_nvpair(GSList *nvpairs, const char *name, const char *value)
Prepend a name/value pair to a list.
int crm_element_value_ll(const xmlNode *data, const char *name, long long *dest)
Retrieve the long long integer value of an XML attribute.
GSList * pcmk_xml_attrs2nvpairs(xmlNode *xml)
Create a list of name/value pairs from an XML node's attributes.
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute.
void hash2smartfield(gpointer key, gpointer value, gpointer user_data)
Add hash table entry to XML as (possibly legacy) name/value.
void hash2nvpair(gpointer key, gpointer value, gpointer user_data)
Add XML nvpair element based on hash table entry.
int crm_element_value_ms(const xmlNode *data, const char *name, guint *dest)
Retrieve the millisecond value of an XML attribute.
char * crm_element_value_copy(const xmlNode *data, const char *name)
Retrieve a copy of the value of an XML attribute.
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
int crm_element_value_timeval(const xmlNode *data, const char *name_sec, const char *name_usec, struct timeval *dest)
Retrieve the value of XML second/microsecond attributes as time.
const char * crm_xml_replace(xmlNode *node, const char *name, const char *value)
Replace an XML attribute with specified name and (possibly NULL) value.
int crm_element_value_epoch(const xmlNode *xml, const char *name, time_t *dest)
Retrieve the seconds-since-epoch value of an XML attribute.
const char * crm_xml_add_timeval(xmlNode *xml, const char *name_sec, const char *name_usec, const struct timeval *value)
Create XML attributes for seconds and microseconds.
const char * crm_xml_add_ll(xmlNode *node, const char *name, long long value)
Create an XML attribute with specified name and long long int value.
void hash2metafield(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry, as meta-attribute name.
GHashTable * xml2list(xmlNode *parent)
Retrieve XML attributes as a hash table.
void pcmk_nvpairs2xml_attrs(GSList *list, xmlNode *xml)
Add XML attributes based on a list of name/value pairs.
xmlNode * crm_create_nvpair_xml(xmlNode *parent, const char *id, const char *name, const char *value)
Create an XML name/value pair.
struct pcmk_nvpair_s pcmk_nvpair_t