Browse code

core: log unexpected char in parse_param2()

Daniel-Constantin Mierla authored on 08/09/2021 06:04:06
Showing 1 changed files
... ...
@@ -514,7 +514,7 @@ static inline int parse_param2(
514 514
 		goto ok; /* To be able to parse URI parameters */
515 515
 
516 516
 	if(_s->s[0] != separator) {
517
-		LM_ERR("Invalid character, %c expected\n", separator);
517
+		LM_ERR("Invalid character '%c' - expected '%c'\n", _s->s[0], separator);
518 518
 		goto error;
519 519
 	}
520 520
 
Browse code

core: catch empty string on parsing params

Daniel-Constantin Mierla authored on 06/09/2021 12:56:36
Showing 1 changed files
... ...
@@ -584,7 +584,7 @@ int parse_params2(
584 584
 		memset(_h, 0, sizeof(param_hooks_t));
585 585
 	*_p = 0;
586 586
 
587
-	if(!_s->s) { /* no parameters at all -- we're done */
587
+	if(!_s->s || _s->len<=0) { /* no parameters at all -- we're done */
588 588
 		LM_DBG("empty uri params, skipping\n");
589 589
 		return 0;
590 590
 	}
Browse code

core/parser: Add parser for 'flags' param in Contact header

Alex Hermann authored on 31/01/2019 16:28:33 • Henning Westerholt committed on 11/02/2019 20:42:26
Showing 1 changed files
... ...
@@ -173,6 +173,14 @@ static inline void parse_contact_class(param_hooks_t *_h, param_t *_p)
173 173
 				_h->contact.ob = _p;
174 174
 			}
175 175
 			break;
176
+		case 'f':
177
+		case 'F':
178
+			if ((_p->name.len == 5) &&
179
+				(!strncasecmp(_p->name.s + 1, "lags", 4))) {
180
+				_p->type = P_FLAGS;
181
+				_h->contact.flags = _p;
182
+			}
183
+			break;
176 184
 	}
177 185
 }
178 186
 
... ...
@@ -673,6 +681,9 @@ static inline void print_param(FILE *_o, param_t *_p)
673 681
 		case P_METHODS:
674 682
 			type = "P_METHODS";
675 683
 			break;
684
+		case P_FLAGS:
685
+			type = "P_FLAGS";
686
+			break;
676 687
 		case P_TRANSPORT:
677 688
 			type = "P_TRANSPORT";
678 689
 			break;
Browse code

core: use generic PKG_MEM_ERROR, SHM_ERROR and _CRITICAL helper defines in core

- refactoring of the core to use generic PKG_MEM_ERROR, SHM_ERROR,
PKG_MEM_CRITICAL, SHM_MEM_CRITICAL and SYS_MEM_ERROR helper defines
- unify many different error messages in different spellings
- add a few missing error handler for allocation errors after (found
with a complete review of all memory allocation functions in core)
- no other functional changes, change has been reviewed two times

