| 105 | } |
| 106 | |
| 107 | static int32_t |
| 108 | lrmd_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 | |
| 152 | static int32_t |
| 153 | lrmd_ipc_closed(qb_ipcs_connection_t * c) |
nothing calls this directly
no test coverage detected