pacemaker  2.1.8-3980678f03
Scalable High-Availability cluster resource manager
compat.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_CLUSTER_COMPAT__H
11 # define PCMK__CRM_CLUSTER_COMPAT__H
12 
13 #include <stdint.h> // uint32_t
14 #include <sys/types.h> // size_t
15 
16 #include <glib.h> // gboolean, guint
17 #include <libxml/tree.h> // xmlNode
18 
19 #if SUPPORT_COROSYNC
20 #include <corosync/cpg.h> // cpg_handle_t
21 #endif // SUPPORT_COROSYNC
22 
23 #include <crm/cluster.h> // crm_node_t
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
38 enum crm_get_peer_flags {
43 };
44 
45 // NOTE: sbd (as of at least 1.5.2) uses this
48 
50 crm_node_t *crm_get_peer(unsigned int id, const char *uname);
51 
53 crm_node_t *crm_get_peer_full(unsigned int id, const char *uname, int flags);
54 
56 int crm_terminate_member(int nodeid, const char *uname, void *unused);
57 
59 int crm_terminate_member_no_mainloop(int nodeid, const char *uname,
60  int *connection);
61 
67 void set_uuid(xmlNode *xml, const char *attr, crm_node_t *node);
68 
69 #if SUPPORT_COROSYNC
70 
72 gboolean cluster_connect_cpg(pcmk_cluster_t *cluster);
73 
76 
78 uint32_t get_local_nodeid(cpg_handle_t handle);
79 
81 void pcmk_cpg_membership(cpg_handle_t handle,
82  const struct cpg_name *group_name,
83  const struct cpg_address *member_list,
84  size_t member_list_entries,
85  const struct cpg_address *left_list,
86  size_t left_list_entries,
87  const struct cpg_address *joined_list,
88  size_t joined_list_entries);
89 
91 gboolean crm_is_corosync_peer_active(const crm_node_t * node);
92 
94 gboolean send_cluster_text(enum crm_ais_msg_class msg_class, const char *data,
95  gboolean local, const crm_node_t *node,
96  enum crm_ais_msg_types dest);
97 
99 char *pcmk_message_common_cs(cpg_handle_t handle, uint32_t nodeid, uint32_t pid,
100  void *msg, uint32_t *kind, const char **from);
101 
102 #endif // SUPPORT_COROSYNC
103 
104 // NOTE: sbd (as of at least 1.5.2) uses this
106 gboolean crm_cluster_connect(pcmk_cluster_t *cluster);
107 
110 
113 
115 void crm_remote_peer_cache_refresh(xmlNode *cib);
116 
118 crm_node_t *crm_remote_peer_get(const char *node_name);
119 
121 void crm_remote_peer_cache_remove(const char *node_name);
122 
124 gboolean crm_is_peer_active(const crm_node_t *node);
125 
127 guint crm_active_peers(void);
128 
130 guint reap_crm_member(uint32_t id, const char *name);
131 
132 // NOTE: sbd (as of at least 1.5.2) uses this enum
136  // NOTE: sbd (as of at least 1.5.2) uses this value
138 
140 
141  // NOTE: sbd (as of at least 1.5.2) uses this value
143 };
145 
146 // NOTE: sbd (as of at least 1.5.2) uses this
148 const char *name_for_cluster_type(enum cluster_type_e type);
149 
150 // NOTE: sbd (as of at least 1.5.2) uses this
153 
155 gboolean is_corosync_cluster(void);
156 
158 void crm_peer_init(void);
159 
161 void crm_peer_destroy(void);
162 
164 gboolean send_cluster_message(const crm_node_t *node,
165  enum crm_ais_msg_types service,
166  const xmlNode *data, gboolean ordered);
167 
169 const char *crm_peer_uuid(crm_node_t *node);
170 
172 enum crm_ais_msg_types text2msg_type(const char *text);
173 
175 char *get_node_name(uint32_t nodeid);
176 
178 const char *get_local_node_name(void);
179 
181 void crm_set_autoreap(gboolean enable);
182 
184 void crm_set_status_callback(void (*dispatch)(enum crm_status_type,
185  crm_node_t *, const void *));
186 
188 const char *crm_peer_uname(const char *uuid);
189 
190 #ifdef __cplusplus
191 }
192 #endif
193 
194 #endif // PCMK_CLUSTER_COMPAT__H
guint crm_active_peers(void)
Definition: membership.c:1507
const char * crm_peer_uuid(crm_node_t *node)
Definition: cluster.c:523
crm_node_t * crm_get_peer_full(unsigned int id, const char *uname, int flags)
Definition: membership.c:1469
crm_node_t * crm_get_peer(unsigned int id, const char *uname)
Definition: membership.c:1463
char data[0]
Definition: cpg.c:58
crm_ais_msg_types
Definition: cluster.h:197
uint32_t nodeid
Definition: cluster.h:142
Corosync Cluster Engine.
Definition: cluster.h:228
cluster_type_e
Definition: compat.h:135
const char * get_local_node_name(void)
Definition: cluster.c:535
const char * name_for_cluster_type(enum cluster_type_e type)
Definition: cluster.c:489
const char * name
Definition: cib.c:26
void crm_remote_peer_cache_remove(const char *node_name)
Definition: membership.c:1495
int crm_terminate_member(int nodeid, const char *uname, void *unused)
Definition: membership.c:1451
void crm_peer_destroy(void)
Definition: membership.c:1552
gboolean crm_is_peer_active(const crm_node_t *node)
Definition: membership.c:1501
char * uuid
Definition: cluster.h:140
enum crm_ais_msg_types type
Definition: cpg.c:51
int crm_remote_peer_cache_size(void)
Definition: membership.c:1475
char * pcmk_message_common_cs(cpg_handle_t handle, uint32_t nodeid, uint32_t pid, void *content, uint32_t *kind, const char **from)
Definition: cpg.c:1157
void crm_set_status_callback(void(*dispatch)(enum crm_status_type, crm_node_t *, const void *))
Definition: membership.c:1564
int crm_terminate_member_no_mainloop(int nodeid, const char *uname, int *connection)
Definition: membership.c:1457
const char * crm_peer_uname(const char *uuid)
Definition: cluster.c:541
gboolean crm_is_corosync_peer_active(const crm_node_t *node)
Definition: corosync.c:819
pcmk_cluster_t crm_cluster_t
Definition: compat.h:47
gboolean local
Definition: cpg.c:50
void set_uuid(xmlNode *xml, const char *attr, crm_node_t *node)
Definition: cluster.c:471
uint32_t pid
Definition: cpg.c:49
gboolean send_cluster_message(const crm_node_t *node, enum crm_ais_msg_types service, const xmlNode *data, gboolean ordered)
Definition: cluster.c:516
enum crm_ais_msg_types text2msg_type(const char *text)
Definition: cpg.c:1164
crm_status_type
Definition: cluster.h:214
gboolean is_corosync_cluster(void)
Definition: cluster.c:510
guint reap_crm_member(uint32_t id, const char *name)
Definition: membership.c:1513
gboolean send_cluster_text(enum crm_ais_msg_class msg_class, const char *data, gboolean local, const crm_node_t *node, enum crm_ais_msg_types dest)
Definition: cpg.c:1143
void crm_cluster_disconnect(pcmk_cluster_t *cluster)
Definition: cluster.c:483
char * get_node_name(uint32_t nodeid)
Definition: cluster.c:529
crm_node_t * crm_remote_peer_get(const char *node_name)
Definition: membership.c:1489
enum cluster_type_e get_cluster_type(void)
Definition: cluster.c:504
crm_ais_msg_class
Definition: cluster.h:189
gboolean crm_cluster_connect(pcmk_cluster_t *cluster)
Definition: cluster.c:477
gboolean cluster_connect_cpg(pcmk_cluster_t *cluster)
Definition: cpg.c:1110
uint32_t get_local_nodeid(cpg_handle_t handle)
Definition: cpg.c:1122
void crm_remote_peer_cache_refresh(xmlNode *cib)
Definition: membership.c:1483
void crm_peer_init(void)
Definition: membership.c:1546
Invalid cluster layer.
Definition: cluster.h:227
char uname[MAX_NAME]
Definition: cpg.c:53
void cluster_disconnect_cpg(pcmk_cluster_t *cluster)
Definition: cpg.c:1116
Unknown cluster layer.
Definition: cluster.h:226
crm_get_peer_flags
Definition: compat.h:39
void crm_set_autoreap(gboolean enable)
Definition: membership.c:1558
uint64_t flags
Definition: remote.c:215
void pcmk_cpg_membership(cpg_handle_t handle, const struct cpg_name *group_name, const struct cpg_address *member_list, size_t member_list_entries, const struct cpg_address *left_list, size_t left_list_entries, const struct cpg_address *joined_list, size_t joined_list_entries)
Definition: cpg.c:1128