pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
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 #include <crm/crm.h>
17 
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
29 typedef struct pcmk_nvpair_s {
30  char *name;
31  char *value;
33 
34 GSList *pcmk_prepend_nvpair(GSList *nvpairs, const char *name, const char *value);
35 void pcmk_free_nvpairs(GSList *nvpairs);
36 
37 xmlNode *crm_create_nvpair_xml(xmlNode *parent, const char *id,
38  const char *name, const char *value);
39 void hash2field(gpointer key, gpointer value, gpointer user_data);
40 void hash2metafield(gpointer key, gpointer value, gpointer user_data);
41 void hash2smartfield(gpointer key, gpointer value, gpointer user_data);
42 GHashTable *xml2list(const xmlNode *parent);
43 
44 char *crm_meta_name(const char *field);
45 const char *crm_meta_value(GHashTable *hash, const char *field);
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 
51 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
53 #endif
54 
55 #endif // PCMK__CRM_COMMON_NVPAIR__H
A dumping ground.
char * name
Definition: nvpair.h:30
void hash2field(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry.
Definition: nvpair.c:249
void pcmk_free_nvpairs(GSList *nvpairs)
Free a list of name/value pairs.
Definition: nvpair.c:103
const char * name
Definition: cib.c:26
char * value
Definition: nvpair.h:31
GSList * pcmk_prepend_nvpair(GSList *nvpairs, const char *name, const char *value)
Prepend a name/value pair to a list.
Definition: nvpair.c:92
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:207
Deprecated Pacemaker name-value pair API.
GHashTable * xml2list(const xmlNode *parent)
Retrieve XML attributes as a hash table.
Definition: nvpair.c:350
void hash2metafield(gpointer key, gpointer value, gpointer user_data)
Set XML attribute based on hash table entry, as meta-attribute name.
Definition: nvpair.c:277
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:312
const char * parent
Definition: cib.c:27
const char * crm_meta_value(GHashTable *hash, const char *field)
Get the value of a meta-attribute.
Definition: nvpair.c:435
struct pcmk_nvpair_s pcmk_nvpair_t
char * crm_meta_name(const char *field)
Get the environment variable equivalent of a meta-attribute name.
Definition: nvpair.c:407