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

Function parse_hname2

parser/parse_hname2.c:183–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182
183char* parse_hname2(char* begin, char* end, struct hdr_field* hdr)
184{
185 register char* p;
186 register unsigned int val;
187
188 if ((end - begin) < 4) {
189 hdr->type = HDR_ERROR_T;
190 return begin;
191 }
192
193 p = begin;
194
195 val = LOWER_DWORD(READ(p));
196 hdr->name.s = begin;
197
198 switch(val) {
199
200 FIRST_QUATERNIONS;
201 /* fall through */
202
203 default:
204 switch(LOWER_BYTE(*p)) {
205 case 't':
206 switch(LOWER_BYTE(*(p + 1))) {
207 case 'o':
208 p += 2;
209 hdr->type = HDR_TO_T;
210 hdr->name.len = 2;
211 goto dc_cont;
212 case ' ':
213 case '\t':
214 p += 2;
215 hdr->type = HDR_TO_T;
216 hdr->name.len = 1;
217 goto dc_end;
218 case ':':
219 hdr->type = HDR_TO_T;
220 hdr->name.len = 1;
221 return (p + 2);
222 }
223 break;
224 case 'v': PARSE_COMPACT(HDR_VIA_T); break;
225 case 'f': PARSE_COMPACT(HDR_FROM_T); break;
226 case 'i': PARSE_COMPACT(HDR_CALLID_T); break;
227 case 'm': PARSE_COMPACT(HDR_CONTACT_T); break;
228 case 'l': PARSE_COMPACT(HDR_CONTENTLENGTH_T); break;
229 case 'k': PARSE_COMPACT(HDR_SUPPORTED_T); break;
230 case 'c': PARSE_COMPACT(HDR_CONTENTTYPE_T); break;
231 case 'o': PARSE_COMPACT(HDR_EVENT_T); break;
232 case 'x': PARSE_COMPACT(HDR_SESSION_EXPIRES_T); break;
233 }
234 goto other;
235 }
236 /* the above swtich will never continue here */
237
238
239 dc_end:
240 /* HDR name entirely found, consume WS till colon */

Callers 6

pv_resolve_hdr_nameFunction · 0.85
fixup_parse_hnameFunction · 0.85
search_hdrFunction · 0.85
extract_mangled_touriFunction · 0.85
extract_mangled_fromuriFunction · 0.85
get_sdp_hdr_fieldFunction · 0.85

Calls 1

skip_wsFunction · 0.85

Tested by

no test coverage detected