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

Function parse_token

parser/digest/digest_parser.c:114–156  ·  view source on GitHub ↗

* Parse unquoted token in a parameter body * let _r point to the token and update _s * to point right behind the token */

Source from the content-addressed store, hash-verified

112 * to point right behind the token
113 */
114static inline int parse_token(str* _s, str* _r)
115{
116 int i;
117
118 /* Save the beginning of the
119 * token in _r->s
120 */
121 _r->s = _s->s;
122
123 /* Iterate through the
124 * token body
125 */
126 for(i = 0; i < _s->len; i++) {
127
128 /* All LWS characters + ','
129 * mark end of the token
130 */
131 if (is_ws(_s->s[i]) || _s->s[i] == ',') {
132 /* So if you find
133 * any of them
134 * stop iterating
135 */
136 goto out;
137 }
138 }
139 out:
140 /* Empty token is error */
141 if (i == 0) {
142 return -2;
143 }
144
145 /* Save length of the token */
146 _r->len = i;
147
148 /* Update _s parameter so it points
149 * right behind the end of the token
150 */
151 _s->s = _s->s + i;
152 _s->len -= i;
153
154 /* Everything went OK */
155 return 0;
156}
157
158
159/*

Callers 1

parse_digest_paramFunction · 0.85

Calls 1

is_wsFunction · 0.85

Tested by

no test coverage detected