MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / cib_common_callback_worker

Function cib_common_callback_worker

cib/callbacks.c:212–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210};
211
212void
213cib_common_callback_worker(uint32_t id, uint32_t flags, xmlNode * op_request, cib_client_t * cib_client, gboolean privileged)
214{
215 const char *op = crm_element_value(op_request, F_CIB_OPERATION);
216
217 if (crm_str_eq(op, CRM_OP_REGISTER, TRUE)) {
218 if(flags & crm_ipc_client_response) {
219 xmlNode *ack = create_xml_node(NULL, __FUNCTION__);
220
221 crm_xml_add(ack, F_CIB_OPERATION, CRM_OP_REGISTER);
222 crm_xml_add(ack, F_CIB_CLIENTID, cib_client->id);
223 crm_ipcs_send(cib_client->ipc, id, ack, FALSE);
224 cib_client->request_id = 0;
225 free_xml(ack);
226 }
227 return;
228
229 } else if (crm_str_eq(op, T_CIB_NOTIFY, TRUE)) {
230 /* Update the notify filters for this client */
231 int on_off = 0;
232 const char *type = crm_element_value(op_request, F_CIB_NOTIFY_TYPE);
233 crm_element_value_int(op_request, F_CIB_NOTIFY_ACTIVATE, &on_off);
234
235 crm_debug("Setting %s callbacks for %s (%s): %s",
236 type, cib_client->name, cib_client->id, on_off ? "on" : "off");
237
238 if (safe_str_eq(type, T_CIB_POST_NOTIFY)) {
239 cib_client->post_notify = on_off;
240
241 } else if (safe_str_eq(type, T_CIB_PRE_NOTIFY)) {
242 cib_client->pre_notify = on_off;
243
244 } else if (safe_str_eq(type, T_CIB_UPDATE_CONFIRM)) {
245 cib_client->confirmations = on_off;
246
247 } else if (safe_str_eq(type, T_CIB_DIFF_NOTIFY)) {
248 cib_client->diffs = on_off;
249
250 } else if (safe_str_eq(type, T_CIB_REPLACE_NOTIFY)) {
251 cib_client->replace = on_off;
252 }
253
254 if(flags & crm_ipc_client_response) {
255 /* TODO - include rc */
256 crm_ipcs_send_ack(cib_client->ipc, id, "ack", __FUNCTION__, __LINE__);
257 cib_client->request_id = 0;
258 }
259 return;
260 }
261
262 cib_client->num_calls++;
263 cib_process_request(op_request, FALSE, privileged, FALSE, cib_client);
264}
265
266int32_t
267cib_common_callback(qb_ipcs_connection_t *c, void *data, size_t size, gboolean privileged)

Callers 2

cib_remote_msgFunction · 0.85
cib_common_callbackFunction · 0.85

Calls 9

crm_element_valueFunction · 0.85
crm_str_eqFunction · 0.85
create_xml_nodeFunction · 0.85
crm_xml_addFunction · 0.85
crm_ipcs_sendFunction · 0.85
free_xmlFunction · 0.85
crm_element_value_intFunction · 0.85
crm_ipcs_send_ackFunction · 0.85
cib_process_requestFunction · 0.85

Tested by

no test coverage detected