| 355 | } |
| 356 | |
| 357 | static int path_eval_vars(struct sip_msg* msg, xml_path_t *path) |
| 358 | { |
| 359 | pv_value_t val; |
| 360 | xml_element_t *el; |
| 361 | |
| 362 | memset(&val, 0, sizeof(pv_value_t)); |
| 363 | |
| 364 | for (el = path->elements; el; el = el->next) { |
| 365 | if (el->var_flags & EL_VAR_TAG) { |
| 366 | if( pv_get_spec_value(msg, &el->tag_var ,&val) < 0) { |
| 367 | LM_ERR("Unable to get value from element variable\n"); |
| 368 | return -1; |
| 369 | } |
| 370 | if (!(val.flags & PV_VAL_STR)) { |
| 371 | LM_ERR("Non string value for element name\n"); |
| 372 | return -1; |
| 373 | } |
| 374 | el->tag = val.rs; |
| 375 | } |
| 376 | |
| 377 | if (el->var_flags & EL_VAR_IDX) { |
| 378 | if( pv_get_spec_value(msg, &el->idx_var ,&val) < 0) { |
| 379 | LM_ERR("Unable to get value from index variable\n"); |
| 380 | return -1; |
| 381 | } |
| 382 | if (!(val.flags & PV_VAL_INT)) { |
| 383 | LM_ERR("Non integer value for index\n"); |
| 384 | return -1; |
| 385 | } |
| 386 | el->idx = val.ri; |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | if (path->attr_is_var) { |
| 391 | if( pv_get_spec_value(msg, &path->attr_var ,&val) < 0) { |
| 392 | LM_ERR("Unable to get value from attribute variable\n"); |
| 393 | return -1; |
| 394 | } |
| 395 | if (!(val.flags & PV_VAL_STR)) { |
| 396 | LM_ERR("Non string value for attribute name\n"); |
| 397 | return -1; |
| 398 | } |
| 399 | path->attr = val.rs; |
| 400 | } |
| 401 | |
| 402 | return 0; |
| 403 | } |
| 404 | |
| 405 | static xmlNode *get_node_by_path(xmlNode *root, xml_element_t *path_el) |
| 406 | { |
no test coverage detected