| 2924 | } |
| 2925 | |
| 2926 | static int pv_get_hdrcnt(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) |
| 2927 | { |
| 2928 | pv_value_t tv; |
| 2929 | struct hdr_field *hf; |
| 2930 | unsigned int n; |
| 2931 | int ret; |
| 2932 | |
| 2933 | if ( (ret=pv_get_hdr_prolog(msg, param, res, &tv)) <= 0 ) |
| 2934 | return ret; |
| 2935 | |
| 2936 | n = 0; |
| 2937 | if (tv.flags==0) { |
| 2938 | /* it is a known header -> use type to find it */ |
| 2939 | for (hf=msg->headers; hf; hf=hf->next) { |
| 2940 | if (tv.ri==hf->type) |
| 2941 | ++n; |
| 2942 | } |
| 2943 | } else { |
| 2944 | /* it is an un-known header -> use name to find it */ |
| 2945 | for (hf=msg->headers; hf; hf=hf->next) { |
| 2946 | if (hf->type==HDR_OTHER_T && hf->name.len==tv.rs.len |
| 2947 | && strncasecmp(hf->name.s, tv.rs.s, hf->name.len)==0) |
| 2948 | ++n; |
| 2949 | } |
| 2950 | } |
| 2951 | return pv_get_uintval(msg, param, res, n); |
| 2952 | } |
| 2953 | |
| 2954 | static int pv_get_hdr(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) |
| 2955 | { |
nothing calls this directly
no test coverage detected