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

Function pv_parse_avp_name

pvar.c:3934–3974  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3932}
3933
3934int pv_parse_avp_name(pv_spec_p sp, const str *in)
3935{
3936 char *p;
3937 char *s;
3938 pv_spec_p nsp = 0;
3939
3940 if(in==NULL || in->s==NULL || sp==NULL)
3941 return -1;
3942 p = in->s;
3943 if(*p==PV_MARKER)
3944 {
3945 nsp = (pv_spec_p)pkg_malloc(sizeof(pv_spec_t));
3946 if(nsp==NULL)
3947 {
3948 LM_ERR("no more memory\n");
3949 return -1;
3950 }
3951 s = pv_parse_spec(in, nsp);
3952 if(s==NULL)
3953 {
3954 LM_ERR("invalid name [%.*s]\n", in->len, in->s);
3955 pv_spec_free(nsp);
3956 return -1;
3957 }
3958 //LM_ERR("dynamic name [%.*s]\n", in->len, in->s);
3959 //pv_print_spec(nsp);
3960 sp->pvp.pvn.type = PV_NAME_PVAR;
3961 sp->pvp.pvn.u.dname = (void*)nsp;
3962 return 0;
3963 }
3964 /*LM_DBG("static name [%.*s]\n", in->len, in->s);*/
3965 /* always an int type from now */
3966 sp->pvp.pvn.u.isname.type = 0;
3967 if(parse_avp_spec(in, &sp->pvp.pvn.u.isname.name.n)!=0)
3968 {
3969 LM_ERR("bad avp name [%.*s]\n", in->len, in->s);
3970 return -1;
3971 }
3972 sp->pvp.pvn.type = PV_NAME_INTSTR;
3973 return 0;
3974}
3975
3976static int pv_parse_avp_index(pv_spec_p sp, const str *in)
3977{

Callers

nothing calls this directly

Calls 3

pv_parse_specFunction · 0.85
pv_spec_freeFunction · 0.85
parse_avp_specFunction · 0.85

Tested by

no test coverage detected