ret= 0! if action -> end of list(e.g DROP), > 0 to continue processing next actions and <0 on error */
| 639 | > 0 to continue processing next actions |
| 640 | and <0 on error */ |
| 641 | int do_action(struct action* a, struct sip_msg* msg) |
| 642 | { |
| 643 | int ret; |
| 644 | int v; |
| 645 | int i; |
| 646 | int len; |
| 647 | int cmatch; |
| 648 | struct action *aitem; |
| 649 | struct action *adefault; |
| 650 | pv_spec_t *spec; |
| 651 | pv_value_t val; |
| 652 | struct timeval start; |
| 653 | int end_time; |
| 654 | const cmd_export_t *cmd = NULL; |
| 655 | const acmd_export_t *acmd; |
| 656 | void* cmdp[MAX_CMD_PARAMS]; |
| 657 | pv_value_t tmp_vals[MAX_CMD_PARAMS]; |
| 658 | pv_value_t *route_p; |
| 659 | str sval; |
| 660 | |
| 661 | /* reset the value of error to E_UNSPEC so avoid unknowledgable |
| 662 | functions to return with error (status<0) and not setting it |
| 663 | leaving there previous error; cache the previous value though |
| 664 | for functions which want to process it */ |
| 665 | prev_ser_error=ser_error; |
| 666 | ser_error=E_UNSPEC; |
| 667 | |
| 668 | start_expire_timer(start,execmsgthreshold); |
| 669 | |
| 670 | curr_action_line = a->line; |
| 671 | curr_action_file = a->file; |
| 672 | |
| 673 | ret=E_BUG; |
| 674 | switch ((unsigned char)a->type){ |
| 675 | case ASSERT_T: |
| 676 | if (enable_asserts) { |
| 677 | /* if null expr => ignore if? */ |
| 678 | if ((a->elem[0].type==EXPR_ST)&&a->elem[0].u.data){ |
| 679 | v=eval_expr((struct expr*)a->elem[0].u.data, msg, 0); |
| 680 | |
| 681 | ret=1; /*default is continue */ |
| 682 | |
| 683 | if (v<=0) { |
| 684 | ret=0; |
| 685 | |
| 686 | if (a->elem[1].u.string) |
| 687 | LM_CRIT("ASSERTION FAILED (%s) at %s:%d\n", |
| 688 | a->elem[1].u.string, a->file, a->line); |
| 689 | else |
| 690 | LM_CRIT("ASSERTION FAILED at %s:%d\n", |
| 691 | a->file, a->line); |
| 692 | |
| 693 | if (abort_on_assert) { |
| 694 | abort(); |
| 695 | } else { |
| 696 | set_err_info(OSER_EC_ASSERT, OSER_EL_CRITIC, "assertion failed"); |
| 697 | set_err_reply(500, "server error"); |
| 698 |
no test coverage detected