1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_CLUSTER_COMPAT__H
11 # define PCMK__CRM_CLUSTER_COMPAT__H
12
13 #include <stdint.h>
14 #include <sys/types.h>
15
16 #include <glib.h>
17 #include <libxml/tree.h>
18
19 #if SUPPORT_COROSYNC
20 #include <corosync/cpg.h>
21 #endif
22
23 #include <crm/cluster.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29
30
31
32
33
34
35
36
37
38
39 enum crm_get_peer_flags {
40 CRM_GET_PEER_CLUSTER = 0x0001,
41 CRM_GET_PEER_REMOTE = 0x0002,
42 CRM_GET_PEER_ANY = CRM_GET_PEER_CLUSTER|CRM_GET_PEER_REMOTE,
43 };
44
45
46
47 typedef pcmk_cluster_t crm_cluster_t;
48
49
50 crm_node_t *crm_get_peer(unsigned int id, const char *uname);
51
52
53 crm_node_t *crm_get_peer_full(unsigned int id, const char *uname, int flags);
54
55
56 int crm_terminate_member(int nodeid, const char *uname, void *unused);
57
58
59 int crm_terminate_member_no_mainloop(int nodeid, const char *uname,
60 int *connection);
61
62
63
64
65
66
67 void set_uuid(xmlNode *xml, const char *attr, crm_node_t *node);
68
69 #if SUPPORT_COROSYNC
70
71
72 gboolean cluster_connect_cpg(pcmk_cluster_t *cluster);
73
74
75 void cluster_disconnect_cpg(pcmk_cluster_t *cluster);
76
77
78 uint32_t get_local_nodeid(cpg_handle_t handle);
79
80
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
90
91 gboolean crm_is_corosync_peer_active(const crm_node_t * node);
92
93
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
98
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
103
104
105
106 gboolean crm_cluster_connect(pcmk_cluster_t *cluster);
107
108
109 void crm_cluster_disconnect(pcmk_cluster_t *cluster);
110
111
112 int crm_remote_peer_cache_size(void);
113
114
115 void crm_remote_peer_cache_refresh(xmlNode *cib);
116
117
118 crm_node_t *crm_remote_peer_get(const char *node_name);
119
120
121 void crm_remote_peer_cache_remove(const char *node_name);
122
123
124 gboolean crm_is_peer_active(const crm_node_t *node);
125
126
127 guint crm_active_peers(void);
128
129
130 guint reap_crm_member(uint32_t id, const char *name);
131
132
133
134
135 enum cluster_type_e {
136
137 pcmk_cluster_unknown = pcmk_cluster_layer_unknown,
138
139 pcmk_cluster_invalid = pcmk_cluster_layer_invalid,
140
141
142 pcmk_cluster_corosync = pcmk_cluster_layer_corosync,
143 };
144
145
146
147
148 const char *name_for_cluster_type(enum cluster_type_e type);
149
150
151
152 enum cluster_type_e get_cluster_type(void);
153
154
155 gboolean is_corosync_cluster(void);
156
157
158 void crm_peer_init(void);
159
160
161 void crm_peer_destroy(void);
162
163
164 gboolean send_cluster_message(const crm_node_t *node,
165 enum crm_ais_msg_types service,
166 const xmlNode *data, gboolean ordered);
167
168
169 const char *crm_peer_uuid(crm_node_t *node);
170
171
172 enum crm_ais_msg_types text2msg_type(const char *text);
173
174
175 char *get_node_name(uint32_t nodeid);
176
177
178 const char *get_local_node_name(void);
179
180
181 void crm_set_autoreap(gboolean enable);
182
183
184 void crm_set_status_callback(void (*dispatch)(enum crm_status_type,
185 crm_node_t *, const void *));
186
187
188 const char *crm_peer_uname(const char *uuid);
189
190 #ifdef __cplusplus
191 }
192 #endif
193
194 #endif