pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
xml_element.h
Go to the documentation of this file.
1/*
2 * Copyright 2004-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_XML_ELEMENT__H
11#define PCMK__CRM_COMMON_XML_ELEMENT__H
12
13#include <sys/time.h> // struct timeval
14
15#include <glib.h> // guint
16#include <libxml/tree.h> // xmlNode
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
28const char *crm_xml_add(xmlNode *node, const char *name, const char *value);
29const char *crm_xml_add_int(xmlNode *node, const char *name, int value);
30const char *crm_xml_add_ll(xmlNode *node, const char *name, long long value);
31const char *crm_xml_add_ms(xmlNode *node, const char *name, guint ms);
32const char *crm_xml_add_timeval(xmlNode *xml, const char *name_sec,
33 const char *name_usec,
34 const struct timeval *value);
35
36const char *crm_element_value(const xmlNode *data, const char *name);
37int crm_element_value_int(const xmlNode *data, const char *name, int *dest);
38int crm_element_value_ll(const xmlNode *data, const char *name, long long *dest);
39int crm_element_value_ms(const xmlNode *data, const char *name, guint *dest);
40int crm_element_value_epoch(const xmlNode *xml, const char *name, time_t *dest);
41int crm_element_value_timeval(const xmlNode *data, const char *name_sec,
42 const char *name_usec, struct timeval *dest);
43char *crm_element_value_copy(const xmlNode *data, const char *name);
44
54static inline const char *
55crm_copy_xml_element(const xmlNode *obj1, xmlNode *obj2, const char *element)
56{
57 const char *value = crm_element_value(obj1, element);
58
59 crm_xml_add(obj2, element, value);
60 return value;
61}
62
63#ifdef __cplusplus
64}
65#endif
66
67#if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
69#endif
70
71#endif // PCMK__CRM_COMMON_XML_ELEMENT__H
const char * name
Definition cib.c:26
char data[0]
Definition cpg.c:10
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the 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.
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute.
const char * crm_xml_add_int(xmlNode *node, const char *name, int value)
Create an XML attribute with specified name and integer value.
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.
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.
int crm_element_value_ll(const xmlNode *data, const char *name, long long *dest)
Retrieve the long long integer value of an XML attribute.
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.
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(xmlNode *node, const char *name, const char *value)
Create an XML attribute with specified name and value.
const char * crm_xml_add_ms(xmlNode *node, const char *name, guint ms)
Create an XML attribute with specified name and unsigned value.
Deprecated Pacemaker XML element API.