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

Function tr_parse_paramlist

transformations.c:3443–3534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3441}
3442
3443int tr_parse_paramlist(str* in, trans_t *t)
3444{
3445 char *p;
3446 str name;
3447 tr_param_t *tp = NULL;
3448
3449 if(in==NULL || in->s==NULL || t==NULL)
3450 return -1;
3451
3452 p = in->s;
3453 name.s = in->s;
3454
3455 /* find next token */
3456 while(is_in_str(p, in) && *p!=TR_PARAM_MARKER && *p!=TR_RBRACKET) p++;
3457 if(*p=='\0')
3458 {
3459 LM_ERR("invalid transformation: %.*s\n",
3460 in->len, in->s);
3461 goto error;
3462 }
3463 name.len = p - name.s;
3464 trim(&name);
3465
3466 if(name.len==5 && strncasecmp(name.s, "value", 5)==0)
3467 {
3468 t->subtype = TR_PL_VALUE;
3469 if(*p!=TR_PARAM_MARKER)
3470 {
3471 LM_ERR("invalid value transformation: %.*s\n",
3472 in->len, in->s);
3473 goto error;
3474 }
3475 p++;
3476 if (tr_parse_sparam(p, in, &tp, 0) == NULL)
3477 goto error;
3478 t->params = tp;
3479
3480 return 0;
3481
3482 } else if(str_match(&name, &(str_const_init("exist")))
3483 || str_match(&name, &(str_const_init("exists")))) {
3484 t->subtype = TR_PL_EXIST;
3485 if(*p!=TR_PARAM_MARKER)
3486 {
3487 LM_ERR("invalid value transformation: %.*s\n",
3488 in->len, in->s);
3489 goto error;
3490 }
3491 p++;
3492 if (tr_parse_sparam(p, in, &tp, 0) == NULL)
3493 goto error;
3494 t->params = tp;
3495
3496 return 0;
3497 } else if(name.len==7 && strncasecmp(name.s, "valueat", 7)==0) {
3498 t->subtype = TR_PL_VALUEAT;
3499 if(*p!=TR_PARAM_MARKER)
3500 {

Callers

nothing calls this directly

Calls 4

trimFunction · 0.85
tr_parse_sparamFunction · 0.85
str_matchFunction · 0.85
tr_parse_nparamFunction · 0.85

Tested by

no test coverage detected