| 251 | } |
| 252 | |
| 253 | static attr_hash_entry_t * |
| 254 | find_hash_entry(xmlNode * msg) |
| 255 | { |
| 256 | const char *value = NULL; |
| 257 | const char *attr = crm_element_value(msg, F_ATTRD_ATTRIBUTE); |
| 258 | attr_hash_entry_t *hash_entry = NULL; |
| 259 | |
| 260 | if (attr == NULL) { |
| 261 | crm_info("Ignoring message with no attribute name"); |
| 262 | return NULL; |
| 263 | } |
| 264 | |
| 265 | hash_entry = g_hash_table_lookup(attr_hash, attr); |
| 266 | |
| 267 | if (hash_entry == NULL) { |
| 268 | /* create one and add it */ |
| 269 | crm_info("Creating hash entry for %s", attr); |
| 270 | hash_entry = calloc(1, sizeof(attr_hash_entry_t)); |
| 271 | hash_entry->id = strdup(attr); |
| 272 | |
| 273 | g_hash_table_insert(attr_hash, hash_entry->id, hash_entry); |
| 274 | hash_entry = g_hash_table_lookup(attr_hash, attr); |
| 275 | CRM_CHECK(hash_entry != NULL, return NULL); |
| 276 | } |
| 277 | |
| 278 | value = crm_element_value(msg, F_ATTRD_SET); |
| 279 | if (value != NULL) { |
| 280 | free(hash_entry->set); |
| 281 | hash_entry->set = strdup(value); |
| 282 | crm_debug("\t%s->set: %s", attr, value); |
| 283 | } |
| 284 | |
| 285 | value = crm_element_value(msg, F_ATTRD_SECTION); |
| 286 | if (value == NULL) { |
| 287 | value = XML_CIB_TAG_STATUS; |
| 288 | } |
| 289 | free(hash_entry->section); |
| 290 | hash_entry->section = strdup(value); |
| 291 | crm_trace("\t%s->section: %s", attr, value); |
| 292 | |
| 293 | value = crm_element_value(msg, F_ATTRD_DAMPEN); |
| 294 | if (value != NULL) { |
| 295 | free(hash_entry->dampen); |
| 296 | hash_entry->dampen = strdup(value); |
| 297 | |
| 298 | hash_entry->timeout = crm_get_msec(value); |
| 299 | crm_trace("\t%s->timeout: %s", attr, value); |
| 300 | } |
| 301 | #if ENABLE_ACL |
| 302 | free(hash_entry->user); |
| 303 | |
| 304 | value = crm_element_value(msg, F_ATTRD_USER); |
| 305 | if (value != NULL) { |
| 306 | hash_entry->user = strdup(value); |
| 307 | crm_trace("\t%s->user: %s", attr, value); |
| 308 | } |
| 309 | #endif |
| 310 |
no test coverage detected