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

Function tr_parse_re

transformations.c:3840–3886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3838}
3839
3840int tr_parse_re(str *in,trans_t *t)
3841{
3842 char *p;
3843 str name;
3844 tr_param_t *tp = NULL;
3845
3846 if (in == NULL || t == NULL)
3847 return -1;
3848
3849 p = in->s;
3850 name.s = in->s;
3851
3852 /* find next token */
3853 while (is_in_str(p,in) && *p!=TR_PARAM_MARKER && *p!=TR_RBRACKET) p++;
3854 if (*p == '\0')
3855 {
3856 LM_ERR("invalid transformation: %.*s\n",in->len,in->s);
3857 goto error;
3858 }
3859
3860 name.len = p - name.s;
3861 trim(&name);
3862
3863 if (name.len==5 && strncasecmp(name.s,"subst",5)==0)
3864 {
3865 t->subtype = TR_RE_SUBST;
3866 if(*p!=TR_PARAM_MARKER)
3867 {
3868 LM_ERR("invalid value transformation: %.*s\n",
3869 in->len, in->s);
3870 goto error;
3871 }
3872 p++;
3873 LM_DBG("preparing to parse param\n");
3874 if (tr_parse_sparam(p, in, &tp, 1) == NULL)
3875 goto error;
3876 t->params = tp;
3877 tp = 0;
3878
3879 return 0;
3880 }
3881
3882 LM_ERR("unknown transformation: %.*s/%.*s/%d!\n", in->len, in->s,
3883 name.len, name.s, name.len);
3884error:
3885 return -1;
3886}
3887
3888void free_transformation(trans_t *t)
3889{

Callers

nothing calls this directly

Calls 2

trimFunction · 0.85
tr_parse_sparamFunction · 0.85

Tested by

no test coverage detected