pacemaker 3.0.1-16e74fc4da
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
nvpair.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__H
11#define PCMK__CRM_COMMON_NVPAIR__H
12
13#include <sys/time.h> // struct timeval
14#include <glib.h> // gpointer, gboolean, guint, GHashTable
15#include <libxml/tree.h> // xmlNode
16
17#include <crm/crm.h>
18#include <crm/common/iso8601.h> // crm_time_t
19#include <crm/common/rules.h> // pcmk_rule_input_t
20
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
32typedef struct pcmk_nvpair_s {
33 char *name;
34 char *value;
36
37GSList *pcmk_prepend_nvpair(GSList *nvpairs, const char *name, const char *value);
38void pcmk_free_nvpairs(GSList *nvpairs);
39
40xmlNode *crm_create_nvpair_xml(xmlNode *parent, const char *id,
41 const char *name, const char *value);
42void hash2field(gpointer key, gpointer value, gpointer user_data);
43void hash2metafield(gpointer key, gpointer value, gpointer user_data);
44void hash2smartfield(gpointer key, gpointer value, gpointer user_data);
45GHashTable *xml2list(const xmlNode *parent);
46
47void pcmk_unpack_nvpair_blocks(const xmlNode *xml, const char *element_name,
48 const char *first_id,
49 const pcmk_rule_input_t *rule_input,
50 GHashTable *values, crm_time_t *next_change);
51
52char *crm_meta_name(const char *field);
53const char *crm_meta_value(GHashTable *hash, const char *field);
54
55#ifdef __cplusplus
56}
57#endif
58
59#if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
61#endif
62
63#endif // PCMK__CRM_COMMON_NVPAIR__H
const char * parent
Definition cib.c:27
const char * name
Definition cib.c:26
Scheduler API for rules.
A dumping ground.
ISO_8601 Date handling.
struct crm_time_s crm_time_t
Definition iso8601.h:32
const char * crm_meta_value(GHashTable *hash, const char *field)
Get the value of a meta-attribute.
Definition nvpair.c:553
GHashTable * xml2list(const xmlNode *parent)
Retrieve XML attributes as a hash table.
Definition nvpair.c:339
struct pcmk_nvpair_s pcmk_nvpair_t
GSList * pcmk_prepend_nvpair(GSList *nvpairs, const char *name, const char *value)
Prepend a name/value pair to a list.
Definition nvpair.c:92
xmlNode * crm_create_nvpair_xml(xmlNode *parent, const char *id, const char *name, const char *value)
Create an XML name/value pair.
Definition nvpair.c:301
void hash2metafield(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry, as meta-attribute name.
Definition nvpair.c:266
void hash2field(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry.
Definition nvpair.c:238
char * crm_meta_name(const char *field)
Get the environment variable equivalent of a meta-attribute name.
Definition nvpair.c:525
void pcmk_free_nvpairs(GSList *nvpairs)
Free a list of name/value pairs.
Definition nvpair.c:103
void pcmk_unpack_nvpair_blocks(const xmlNode *xml, const char *element_name, const char *first_id, const pcmk_rule_input_t *rule_input, GHashTable *values, crm_time_t *next_change)
Unpack nvpair blocks contained by an XML element into a hash table, evaluated for any rules.
Definition nvpair.c:483
void hash2smartfield(gpointer key, gpointer value, gpointer user_data)
Safely add hash table entry to XML as attribute or name-value pair.
Definition nvpair.c:196
Deprecated Pacemaker name-value pair API.
char * value
Definition nvpair.h:34
char * name
Definition nvpair.h:33
Data used to evaluate a rule (any NULL items are ignored)
Definition rules.h:57