MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / check_expr

Function check_expr

route.c:1793–1842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1791}
1792
1793static int check_expr(struct expr* exp, int r_type)
1794{
1795 int ret = -1;
1796
1797 if (exp==0) {
1798 LM_CRIT("null pointer\n");
1799 return -1;
1800 }
1801
1802 if (exp->type==EXP_T){
1803 switch(exp->op){
1804 case AND_OP:
1805 case OR_OP:
1806 if (check_expr(exp->left.v.expr, r_type) < 0)
1807 return -1;
1808 return check_expr(exp->right.v.expr, r_type);
1809 case NOT_OP:
1810 case EVAL_OP:
1811 return check_expr(exp->left.v.expr, r_type);
1812 default:
1813 LM_CRIT("unknown op %d\n", exp->op);
1814 return -1;
1815 }
1816 } else if (exp->type==ELEM_T){
1817 if (exp->left.type==ACTION_O){
1818 ret=check_actions((struct action*)exp->right.v.data, r_type);
1819 if (ret!=0){
1820 LM_CRIT("check_actions error\n");
1821 return ret;
1822 }
1823 }
1824 if (exp->left.type==EXPR_O){
1825 ret=check_expr(exp->left.v.expr, r_type);
1826 if (ret!=0){
1827 LM_CRIT("check left exp error\n");
1828 return ret;
1829 }
1830 }
1831 if (exp->right.type==EXPR_ST){
1832 ret=check_expr(exp->right.v.expr, r_type);
1833 if (ret!=0){
1834 LM_CRIT("fix right exp error\n");
1835 return ret;
1836 }
1837 }
1838 ret=0;
1839 }
1840
1841 return ret;
1842}
1843
1844
1845/*! \brief check all parsed routing tables for compatiblity between

Callers 1

check_actionsFunction · 0.85

Calls 1

check_actionsFunction · 0.85

Tested by

no test coverage detected