| 3668 | } |
| 3669 | |
| 3670 | int tr_parse_sdp(str *in, trans_t *t) |
| 3671 | { |
| 3672 | int tmp; |
| 3673 | char *p; |
| 3674 | str name; |
| 3675 | tr_param_t *tp = NULL; |
| 3676 | |
| 3677 | if (in == NULL || t == NULL) |
| 3678 | return -1; |
| 3679 | |
| 3680 | p = in->s; |
| 3681 | name.s = in->s; |
| 3682 | |
| 3683 | /* find next token */ |
| 3684 | while (is_in_str(p,in) && *p!=TR_PARAM_MARKER && *p!=TR_RBRACKET) p++; |
| 3685 | if (*p == '\0') |
| 3686 | { |
| 3687 | LM_ERR("invalid transformation: %.*s\n",in->len,in->s); |
| 3688 | return -1; |
| 3689 | } |
| 3690 | |
| 3691 | name.len = p - name.s; |
| 3692 | trim(&name); |
| 3693 | |
| 3694 | if (name.len==4 && strncasecmp(name.s,"line",4)==0) |
| 3695 | { |
| 3696 | t->subtype = TR_SDP_LINEAT; |
| 3697 | if(*p!=TR_PARAM_MARKER) |
| 3698 | { |
| 3699 | LM_ERR("invalid lineat transformation: %.*s!\n", in->len, in->s); |
| 3700 | goto error; |
| 3701 | } |
| 3702 | p++; |
| 3703 | if ((p = tr_parse_sparam(p, in, &tp, 0)) == NULL) |
| 3704 | goto error; |
| 3705 | t->params = tp; |
| 3706 | tp = 0; |
| 3707 | trim_ws(p); |
| 3708 | if(*p!=TR_PARAM_MARKER) |
| 3709 | { |
| 3710 | /* lineat has only one parameter */ |
| 3711 | tp = (tr_param_t*)pkg_malloc(sizeof(tr_param_t)); |
| 3712 | if (!tp) |
| 3713 | { |
| 3714 | LM_ERR("no more pkg memory\n"); |
| 3715 | goto error; |
| 3716 | } |
| 3717 | memset(tp, 0, sizeof(tr_param_t)); |
| 3718 | tp->type = TR_PARAM_NUMBER; |
| 3719 | tp->v.n = 0; |
| 3720 | t->params->next = tp; |
| 3721 | LM_DBG("sdp.lineat with only one parameter. default = 1\n"); |
| 3722 | return 0; |
| 3723 | } |
| 3724 | p++; |
| 3725 | |
| 3726 | if (tr_parse_nparam(p, in, &tp) == NULL) |
| 3727 | goto error; |
nothing calls this directly
no test coverage detected