| 4977 | } |
| 4978 | |
| 4979 | char* pv_parse_spec(const str *in, const pv_spec_p e) |
| 4980 | { |
| 4981 | char *p; |
| 4982 | str s; |
| 4983 | str pvname; |
| 4984 | str pvcontext; |
| 4985 | int pvstate; |
| 4986 | int has_inner_name; |
| 4987 | trans_t *tr = NULL; |
| 4988 | const pv_export_t *pte = NULL; |
| 4989 | int n=0; |
| 4990 | |
| 4991 | if(in==NULL || in->s==NULL || e==NULL || *in->s!=PV_MARKER) |
| 4992 | { |
| 4993 | LM_ERR("bad parameters\n"); |
| 4994 | return NULL; |
| 4995 | } |
| 4996 | |
| 4997 | // LM_DBG("***** input [%.*s] (%d)\n", in->len, in->s, in->len); |
| 4998 | tr = 0; |
| 4999 | pvstate = 0; |
| 5000 | memset(e, 0, sizeof(pv_spec_t)); |
| 5001 | p = in->s; |
| 5002 | p++; |
| 5003 | if(*p==PV_LNBRACKET) |
| 5004 | { |
| 5005 | p++; |
| 5006 | pvstate = 1; |
| 5007 | } |
| 5008 | pvname.s = p; |
| 5009 | if(*p == PV_MARKER) { |
| 5010 | p++; |
| 5011 | if(pvstate==1) |
| 5012 | { |
| 5013 | if(*p!=PV_RNBRACKET) |
| 5014 | goto error; |
| 5015 | p++; |
| 5016 | } |
| 5017 | e->getf = pv_get_marker; |
| 5018 | e->type = PVT_MARKER; |
| 5019 | pvname.len = 1; |
| 5020 | goto done_all; |
| 5021 | } |
| 5022 | |
| 5023 | if (*p==PV_LCBRACKET) |
| 5024 | { /* context definition*/ |
| 5025 | p++; |
| 5026 | pvcontext.s = p; |
| 5027 | |
| 5028 | while(is_in_str(p,in) && is_pv_valid_char(*p)) |
| 5029 | p++; |
| 5030 | |
| 5031 | if(*p != PV_RCBRACKET) |
| 5032 | { |
| 5033 | LM_ERR("Expected to find the end of the context\n"); |
| 5034 | return 0; |
| 5035 | } |
| 5036 | pvcontext.len = p - pvcontext.s; |
no test coverage detected