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

Function comp_scriptvar

route.c:654–783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

652
653
654inline static int comp_scriptvar(struct sip_msg *msg, int op, operand_t *left,
655 operand_t *right)
656{
657 str lstr;
658 str rstr;
659 int ln;
660 int rn;
661 pv_value_t lvalue;
662 pv_value_t rvalue;
663 int type;
664 struct net *rnet;
665
666 lstr.s = 0; lstr.len = 0;
667 rstr.s = 0; rstr.len = 0;
668 ln = 0; rn =0;
669
670 if(pv_get_spec_value(msg, left->v.spec, &lvalue)!=0)
671 {
672 LM_ERR("cannot get left var value\n");
673 goto error;
674 }
675 if(right->type==NULLV_ST)
676 {
677 if(op==EQUAL_OP)
678 {
679 if(lvalue.flags&PV_VAL_NULL)
680 return 1;
681 return 0;
682 } else {
683 if(lvalue.flags&PV_VAL_NULL)
684 return 0;
685 return 1;
686 }
687 }
688
689 lstr = lvalue.rs;
690 ln = lvalue.ri;
691 type = 0;
692 rvalue.flags = 0; /*just for err printing purposes */
693
694 if(right->type == SCRIPTVAR_ST)
695 {
696 if(pv_get_spec_value(msg, right->v.spec, &rvalue)!=0)
697 {
698 LM_ERR("cannot get right var value\n");
699 goto error;
700 }
701 if(rvalue.flags&PV_VAL_NULL || lvalue.flags&PV_VAL_NULL ) {
702 if (rvalue.flags&PV_VAL_NULL && lvalue.flags&PV_VAL_NULL )
703 return (op==EQUAL_OP || op==MATCH_OP || op==MATCHD_OP)?1:0;
704 return (op==DIFF_OP || op==NOTMATCH_OP || op==NOTMATCHD_OP)?1:0;
705 }
706
707 if(op==MATCH_OP||op==NOTMATCH_OP)
708 {
709 if(!((rvalue.flags&PV_VAL_STR) && (lvalue.flags&PV_VAL_STR)))
710 goto error_op;
711 if(op==MATCH_OP)

Callers 1

eval_elemFunction · 0.85

Calls 7

pv_get_spec_valueFunction · 0.85
comp_s2sFunction · 0.85
comp_n2nFunction · 0.85
comp_ipFunction · 0.85
op_id_2_stringFunction · 0.85
expr_type_2_stringFunction · 0.85
val_type_2_stringFunction · 0.85

Tested by

no test coverage detected