Henning Westerholt authored on 23/12/2018 21:31:03
Showing 1 changed files
... ...
@@ -584,7 +584,7 @@ int parse_params2(
584 584
 	while(1) {
585 585
 		t = (param_t *)pkg_malloc(sizeof(param_t));
586 586
 		if(t == 0) {
587
-			LM_ERR("No memory left\n");
587
+			PKG_MEM_ERROR;
588 588
 			goto error;
589 589
 		}
590 590
 
... ...
@@ -768,7 +768,11 @@ static inline int do_duplicate_params(param_t **_n, param_t *_p, int _shm)
768 768
 			t = (param_t *)pkg_malloc(sizeof(param_t));
769 769
 		}
770 770
 		if(!t) {
771
-			LM_ERR("No more memory (%d)\n", _shm);
771
+			if (_shm) {
772
+				SHM_MEM_ERROR;
773
+			} else {
774
+				PKG_MEM_ERROR;
775
+			}
772 776
 			goto err;
773 777
 		}
774 778
 		memcpy(t, ptr, sizeof(param_t));
Browse code

core: parser - fix comment typo [skip ci]

Mikko Lehto authored on 21/06/2017 17:04:47
Showing 1 changed files
... ...
@@ -460,7 +460,7 @@ static inline int parse_param_body(str *_s, param_t *_c, char separator)
460 460
  * 	t: out parameter
461 461
  * 	-1: on error
462 462
  * 	0: success, but expect a next paramter
463
- * 	1: success and exepect no more parameters
463
+ * 	1: success and expect no more parameters
464 464
  */
465 465
 static inline int parse_param2(
466 466
 		str *_s, pclass_t _c, param_hooks_t *_h, param_t *t, char separator)
... ...
@@ -533,7 +533,7 @@ error:
533 533
  * 	t: out parameter
534 534
  * 	-1: on error
535 535
  * 	0: success, but expect a next paramter
536
- * 	1: success and exepect no more parameters
536
+ * 	1: success and expect no more parameters
537 537
  */
538 538
 int parse_param(str *_s, pclass_t _c, param_hooks_t *_h, param_t *t)
539 539
 {
Browse code

core: parser - updated old log messages

Daniel-Constantin Mierla authored on 29/01/2017 16:52:40
Showing 1 changed files
... ...
@@ -1,4 +1,4 @@
1
-/* 
1
+/*
2 2
  * Generic Parameter Parser
3 3
  *
4 4
  * Copyright (C) 2001-2003 FhG Fokus
... ...
@@ -15,8 +15,8 @@
15 15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 16
  * GNU General Public License for more details.
17 17
  *
18
- * You should have received a copy of the GNU General Public License 
19
- * along with this program; if not, write to the Free Software 
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20 20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 21
  *
22 22
  */
... ...
@@ -37,71 +37,70 @@
37 37
 #include "parse_param.h"
38 38
 
39 39
 
40
-static inline void parse_event_dialog_class(param_hooks_t* h, param_t* p)
40
+static inline void parse_event_dialog_class(param_hooks_t *h, param_t *p)
41 41
 {
42 42
 
43
-	if (!p->name.s) {
44
-		LOG(L_ERR, "ERROR: parse_event_dialog_class: empty value\n");
43
+	if(!p->name.s) {
44
+		LM_ERR("empty value\n");
45 45
 		return;
46 46
 	}
47
-	if (!h) {
48
-		LOG(L_CRIT, "BUG: parse_event_dialog_class: NULL param hook pointer\n");
47
+	if(!h) {
48
+		LM_CRIT("BUG:  NULL param hook pointer\n");
49 49
 		return;
50 50
 	}
51 51
 	switch(p->name.s[0]) {
52
-	case 'c':
53
-	case 'C':
54
-		if ((p->name.len == 7) &&
55
-		    (!strncasecmp(p->name.s + 1, "all-id", 6))) {
56
-			p->type = P_CALL_ID;
57
-			h->event_dialog.call_id = p;
58
-		}
59
-		break;
60
-
61
-	case 'f':
62
-	case 'F':
63
-		if ((p->name.len == 8) &&
64
-		    (!strncasecmp(p->name.s + 1, "rom-tag", 7))) {
65
-			p->type = P_FROM_TAG;
66
-			h->event_dialog.from_tag = p;
67
-		}
68
-		break;
69
-
70
-	case 't':
71
-	case 'T':
72
-		if ((p->name.len == 6) &&
73
-		    (!strncasecmp(p->name.s + 1, "o-tag", 5))) {
74
-			p->type = P_TO_TAG;
75
-			h->event_dialog.to_tag = p;
76
-		}
77
-		break;
78
-
79
-	case 'i':
80
-	case 'I':
81
-		if ((p->name.len == 27) &&
82
-		    (!strncasecmp(p->name.s + 1, "nclude-session-description", 26))) {
83
-			p->type = P_ISD;
84
-			h->event_dialog.include_session_description = p;
85
-		}
86
-		break;
87
-
88
-	case 's':
89
-	case 'S':
90
-		if ((p->name.len == 3) &&
91
-		    (!strncasecmp(p->name.s + 1, "la", 2))) {
92
-			p->type = P_SLA;
93
-			h->event_dialog.sla = p;
94
-		}
95
-		break;
96
-
97
-	case 'm':
98
-	case 'M':
99
-		if ((p->name.len == 2) &&
100
-		    (!strncasecmp(p->name.s + 1, "a", 1))) {
101
-			p->type = P_MA;
102
-			h->event_dialog.ma = p;
103
-		}
104
-		break;
52
+		case 'c':
53
+		case 'C':
54
+			if((p->name.len == 7)
55
+					&& (!strncasecmp(p->name.s + 1, "all-id", 6))) {
56
+				p->type = P_CALL_ID;
57
+				h->event_dialog.call_id = p;
58
+			}
59
+			break;
60
+
61
+		case 'f':
62
+		case 'F':
63
+			if((p->name.len == 8)
64
+					&& (!strncasecmp(p->name.s + 1, "rom-tag", 7))) {
65
+				p->type = P_FROM_TAG;
66
+				h->event_dialog.from_tag = p;
67
+			}
68
+			break;
69
+
70
+		case 't':
71
+		case 'T':
72
+			if((p->name.len == 6)
73
+					&& (!strncasecmp(p->name.s + 1, "o-tag", 5))) {
74
+				p->type = P_TO_TAG;
75
+				h->event_dialog.to_tag = p;
76
+			}
77
+			break;
78
+
79
+		case 'i':
80
+		case 'I':
81
+			if((p->name.len == 27)
82
+					&& (!strncasecmp(p->name.s + 1,
83
+							"nclude-session-description", 26))) {
84
+				p->type = P_ISD;
85
+				h->event_dialog.include_session_description = p;
86
+			}
87
+			break;
88
+
89
+		case 's':
90
+		case 'S':
91
+			if((p->name.len == 3) && (!strncasecmp(p->name.s + 1, "la", 2))) {
92
+				p->type = P_SLA;
93
+				h->event_dialog.sla = p;
94
+			}
95
+			break;
96
+
97
+		case 'm':
98
+		case 'M':
99
+			if((p->name.len == 2) && (!strncasecmp(p->name.s + 1, "a", 1))) {
100
+				p->type = P_MA;
101
+				h->event_dialog.ma = p;
102
+			}
103
+			break;
105 104
 	}
106 105
 }
107 106
 
... ...
@@ -110,71 +109,70 @@ static inline void parse_event_dialog_class(param_hooks_t* h, param_t* p)
110 109
  * Try to find out parameter name, recognized parameters
111 110
  * are q, expires and methods
112 111
  */
113
-static inline void parse_contact_class(param_hooks_t* _h, param_t* _p)
112
+static inline void parse_contact_class(param_hooks_t *_h, param_t *_p)
114 113
 {
115 114
 
116
-	if (!_p->name.s) {
117
-		LOG(L_ERR, "ERROR: parse_contact_class: empty value\n");
115
+	if(!_p->name.s) {
116
+		LM_ERR("empty value\n");
118 117
 		return;
119 118
 	}
120
-	if (!_h) {
121
-		LOG(L_CRIT, "BUG: parse_contact_class: NULL param hook pointer\n");
119
+	if(!_h) {
120
+		LM_CRIT("BUG: NULL param hook pointer\n");
122 121
 		return;
123 122
 	}
124 123
 	switch(_p->name.s[0]) {
125
-	case 'q':
126
-	case 'Q':
127
-		if (_p->name.len == 1) {
128
-			_p->type = P_Q;
129
-			_h->contact.q = _p;
130
-		}
131
-		break;
132
-		
133
-	case 'e':
134
-	case 'E':
135
-		if ((_p->name.len == 7) &&
136
-		    (!strncasecmp(_p->name.s + 1, "xpires", 6))) {
137
-			_p->type = P_EXPIRES;
138
-			_h->contact.expires = _p;
139
-		}
140
-		break;
141
-		
142
-	case 'm':
143
-	case 'M':
144
-		if ((_p->name.len == 7) &&
145
-		    (!strncasecmp(_p->name.s + 1, "ethods", 6))) {
146
-			_p->type = P_METHODS;
147
-			_h->contact.methods = _p;
148
-		}
149
-		break;
150
-
151
-	case 'r':
152
-	case 'R':
153
-		if ((_p->name.len == 8) &&
154
-		    (!strncasecmp(_p->name.s + 1, "eceived", 7))) {
155
-			_p->type = P_RECEIVED;
156
-			_h->contact.received = _p;
157
-		} else if((_p->name.len == 6) &&
158
-		    (!strncasecmp(_p->name.s + 1, "eg-id", 5))) {
159
-			_p->type = P_REG_ID;
160
-			_h->contact.reg_id = _p;
161
-		}
162
-		break;
163
-	case '+':
164
-		if ((_p->name.len == 13) &&
165
-			(!strncasecmp(_p->name.s + 1, "sip.instance", 12))) {
166
-			_p->type = P_INSTANCE;
167
-			_h->contact.instance = _p;
168
-		}
169
-		break;
170
-	case 'o':
171
-	case 'O':
172
-		if ((_p->name.len == 2) &&
173
-		    (!strncasecmp(_p->name.s + 1, "b", 1))) {
174
-			_p->type = P_OB;
175
-			_h->contact.ob = _p;
176
-		}
177
-		break;
124
+		case 'q':
125
+		case 'Q':
126
+			if(_p->name.len == 1) {
127
+				_p->type = P_Q;
128
+				_h->contact.q = _p;
129
+			}
130
+			break;
131
+
132
+		case 'e':
133
+		case 'E':
134
+			if((_p->name.len == 7)
135
+					&& (!strncasecmp(_p->name.s + 1, "xpires", 6))) {
136
+				_p->type = P_EXPIRES;
137
+				_h->contact.expires = _p;
138
+			}
139
+			break;
140
+
141
+		case 'm':
142
+		case 'M':
143
+			if((_p->name.len == 7)
144
+					&& (!strncasecmp(_p->name.s + 1, "ethods", 6))) {
145
+				_p->type = P_METHODS;
146
+				_h->contact.methods = _p;
147
+			}
148
+			break;
149
+
150
+		case 'r':
151
+		case 'R':
152
+			if((_p->name.len == 8)
153
+					&& (!strncasecmp(_p->name.s + 1, "eceived", 7))) {
154
+				_p->type = P_RECEIVED;
155
+				_h->contact.received = _p;
156
+			} else if((_p->name.len == 6)
157
+						&& (!strncasecmp(_p->name.s + 1, "eg-id", 5))) {
158
+				_p->type = P_REG_ID;
159
+				_h->contact.reg_id = _p;
160
+			}
161
+			break;
162
+		case '+':
163
+			if((_p->name.len == 13)
164
+					&& (!strncasecmp(_p->name.s + 1, "sip.instance", 12))) {
165
+				_p->type = P_INSTANCE;
166
+				_h->contact.instance = _p;
167
+			}
168
+			break;
169
+		case 'o':
170
+		case 'O':
171
+			if((_p->name.len == 2) && (!strncasecmp(_p->name.s + 1, "b", 1))) {
172
+				_p->type = P_OB;
173
+				_h->contact.ob = _p;
174
+			}
175
+			break;
178 176
 	}
179 177
 }
180 178
 
... ...
@@ -183,88 +181,87 @@ static inline void parse_contact_class(param_hooks_t* _h, param_t* _p)
183 181
  * Try to find out parameter name, recognized parameters
184 182
  * are transport, lr, r2, maddr
185 183
  */
186
-static inline void parse_uri_class(param_hooks_t* _h, param_t* _p)
184
+static inline void parse_uri_class(param_hooks_t *_h, param_t *_p)
187 185
 {
188 186
 
189
-	if (!_p->name.s) {
190
-		LOG(L_ERR, "ERROR: parse_uri_class: empty value\n");
187
+	if(!_p->name.s) {
188
+		LM_ERR("empty value\n");
191 189
 		return;
192 190
 	}
193
-	if (!_h) {
194
-		LOG(L_CRIT, "BUG: parse_uri_class: NULL param hook pointer\n");
191
+	if(!_h) {
192
+		LM_CRIT("BUG: NULL param hook pointer\n");
195 193
 		return;
196 194
 	}
197 195
 	switch(_p->name.s[0]) {
198
-	case 't':
199
-	case 'T':
200
-		if ((_p->name.len == 9) &&
201
-		    (!strncasecmp(_p->name.s + 1, "ransport", 8))) {
202
-			_p->type = P_TRANSPORT;
203
-			_h->uri.transport = _p;
204
-		} else if (_p->name.len == 2) {
205
-			if (((_p->name.s[1] == 't') || (_p->name.s[1] == 'T')) &&
206
-			    ((_p->name.s[2] == 'l') || (_p->name.s[2] == 'L'))) {
207
-				_p->type = P_TTL;
208
-				_h->uri.ttl = _p;
196
+		case 't':
197
+		case 'T':
198
+			if((_p->name.len == 9)
199
+					&& (!strncasecmp(_p->name.s + 1, "ransport", 8))) {
200
+				_p->type = P_TRANSPORT;
201
+				_h->uri.transport = _p;
202
+			} else if(_p->name.len == 2) {
203
+				if(((_p->name.s[1] == 't') || (_p->name.s[1] == 'T'))
204
+						&& ((_p->name.s[2] == 'l') || (_p->name.s[2] == 'L'))) {
205
+					_p->type = P_TTL;
206
+					_h->uri.ttl = _p;
207
+				}
209 208
 			}
210
-		}
211
-		break;
212
-
213
-	case 'l':
214
-	case 'L':
215
-		if ((_p->name.len == 2) && ((_p->name.s[1] == 'r') || (_p->name.s[1] == 'R'))) {
216
-			_p->type = P_LR;
217
-			_h->uri.lr = _p;
218
-		}
219
-		break;
209
+			break;
210
+
211
+		case 'l':
212
+		case 'L':
213
+			if((_p->name.len == 2)
214
+					&& ((_p->name.s[1] == 'r') || (_p->name.s[1] == 'R'))) {
215
+				_p->type = P_LR;
216
+				_h->uri.lr = _p;
217
+			}
218
+			break;
220 219
 
221
-	case 'r':
222
-	case 'R':
223
-		if ((_p->name.len == 2) && (_p->name.s[1] == '2')) {
224
-			_p->type = P_R2;
225
-			_h->uri.r2 = _p;
226
-		}
227
-		break;
228
-
229
-	case 'm':
230
-	case 'M':
231
-		if ((_p->name.len == 5) &&
232
-		    (!strncasecmp(_p->name.s + 1, "addr", 4))) {
233
-			_p->type = P_MADDR;
234
-			_h->uri.maddr = _p;
235
-		}
236
-		break;
237
-		
238
-	case 'd':
239
-	case 'D':
240
-		if ((_p->name.len == 5) &&
241
-		    (!strncasecmp(_p->name.s + 1, "stip", 4))) {
242
-			_p->type = P_DSTIP;
243
-			_h->uri.dstip = _p;
244
-		} else if ((_p->name.len == 7) &&
245
-			   (!strncasecmp(_p->name.s + 1, "stport", 6))) {
246
-			_p->type = P_DSTPORT;
247
-			_h->uri.dstport = _p;
248
-		}
249
-		break;
250
-	case 'f':
251
-	case 'F':
252
-		if ((_p->name.len == 4) &&
253
-		    (!strncasecmp(_p->name.s + 1, "tag", 3))) {
254
-			_p->type = P_FTAG;
255
-			_h->uri.ftag = _p;
256
-		}
257
-		break;
258
-	case 'o':
259
-	case 'O':
260
-		if ((_p->name.len == 2) &&
261
-		    (!strncasecmp(_p->name.s + 1, "b", 1))) {
262
-			_p->type = P_OB;
263
-			_h->uri.ob = _p;
264
-		}
265
-		break;
220
+		case 'r':
221
+		case 'R':
222
+			if((_p->name.len == 2) && (_p->name.s[1] == '2')) {
223
+				_p->type = P_R2;
224
+				_h->uri.r2 = _p;
225
+			}
226
+			break;
227
+
228
+		case 'm':
229
+		case 'M':
230
+			if((_p->name.len == 5)
231
+					&& (!strncasecmp(_p->name.s + 1, "addr", 4))) {
232
+				_p->type = P_MADDR;
233
+				_h->uri.maddr = _p;
234
+			}
235
+			break;
236
+
237
+		case 'd':
238
+		case 'D':
239
+			if((_p->name.len == 5)
240
+					&& (!strncasecmp(_p->name.s + 1, "stip", 4))) {
241
+				_p->type = P_DSTIP;
242
+				_h->uri.dstip = _p;
243
+			} else if((_p->name.len == 7)
244
+						&& (!strncasecmp(_p->name.s + 1, "stport", 6))) {
245
+				_p->type = P_DSTPORT;
246
+				_h->uri.dstport = _p;
247
+			}
248
+			break;
249
+		case 'f':
250
+		case 'F':
251
+			if((_p->name.len == 4)
252
+					&& (!strncasecmp(_p->name.s + 1, "tag", 3))) {
253
+				_p->type = P_FTAG;
254
+				_h->uri.ftag = _p;
255
+			}
256
+			break;
257
+		case 'o':
258
+		case 'O':
259
+			if((_p->name.len == 2) && (!strncasecmp(_p->name.s + 1, "b", 1))) {
260
+				_p->type = P_OB;
261
+				_h->uri.ob = _p;
262
+			}
263
+			break;
266 264
 	}
267
-
268 265
 }
269 266
 
270 267
 
... ...
@@ -274,49 +271,49 @@ static inline void parse_uri_class(param_hooks_t* _h, param_t* _p)
274 271
  * parameter and update _s to point behind the
275 272
  * closing quote
276 273
  */
277
-static inline int parse_quoted_param(str* _s, str* _r)
274
+static inline int parse_quoted_param(str *_s, str *_r)
278 275
 {
279
-	char* end_quote;
276
+	char *end_quote;
280 277
 	char quote;
281 278
 
282
-	     /* The string must have at least
283
-	      * surrounding quotes
284
-	      */
285
-	if (_s->len < 2) {
279
+	/* The string must have at least
280
+	 * surrounding quotes
281
+	 */
282
+	if(_s->len < 2) {
286 283
 		return -1;
287 284
 	}
288 285
 
289
-	     /* Store the kind of quoting (single or double)
290
-	      * which we're handling with
291
-	      */
286
+	/* Store the kind of quoting (single or double)
287
+	 * which we're handling with
288
+	 */
292 289
 	quote = (_s->s)[0];
293 290
 
294
-	     /* Skip opening quote */
291
+	/* Skip opening quote */
295 292
 	_s->s++;
296 293
 	_s->len--;
297 294
 
298 295
 
299
-	     /* Find closing quote */
296
+	/* Find closing quote */
300 297
 	end_quote = q_memchr(_s->s, quote, _s->len);
301 298
 
302
-	     /* Not found, return error */
303
-	if (!end_quote) {
299
+	/* Not found, return error */
300
+	if(!end_quote) {
304 301
 		return -2;
305 302
 	}
306 303
 
307
-	     /* Let _r point to the string without
308
-	      * surrounding quotes
309
-	      */
304
+	/* Let _r point to the string without
305
+	 * surrounding quotes
306
+	 */
310 307
 	_r->s = _s->s;
311 308
 	_r->len = end_quote - _s->s;
312 309
 
313
-	     /* Update _s parameter to point
314
-	      * behind the closing quote
315
-	      */
310
+	/* Update _s parameter to point
311
+	 * behind the closing quote
312
+	 */
316 313
 	_s->len -= (end_quote - _s->s + 1);
317 314
 	_s->s = end_quote + 1;
318 315
 
319
-	     /* Everything went OK */
316
+	/* Everything went OK */
320 317
 	return 0;
321 318
 }
322 319
 
... ...
@@ -326,61 +323,61 @@ static inline int parse_quoted_param(str* _s, str* _r)
326 323
  * let _r point to the token and update _s
327 324
  * to point right behind the token
328 325
  */
329
-static inline int parse_token_param(str* _s, str* _r, char separator)
326
+static inline int parse_token_param(str *_s, str *_r, char separator)
330 327
 {
331 328
 	int i;
332 329
 
333
-	     /* There is nothing to parse,
334
-	      * return error
335
-	      */
336
-	if (_s->len == 0) {
330
+	/* There is nothing to parse,
331
+	 * return error
332
+	 */
333
+	if(_s->len == 0) {
337 334
 		return -1;
338 335
 	}
339 336
 
340
-	     /* Save the begining of the
341
-	      * token in _r->s
342
-	      */
337
+	/* Save the begining of the
338
+	 * token in _r->s
339
+	 */
343 340
 	_r->s = _s->s;
344 341
 
345
-	     /* Iterate through the
346
-	      * token body
347
-	      */
342
+	/* Iterate through the
343
+	 * token body
344
+	 */
348 345
 	for(i = 0; i < _s->len; i++) {
349 346
 
350
-		     /* All these characters
351
-		      * mark end of the token
352
-		      */
347
+		/* All these characters
348
+		 * mark end of the token
349
+		 */
353 350
 		switch(_s->s[i]) {
354
-		case ' ':
355
-		case '\t':
356
-		case '\r':
357
-		case '\n':
358
-		case ',':
359
-			     /* So if you find
360
-			      * any of them
361
-			      * stop iterating
362
-			      */
363
-			goto out;
364
-		default:
365
-			if(_s->s[i] == separator)
351
+			case ' ':
352
+			case '\t':
353
+			case '\r':
354
+			case '\n':
355
+			case ',':
356
+				/* So if you find
357
+				 * any of them
358
+				 * stop iterating
359
+				 */
366 360
 				goto out;
361
+			default:
362
+				if(_s->s[i] == separator)
363
+					goto out;
367 364
 		}
368 365
 	}
369
- out:
370
-	if (i == 0) {
366
+out:
367
+	if(i == 0) {
371 368
 		return -1;
372
-        }
369
+	}
373 370
 
374
-	     /* Save length of the token */
375
-        _r->len = i;
371
+	/* Save length of the token */
372
+	_r->len = i;
376 373
 
377
-	     /* Update _s parameter so it points
378
-	      * right behind the end of the token
379
-	      */
374
+	/* Update _s parameter so it points
375
+	 * right behind the end of the token
376
+	 */
380 377
 	_s->s = _s->s + i;
381 378
 	_s->len -= i;
382 379
 
383
-	     /* Everything went OK */
380
+	/* Everything went OK */
384 381
 	return 0;
385 382
 }
386 383
 
... ...
@@ -388,11 +385,12 @@ static inline int parse_token_param(str* _s, str* _r, char separator)
388 385
 /*! \brief
389 386
  * Parse a parameter name
390 387
  */
391
-static inline void parse_param_name(str* _s, pclass_t _c, param_hooks_t* _h, param_t* _p, char separator)
388
+static inline void parse_param_name(
389
+		str *_s, pclass_t _c, param_hooks_t *_h, param_t *_p, char separator)
392 390
 {
393 391
 
394
-	if (!_s->s) {
395
-		DBG("DEBUG: parse_param_name: empty parameter\n");
392
+	if(!_s->s) {
393
+		LM_DBG("empty parameter\n");
396 394
 		return;
397 395
 	}
398 396
 
... ...
@@ -400,50 +398,54 @@ static inline void parse_param_name(str* _s, pclass_t _c, param_hooks_t* _h, par
400 398
 
401 399
 	while(_s->len) {
402 400
 		switch(_s->s[0]) {
403
-		case ' ':
404
-		case '\t':
405
-		case '\r':
406
-		case '\n':
407
-		case ',':
408
-		case '=':
409
-			goto out;
410
-		default:
411
-			if (_s->s[0] == separator)
401
+			case ' ':
402
+			case '\t':
403
+			case '\r':
404
+			case '\n':
405
+			case ',':
406
+			case '=':
412 407
 				goto out;
408
+			default:
409
+				if(_s->s[0] == separator)
410
+					goto out;
413 411
 		}
414 412
 		_s->s++;
415 413
 		_s->len--;
416 414
 	}
417 415
 
418
- out:
416
+out:
419 417
 	_p->name.len = _s->s - _p->name.s;
420 418
 
421 419
 	switch(_c) {
422
-	case CLASS_CONTACT: parse_contact_class(_h, _p); break;
423
-	case CLASS_URI:     parse_uri_class(_h, _p);     break;
424
-	case CLASS_EVENT_DIALOG: parse_event_dialog_class(_h, _p); break;
425
-	default: break;
420
+		case CLASS_CONTACT:
421
+			parse_contact_class(_h, _p);
422
+			break;
423
+		case CLASS_URI:
424
+			parse_uri_class(_h, _p);
425
+			break;
426
+		case CLASS_EVENT_DIALOG:
427
+			parse_event_dialog_class(_h, _p);
428
+			break;
429
+		default:
430
+			break;
426 431
 	}
427 432
 }
428 433
 
429 434
 
430
-
431
-
432
-
433 435
 /*! \brief
434 436
  * Parse body of a parameter. It can be quoted string or
435 437
  * a single token.
436 438
  */
437
-static inline int parse_param_body(str* _s, param_t* _c, char separator)
439
+static inline int parse_param_body(str *_s, param_t *_c, char separator)
438 440
 {
439
-	if (_s->s[0] == '\"' || _s->s[0] == '\'') {
440
-		if (parse_quoted_param(_s, &(_c->body)) < 0) {
441
-			LOG(L_ERR, "parse_param_body(): Error while parsing quoted string\n");
441
+	if(_s->s[0] == '\"' || _s->s[0] == '\'') {
442
+		if(parse_quoted_param(_s, &(_c->body)) < 0) {
443
+			LM_ERR("Error while parsing quoted string\n");
442 444
 			return -2;
443 445
 		}
444 446
 	} else {
445
-		if (parse_token_param(_s, &(_c->body), separator) < 0) {
446
-			LOG(L_ERR, "parse_param_body(): Error while parsing token\n");
447
+		if(parse_token_param(_s, &(_c->body), separator) < 0) {
448
+			LM_ERR("Error while parsing token\n");
447 449
 			return -3;
448 450
 		}
449 451
 	}
... ...
@@ -452,8 +454,6 @@ static inline int parse_param_body(str* _s, param_t* _c, char separator)
452 454
 }
453 455
 
454 456
 
455
-
456
-
457 457
 /*!  \brief
458 458
  * Only parse one parameter
459 459
  * Returns:
... ...
@@ -462,59 +462,60 @@ static inline int parse_param_body(str* _s, param_t* _c, char separator)
462 462
  * 	0: success, but expect a next paramter
463 463
  * 	1: success and exepect no more parameters
464 464
  */
465
-static inline int parse_param2(str *_s, pclass_t _c, param_hooks_t *_h, param_t *t, char separator)
465
+static inline int parse_param2(
466
+		str *_s, pclass_t _c, param_hooks_t *_h, param_t *t, char separator)
466 467
 {
467 468
 	memset(t, 0, sizeof(param_t));
468 469
 
469 470
 	parse_param_name(_s, _c, _h, t, separator);
470 471
 	trim_leading(_s);
471
-	
472
-	if (_s->len == 0) { /* The last parameter without body */
472
+
473
+	if(_s->len == 0) { /* The last parameter without body */
473 474
 		t->len = t->name.len;
474 475
 		goto ok;
475 476
 	}
476
-	
477
-	if (_s->s[0] == '=') {
477
+
478
+	if(_s->s[0] == '=') {
478 479
 		_s->s++;
479 480
 		_s->len--;
480 481
 		trim_leading(_s);
481 482
 
482
-		if (_s->len == 0) {
483
-		    /* Be forgiving and accept parameters with missing value,
484
-		     * we just set the length of parameter body to 0. */
485
-		    t->body.s = _s->s;
486
-		    t->body.len = 0;
487
-		} else if (parse_param_body(_s, t, separator) < 0) {
488
-			LOG(L_ERR, "parse_params(): Error while parsing param body\n");
483
+		if(_s->len == 0) {
484
+			/* Be forgiving and accept parameters with missing value,
485
+			 * we just set the length of parameter body to 0. */
486
+			t->body.s = _s->s;
487
+			t->body.len = 0;
488
+		} else if(parse_param_body(_s, t, separator) < 0) {
489
+			LM_ERR("Error while parsing param body\n");
489 490
 			goto error;
490 491
 		}
491 492
 
492 493
 		t->len = _s->s - t->name.s;
493 494
 
494 495
 		trim_leading(_s);
495
-		if (_s->len == 0) {
496
+		if(_s->len == 0) {
496 497
 			goto ok;
497 498
 		}
498 499
 	} else {
499 500
 		t->len = t->name.len;
500 501
 	}
501 502
 
502
-	if (_s->s[0] == ',') goto ok; /* To be able to parse header parameters */
503
-	if (_s->s[0] == '>') goto ok; /* To be able to parse URI parameters */
503
+	if(_s->s[0] == ',')
504
+		goto ok; /* To be able to parse header parameters */
505
+	if(_s->s[0] == '>')
506
+		goto ok; /* To be able to parse URI parameters */
504 507
 
505
-	if (_s->s[0] != separator) {
506
-		LOG(L_ERR, "parse_params(): Invalid character, %c expected\n",
507
-			separator);
508
+	if(_s->s[0] != separator) {
509
+		LM_ERR("Invalid character, %c expected\n", separator);
508 510
 		goto error;
509 511
 	}
510 512
 
511 513
 	_s->s++;
512 514
 	_s->len--;
513 515
 	trim_leading(_s);
514
-	
515
-	if (_s->len == 0) {
516
-		LOG(L_ERR, "parse_params(): Param name missing after %c\n",
517
-				separator);
516
+
517
+	if(_s->len == 0) {
518
+		LM_ERR("Param name missing after %c\n", separator);
518 519
 		goto error;
519 520
 	}
520 521
 
... ...
@@ -547,7 +548,7 @@ int parse_param(str *_s, pclass_t _c, param_hooks_t *_h, param_t *t)
547 548
  * \param _p pointing to linked list where parsed parameters will be stored
548 549
  * \return 0 on success and negative number on an error
549 550
  */
550
-int parse_params(str* _s, pclass_t _c, param_hooks_t* _h, param_t** _p)
551
+int parse_params(str *_s, pclass_t _c, param_hooks_t *_h, param_t **_p)
551 552
 {
552 553
 	return parse_params2(_s, _c, _h, _p, ';');
553 554
 }
... ...
@@ -561,49 +562,53 @@ int parse_params(str* _s, pclass_t _c, param_hooks_t* _h, param_t** _p)
561 562
  * \param separator single character separator
562 563
  * \return 0 on success and negative number on an error
563 564
  */
564
-int parse_params2(str* _s, pclass_t _c, param_hooks_t* _h, param_t** _p,
565
-			char separator)
565
+int parse_params2(
566
+		str *_s, pclass_t _c, param_hooks_t *_h, param_t **_p, char separator)
566 567
 {
567
-	param_t* t;
568
+	param_t *t;
568 569
 
569
-	if (!_s || !_p) {
570
-		LOG(L_ERR, "parse_params(): Invalid parameter value\n");
570
+	if(!_s || !_p) {
571
+		LM_ERR("Invalid parameter value\n");
571 572
 		return -1;
572 573
 	}
573 574
 
574
-	if (_h)
575
+	if(_h)
575 576
 		memset(_h, 0, sizeof(param_hooks_t));
576 577
 	*_p = 0;
577 578
 
578
-	if (!_s->s) { /* no parameters at all -- we're done */
579
-		DBG("DEBUG: parse_params: empty uri params, skipping\n");
579
+	if(!_s->s) { /* no parameters at all -- we're done */
580
+		LM_DBG("empty uri params, skipping\n");