| 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 | { |
| 2894 | if(msg==NULL || res==NULL || param==NULL) |
| 2895 | return -1; |
| 2896 | |
| 2897 | /* get the name */ |
| 2898 | if(param->pvn.type == PV_NAME_PVAR) |
| 2899 | { |
| 2900 | if(pv_get_spec_name(msg, param, tv)!=0 || (!(tv->flags&PV_VAL_STR))) |
| 2901 | { |
| 2902 | LM_ERR("invalid name\n"); |
| 2903 | return -1; |
| 2904 | } |
| 2905 | if (pv_resolve_hdr_name(&tv->rs, tv) < 0) |
| 2906 | return -1; |
| 2907 | } else { |
| 2908 | if(param->pvn.u.isname.type == AVP_NAME_STR) |
| 2909 | { |
| 2910 | tv->flags = PV_VAL_STR; |
| 2911 | tv->rs = param->pvn.u.isname.name.s; |
| 2912 | } else { |
| 2913 | tv->flags = 0; |
| 2914 | tv->ri = param->pvn.u.isname.name.n; |
| 2915 | } |
| 2916 | } |
| 2917 | /* we need to be sure we have parsed all headers */ |
| 2918 | if(parse_headers(msg, HDR_EOH_F, 0)<0) |
| 2919 | { |
| 2920 | LM_ERR("error parsing headers\n"); |
| 2921 | return pv_get_null(msg, param, res); |
| 2922 | } |
| 2923 | return 1; |
| 2924 | } |
| 2925 | |
| 2926 | static int pv_get_hdrcnt(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) |
| 2927 | { |
no test coverage detected