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

Function tr_parse_csv

transformations.c:3617–3668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3615}
3616
3617int tr_parse_csv(str *in, trans_t *t)
3618{
3619 char *p;
3620 str name;
3621 tr_param_t *tp = NULL;
3622
3623 if (in == NULL || t == NULL)
3624 return -1;
3625
3626 p = in->s;
3627 name.s = in->s;
3628
3629 /* find next token */
3630 while (is_in_str(p,in) && *p!=TR_PARAM_MARKER && *p!=TR_RBRACKET) p++;
3631 if (*p == '\0')
3632 {
3633 LM_ERR("invalid transformation: %.*s\n",in->len,in->s);
3634 return -1;
3635 }
3636
3637 name.len = p - name.s;
3638 trim(&name);
3639
3640 if (name.len==5 && strncasecmp(name.s,"count",5)==0)
3641 {
3642 t->subtype = TR_CSV_COUNT;
3643 return 0;
3644 }
3645 else if (name.len==5 && strncasecmp(name.s,"value",5)==0)
3646 {
3647 t->subtype = TR_CSV_VALUEAT;
3648 if(*p!=TR_PARAM_MARKER)
3649 {
3650 LM_ERR("invalid name transformation: %.*s\n",
3651 in->len, in->s);
3652 goto error;
3653 }
3654 p++;
3655 if (tr_parse_nparam(p, in, &tp) == NULL)
3656 goto error;
3657 t->params = tp;
3658 tp = 0;
3659
3660 return 0;
3661 }
3662
3663 LM_ERR("unknown transformation: %.*s/%.*s/%d!\n", in->len, in->s,
3664 name.len, name.s, name.len);
3665error:
3666 return -1;
3667
3668}
3669
3670int tr_parse_sdp(str *in, trans_t *t)
3671{

Callers

nothing calls this directly

Calls 2

trimFunction · 0.85
tr_parse_nparamFunction · 0.85

Tested by

no test coverage detected