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

Function pv_parse_hdr_name

pvar.c:3885–3932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3883}
3884
3885static int pv_parse_hdr_name(pv_spec_p sp, const str *in)
3886{
3887 char *p;
3888 pv_spec_p nsp = 0;
3889 pv_value_t tv;
3890
3891 if(in==NULL || in->s==NULL || sp==NULL)
3892 return -1;
3893
3894 p = in->s;
3895 if(*p==PV_MARKER)
3896 {
3897 nsp = (pv_spec_p)pkg_malloc(sizeof(pv_spec_t));
3898 if(nsp==NULL)
3899 {
3900 LM_ERR("no more memory\n");
3901 return -1;
3902 }
3903 p = pv_parse_spec(in, nsp);
3904 if(p==NULL)
3905 {
3906 LM_ERR("invalid name [%.*s]\n", in->len, in->s);
3907 pv_spec_free(nsp);
3908 return -1;
3909 }
3910 //LM_ERR("dynamic name [%.*s]\n", in->len, in->s);
3911 //pv_print_spec(nsp);
3912 sp->pvp.pvn.type = PV_NAME_PVAR;
3913 sp->pvp.pvn.u.dname = (void*)nsp;
3914 return 0;
3915 }
3916
3917 if (pv_resolve_hdr_name(in, &tv) < 0)
3918 return -1;
3919
3920 sp->pvp.pvn.type = PV_NAME_INTSTR;
3921 if (!tv.flags)
3922 {
3923 LM_DBG("using hdr type (%d) instead of <%.*s>\n",
3924 tv.ri, in->len, in->s);
3925 sp->pvp.pvn.u.isname.type = 0;
3926 sp->pvp.pvn.u.isname.name.n = tv.ri;
3927 } else {
3928 sp->pvp.pvn.u.isname.type = AVP_NAME_STR;
3929 sp->pvp.pvn.u.isname.name.s = *in;
3930 }
3931 return 0;
3932}
3933
3934int pv_parse_avp_name(pv_spec_p sp, const str *in)
3935{

Callers

nothing calls this directly

Calls 3

pv_parse_specFunction · 0.85
pv_spec_freeFunction · 0.85
pv_resolve_hdr_nameFunction · 0.85

Tested by

no test coverage detected