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

Function lrmd_ipc_dispatch

lrmd/main.c:107–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107static int32_t
108lrmd_ipc_dispatch(qb_ipcs_connection_t * c, void *data, size_t size)
109{
110 uint32_t id = 0;
111 uint32_t flags = 0;
112 xmlNode *request = crm_ipcs_recv(c, data, size, &id, &flags);
113 lrmd_client_t *client = (lrmd_client_t *) qb_ipcs_context_get(c);
114
115 CRM_CHECK(client != NULL, crm_err("Invalid client");
116 return FALSE);
117 CRM_CHECK(client->id != NULL, crm_err("Invalid client: %p", client);
118 return FALSE);
119
120 CRM_CHECK(flags & crm_ipc_client_response, crm_err("Invalid client request: %p", client);
121 return FALSE);
122
123 if (!request) {
124 return 0;
125 }
126
127 if (!client->name) {
128 const char *value = crm_element_value(request, F_LRMD_CLIENTNAME);
129
130 if (value == NULL) {
131 client->name = crm_itoa(crm_ipcs_client_pid(c));
132 } else {
133 client->name = strdup(value);
134 }
135 }
136
137 global_call_id++;
138 if (global_call_id < 1) {
139 global_call_id = 1;
140 }
141
142 crm_xml_add(request, F_LRMD_CLIENTID, client->id);
143 crm_xml_add(request, F_LRMD_CLIENTNAME, client->name);
144 crm_xml_add_int(request, F_LRMD_CALLID, global_call_id);
145
146 process_lrmd_message(client, id, request);
147
148 free_xml(request);
149 return 0;
150}
151
152static int32_t
153lrmd_ipc_closed(qb_ipcs_connection_t * c)

Callers

nothing calls this directly

Calls 8

crm_ipcs_recvFunction · 0.85
crm_element_valueFunction · 0.85
crm_itoaFunction · 0.85
crm_ipcs_client_pidFunction · 0.85
crm_xml_addFunction · 0.85
crm_xml_add_intFunction · 0.85
process_lrmd_messageFunction · 0.85
free_xmlFunction · 0.85

Tested by

no test coverage detected