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

Function parse_nameaddr

parser/parse_nameaddr.c:37–70  ·  view source on GitHub ↗

* Parse name-addr part, the given string can be longer, * parsing will stop when closing > is found */

Source from the content-addressed store, hash-verified

35 * parsing will stop when closing > is found
36 */
37int parse_nameaddr(str* _s, name_addr_t* _a)
38{
39 char* uri_end;
40
41 if (!_s || !_a) {
42 LM_ERR("invalid parameter value\n");
43 return -1;
44 }
45
46 _a->name.s = _s->s;
47
48 _a->uri.s = find_not_quoted(_s, '<');
49 if (_a->uri.s) {
50 _a->name.len = _a->uri.s - _a->name.s;
51 _a->uri.s++; /* We will skip < character */
52 } else {
53 LM_ERR("no < found\n");
54 return -3;
55 }
56
57 _a->uri.len = _s->len - _a->name.len - 1;
58 uri_end = find_not_quoted(&_a->uri, '>');
59
60 if (!uri_end) {
61 LM_ERR("no > found\n");
62 return -4;
63 }
64
65 /* Total length of the field including <> */
66 _a->len = uri_end - _a->name.s + 1;
67
68 _a->uri.len = uri_end - _a->uri.s;
69 return 0;
70}
71
72
73/*

Callers 3

is_rpid_user_e164Function · 0.85
assemble_msgFunction · 0.85
do_parse_rr_bodyFunction · 0.85

Calls 1

find_not_quotedFunction · 0.85

Tested by

no test coverage detected