pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
nvpair_internal.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_NVPAIR_INTERNAL__H
11 #define PCMK__CRM_COMMON_NVPAIR_INTERNAL__H
12 
13 #include <glib.h> // gboolean
14 #include <libxml/tree.h> // xmlNode
15 
16 #include <crm/common/rules.h> // pcmk_rule_input_t
17 #include <crm/common/iso8601.h> // crm_time_t
18 #include <crm/common/strings_internal.h> // pcmk__str_eq(), etc.
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 // Data needed to sort XML blocks of name/value pairs
25 typedef struct unpack_data_s {
26  GHashTable *values; // Where to put name/value pairs
27  const char *first_id; // Block with this XML ID should sort first
28  pcmk_rule_input_t rule_input; // Data used to evaluate rules
29 
30  // Whether each block's values should overwrite any existing ones
31  bool overwrite;
32 
33  // If not NULL, this will be set to when rule evaluations will change next
36 
45 #define pcmk__insert_meta(obj, name, value) do { \
46  if (pcmk__str_eq((value), "#default", pcmk__str_casei)) { \
47  /* @COMPAT Deprecated since 2.1.8 */ \
48  pcmk__config_warn("Support for setting meta-attributes " \
49  "(such as %s) to the explicit value " \
50  "'#default' is deprecated and will be " \
51  "removed in a future release", (name)); \
52  } else if ((value) != NULL) { \
53  pcmk__insert_dup((obj)->meta, (name), (value)); \
54  } \
55  } while (0)
56 
57 int pcmk__xe_get_datetime(const xmlNode *xml, const char *attr, crm_time_t **t);
58 int pcmk__xe_get_flags(const xmlNode *xml, const char *name, uint32_t *dest,
59  uint32_t default_value);
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #endif // PCMK__CRM_COMMON_NVPAIR_INTERNAL__H
Data used to evaluate a rule (any NULL items are ignored)
Definition: rules.h:57
int pcmk__xe_get_datetime(const xmlNode *xml, const char *attr, crm_time_t **t)
Definition: nvpair.c:728
const char * name
Definition: cib.c:26
struct crm_time_s crm_time_t
Definition: iso8601.h:32
const char * first_id
ISO_8601 Date handling.
GHashTable * values
crm_time_t * next_change
pcmk_rule_input_t rule_input
int pcmk__xe_get_flags(const xmlNode *xml, const char *name, uint32_t *dest, uint32_t default_value)
Retrieve a flag group from an XML attribute value.
Definition: nvpair.c:535
Scheduler API for rules.
struct unpack_data_s pcmk__nvpair_unpack_t