| 2858 | |
| 2859 | |
| 2860 | static int pv_resolve_hdr_name(const str *in, pv_value_t *tv) |
| 2861 | { |
| 2862 | struct hdr_field hdr; |
| 2863 | str s; |
| 2864 | if(in->len>=PV_LOCAL_BUF_SIZE-1) |
| 2865 | { |
| 2866 | LM_ERR("name too long\n"); |
| 2867 | return -1; |
| 2868 | } |
| 2869 | memcpy(pv_local_buf, in->s, in->len); |
| 2870 | pv_local_buf[in->len] = ':'; |
| 2871 | s.s = pv_local_buf; |
| 2872 | s.len = in->len+1; |
| 2873 | |
| 2874 | if (parse_hname2(s.s, s.s + ((s.len<4)?4:s.len), &hdr)==0) |
| 2875 | { |
| 2876 | LM_ERR("error parsing header name [%.*s]\n", s.len, s.s); |
| 2877 | return -1; |
| 2878 | } |
| 2879 | if (hdr.type!=HDR_OTHER_T && hdr.type!=HDR_ERROR_T) |
| 2880 | { |
| 2881 | LM_DBG("using hdr type (%d) instead of <%.*s>\n", |
| 2882 | hdr.type, in->len, in->s); |
| 2883 | tv->flags = 0; |
| 2884 | tv->ri = hdr.type; |
| 2885 | } else { |
| 2886 | tv->flags = PV_VAL_STR; |
| 2887 | tv->rs = *in; |
| 2888 | } |
| 2889 | return 0; |
| 2890 | } |
| 2891 | |
| 2892 | static int pv_get_hdr_prolog(struct sip_msg *msg, pv_param_t *param, pv_value_t *res, pv_value_t* tv) |
| 2893 | { |
no test coverage detected