Browse code

- export param types adjusted to PARAM_STR/STRING & PARAM_INT - removed corresponding obsolete strlen(str_param) in init

Tomas Mandys authored on 08/01/2006 22:43:14
Showing 55 changed files
... ...
@@ -176,41 +176,41 @@ static cmd_export_t cmds[] = {
176 176
 
177 177
 
178 178
 static param_export_t params[] = {
179
-	{"early_media",		INT_PARAM, &early_media },
180
-	{"failed_transactions",	INT_PARAM, &failed_transactions },
181
-	{"report_ack",		INT_PARAM, &report_ack },
182
-	{"report_cancels",	INT_PARAM, &report_cancels },
183
-	{"log_flag",		INT_PARAM, &log_flag },
184
-	{"log_missed_flag",	INT_PARAM, &log_missed_flag },
185
-	{"log_fmt",		STR_PARAM, &log_fmt },
186
-        {"attrs",               STR_PARAM, &attrs },
187
-	{"db_url",              STR_PARAM, &db_url.s },
188
-	{"acc_table",           STR_PARAM, &acc_table.s },
189
-	{"mc_table",            STR_PARAM, &mc_table.s },
190
-	{"attrs_column",        STR_PARAM, &attrs_col.s },
191
-	{"callid_column",       STR_PARAM, &callid_col.s },
192
-	{"totag_column",        STR_PARAM, &totag_col.s },
193
-	{"from_column",         STR_PARAM, &from_col.s },
194
-	{"flags_column",        STR_PARAM, &flags_col.s },
195
-	{"iuri_column",         STR_PARAM, &iuri_col.s },
196
-	{"method_column",       STR_PARAM, &method_col.s },
197
-	{"cseq_column",         STR_PARAM, &cseq_col.s },
198
-	{"ouri_column",         STR_PARAM, &ouri_col.s },
199
-	{"fromtag_column",      STR_PARAM, &fromtag_col.s },
200
-	{"to_column",           STR_PARAM, &to_col.s },
201
-	{"diguser_column",      STR_PARAM, &diguser_col.s },
202
-	{"reqtimestamp_column", STR_PARAM, &reqtimestamp_col.s },
203
-	{"todid_column",        STR_PARAM, &todid_col.s },
204
-	{"fromuri_column",      STR_PARAM, &fromuri_col.s },
205
-	{"fromuid_column",      STR_PARAM, &fromuid_col.s },
206
-	{"fromdid_column",      STR_PARAM, &fromdid_col.s },
207
-	{"digrealm_column",     STR_PARAM, &digrealm_col.s },
208
-	{"status_column",       STR_PARAM, &status_col.s },
209
-	{"touri_column",        STR_PARAM, &touri_col.s },
210
-	{"touid_column",        STR_PARAM, &touid_col.s },
211
-	{"restimestamp_column", STR_PARAM, &restimestamp_col.s },
212
-	{"src_ip_column",       STR_PARAM, &src_ip_col.s },
213
-	{"src_port_column",     STR_PARAM, &src_port_col.s },
179
+	{"early_media",		PARAM_INT, &early_media },
180
+	{"failed_transactions",	PARAM_INT, &failed_transactions },
181
+	{"report_ack",		PARAM_INT, &report_ack },
182
+	{"report_cancels",	PARAM_INT, &report_cancels },
183
+	{"log_flag",		PARAM_INT, &log_flag },
184
+	{"log_missed_flag",	PARAM_INT, &log_missed_flag },
185
+	{"log_fmt",		PARAM_STRING, &log_fmt },
186
+        {"attrs",               PARAM_STRING, &attrs },
187
+	{"db_url",              PARAM_STR, &db_url },
188
+	{"acc_table",           PARAM_STR, &acc_table },
189
+	{"mc_table",            PARAM_STR, &mc_table },
190
+	{"attrs_column",        PARAM_STR, &attrs_col },
191
+	{"callid_column",       PARAM_STR, &callid_col },
192
+	{"totag_column",        PARAM_STR, &totag_col },
193
+	{"from_column",         PARAM_STR, &from_col },
194
+	{"flags_column",        PARAM_STR, &flags_col },
195
+	{"iuri_column",         PARAM_STR, &iuri_col },
196
+	{"method_column",       PARAM_STR, &method_col },
197
+	{"cseq_column",         PARAM_STR, &cseq_col },
198
+	{"ouri_column",         PARAM_STR, &ouri_col },
199
+	{"fromtag_column",      PARAM_STR, &fromtag_col },
200
+	{"to_column",           PARAM_STR, &to_col },
201
+	{"diguser_column",      PARAM_STR, &diguser_col },
202
+	{"reqtimestamp_column", PARAM_STR, &reqtimestamp_col },
203
+	{"todid_column",        PARAM_STR, &todid_col },
204
+	{"fromuri_column",      PARAM_STR, &fromuri_col },
205
+	{"fromuid_column",      PARAM_STR, &fromuid_col },
206
+	{"fromdid_column",      PARAM_STR, &fromdid_col },
207
+	{"digrealm_column",     PARAM_STR, &digrealm_col },
208
+	{"status_column",       PARAM_STR, &status_col },
209
+	{"touri_column",        PARAM_STR, &touri_col },
210
+	{"touid_column",        PARAM_STR, &touid_col },
211
+	{"restimestamp_column", PARAM_STR, &restimestamp_col },
212
+	{"src_ip_column",       PARAM_STR, &src_ip_col },
213
+	{"src_port_column",     PARAM_STR, &src_port_col },
214 214
 	{0, 0, 0}
215 215
 };
216 216
 
... ...
@@ -266,7 +266,7 @@ static int verify_fmt(char *fmt) {
266 266
  * transaction is marked for accounting
267 267
  */
268 268
 static inline int is_acc_on(struct sip_msg *rq)
269
-{   
269
+{
270 270
 	return log_flag && isflagset(rq, log_flag) == 1;
271 271
 }
272 272
 
... ...
@@ -376,7 +376,7 @@ static int init_data(char* fmt)
376 376
 			vals[db_n].type = DB_STR;
377 377
 			vals[db_n].nul = 0;
378 378
 			break;
379
-			
379
+
380 380
 		case 'c': /* callid */
381 381
 			keys[db_n] = callid_col.s;
382 382
 			vals[db_n].type = DB_STR;
... ...
@@ -394,13 +394,13 @@ static int init_data(char* fmt)
394 394
 			vals[db_n].type = DB_STR;
395 395
 			vals[db_n].nul = 0;
396 396
 			break;
397
-			
397
+
398 398
 		case 'g': /* flags */
399 399
 			keys[db_n] = flags_col.s;
400 400
 			vals[db_n].type = DB_INT;
401 401
 			vals[db_n].nul = 0;
402 402
 			break;
403
-			
403
+
404 404
 		case 'i': /* Inbound ruri */
405 405
 			keys[db_n] = iuri_col.s;
406 406
 			vals[db_n].type = DB_STR;
... ...
@@ -454,7 +454,7 @@ static int init_data(char* fmt)
454 454
 			vals[db_n].type = DB_DATETIME;
455 455
 			vals[db_n].nul = 0;
456 456
 			break;
457
-			
457
+
458 458
 		case 'D': /* to_did */
459 459
 			keys[db_n] = todid_col.s;
460 460
 			vals[db_n].type = DB_STR;
... ...
@@ -567,7 +567,7 @@ static int fmt2strar(char *fmt,             /* what would you like to account ?
567 567
 				vals[cnt].nul = 1;
568 568
 			}
569 569
 			break;
570
-				  
570
+
571 571
 		case 'd': /* to_tag */
572 572
 			if (to && (pto = (struct to_body*)(to->parsed)) && pto->tag_value.len) {
573 573
 				vals[cnt].val.str_val = pto->tag_value;
... ...
@@ -575,7 +575,7 @@ static int fmt2strar(char *fmt,             /* what would you like to account ?
575 575
 				vals[cnt].nul = 1;
576 576
 			}
577 577
 			break;
578
-			
578
+
579 579
 		case 'f': /* sip_from */
580 580
 			if (rq->from && rq->from->body.len) {
581 581
 				vals[cnt].val.str_val = rq->from->body;
... ...
@@ -613,7 +613,7 @@ static int fmt2strar(char *fmt,             /* what would you like to account ?
613 613
 			vals[cnt].val.int_val = rq->rcv.src_ip.u.addr32[0];
614 614
 			break;
615 615
 			break;
616
-			
616
+
617 617
 		case 'r': /* from_tag */
618 618
 			if (rq->from && (from = get_from(rq)) && from->tag_value.len) {
619 619
 				vals[cnt].val.str_val = from->tag_value;
... ...
@@ -720,12 +720,12 @@ int log_request(struct sip_msg *rq, struct hdr_field *to, char *table, unsigned
720 720
 		LOG(L_ERR, "ERROR:acc:log_request:Error in use_table\n");
721 721
 		return -1;
722 722
 	}
723
-	
723
+
724 724
 	if (acc_dbf.insert(db_handle, keys, vals, cnt) < 0) {
725 725
 		LOG(L_ERR, "ERROR:acc:log_request:acc_request: Error while inserting to database\n");
726 726
 		return -1;
727 727
 	}
728
-	
728
+
729 729
 	return 1;
730 730
 }
731 731
 
... ...
@@ -742,7 +742,7 @@ static void log_ack(struct cell* t , struct sip_msg *ack, time_t req_time)
742 742
 	struct hdr_field *to;
743 743
 
744 744
 	rq = t->uas.request;
745
-	if (ack->to) to = ack->to; 
745
+	if (ack->to) to = ack->to;
746 746
 	else to = rq->to;
747 747
 	log_request(ack, to, acc_table.s, t->uas.status, req_time);
748 748
 }
... ...
@@ -799,7 +799,7 @@ static void replyout_handler(struct cell* t, int type, struct tmcb_params* ps)
799 799
 		DBG("DBG:acc:replyout_handler: No uas.request, local transaction, skipping\n");
800 800
 		return;
801 801
 	}
802
-	
802
+
803 803
 	     /* acc_onreply is bound to TMCB_REPLY which may be called
804 804
 	      * from _reply, like when FR hits; we should not miss this
805 805
 	      * event for missed calls either
... ...
@@ -818,10 +818,10 @@ static void replyin_handler(struct cell *t, int type, struct tmcb_params* ps)
818 818
 		LOG(L_ERR, "ERROR:acc:replyin_handler:replyin_handler: 0 request\n");
819 819
 		return;
820 820
 	}
821
-	
821
+
822 822
 	     /* don't parse replies in which we are not interested */
823 823
 	     /* missed calls enabled ? */
824
-	if (((is_invite(t) && ps->code >= 300 && is_mc_on(t->uas.request)) 
824
+	if (((is_invite(t) && ps->code >= 300 && is_mc_on(t->uas.request))
825 825
 	     || should_acc_reply(t, ps->code))
826 826
 	    && (ps->rpl && ps->rpl != FAKED_REPLY)) {
827 827
 		parse_headers(ps->rpl, HDR_TO_F, 0);
... ...
@@ -858,7 +858,7 @@ static void on_req(struct cell* t, int type, struct tmcb_params *ps)
858 858
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_RESPONSE_IN callback\n");
859 859
 			return;
860 860
 		}
861
-		
861
+
862 862
 		     /* do some parsing in advance */
863 863
 		preparse_req(ps->req);
864 864
 		     /* also, if that is INVITE, disallow silent t-drop */
... ...
@@ -904,7 +904,7 @@ static int mod_init(void)
904 904
 	     /* let the auto-loading function load all TM stuff */
905 905
 	if (load_tm( &tmb )==-1) return -1;
906 906
 	if (verify_fmt(log_fmt)==-1) return -1;
907
-	
907
+
908 908
 	     /* register callbacks*/
909 909
 	     /* listen for all incoming requests  */
910 910
 	if (tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, on_req, 0 ) <= 0) {
... ...
@@ -912,7 +912,7 @@ static int mod_init(void)
912 912
 		    "callback\n");
913 913
 		return -1;
914 914
 	}
915
-	
915
+
916 916
 	if (regcomp(&attrs_re, attrs, REG_EXTENDED | REG_ICASE)) {
917 917
 		LOG(L_ERR, "ERROR: acc: Cannot compile AVP regular expression\n");
918 918
 		return -1;
... ...
@@ -922,7 +922,7 @@ static int mod_init(void)
922 922
 		LOG(L_ERR, "ERROR:acc:mod_init: bind_db failed\n");
923 923
 		return -1;
924 924
 	}
925
-	
925
+
926 926
 	     /* Check database capabilities */
927 927
 	if (!DB_CAPABILITY(acc_dbf, DB_CAP_INSERT)) {
928 928
 		LOG(L_ERR, "ERROR:acc:mod_init: Database module does not implement insert function\n");
... ...
@@ -931,33 +931,5 @@ static int mod_init(void)
931 931
 
932 932
 	init_data(log_fmt);
933 933
 
934
-	db_url.len = strlen(db_url.s);
935
-	acc_table.len = strlen(acc_table.s);
936
-	mc_table.len = strlen(mc_table.s);
937
-	attrs_col.len = strlen(attrs_col.s);
938
-	callid_col.len = strlen(callid_col.s);
939
-	totag_col.len = strlen(totag_col.s);
940
-	from_col.len = strlen(from_col.s);
941
-	flags_col.len = strlen(flags_col.s);
942
-	iuri_col.len = strlen(iuri_col.s);
943
-	method_col.len = strlen(method_col.s);
944
-	cseq_col.len = strlen(cseq_col.s);
945
-	ouri_col.len = strlen(ouri_col.s);
946
-	fromtag_col.len = strlen(fromtag_col.s);
947
-	to_col.len = strlen(to_col.s);
948
-	diguser_col.len = strlen(diguser_col.s);
949
-	reqtimestamp_col.len = strlen(reqtimestamp_col.s);
950
-	todid_col.len = strlen(todid_col.s);
951
-	fromuri_col.len = strlen(fromuri_col.s);
952
-	fromuid_col.len = strlen(fromuid_col.s);
953
-	fromdid_col.len = strlen(fromdid_col.s);
954
-	digrealm_col.len = strlen(digrealm_col.s);
955
-	status_col.len = strlen(status_col.s);
956
-	touri_col.len = strlen(touri_col.s);
957
-	touid_col.len = strlen(touid_col.s);
958
-	restimestamp_col.len = strlen(restimestamp_col.s);
959
-	src_ip_col.len = strlen(src_ip_col.s);
960
-	src_port_col.len = strlen(src_port_col.s);
961
-
962 934
 	return 0;
963 935
 }
... ...
@@ -129,19 +129,19 @@ static cmd_export_t cmds[] = {
129 129
 
130 130
 
131 131
 static param_export_t params[] = {
132
-	{"early_media",		INT_PARAM, &early_media         },
133
-	{"failed_transactions",	INT_PARAM, &failed_transactions },
134
-	{"report_ack",		INT_PARAM, &report_ack          },
135
-	{"report_cancels",	INT_PARAM, &report_cancels 	},
136
-	{"log_flag",		INT_PARAM, &log_flag         	},
137
-	{"log_missed_flag",	INT_PARAM, &log_missed_flag	},
138
-	{"log_fmt",		STR_PARAM, &log_fmt             },
139
-        {"attrs",               STR_PARAM, &avps                },
140
-	{"radius_config",	STR_PARAM, &radius_config	},
141
-	{"log_flag",		INT_PARAM, &log_flag	        },
142
-	{"log_missed_flag",	INT_PARAM, &log_missed_flag     },
143
-	{"service_type", 	INT_PARAM, &service_type        },
144
-	{"swap_direction",      INT_PARAM, &swap_dir            },
132
+	{"early_media",		PARAM_INT, &early_media         },
133
+	{"failed_transactions",	PARAM_INT, &failed_transactions },
134
+	{"report_ack",		PARAM_INT, &report_ack          },
135
+	{"report_cancels",	PARAM_INT, &report_cancels 	},
136
+	{"log_flag",		PARAM_INT, &log_flag         	},
137
+	{"log_missed_flag",	PARAM_INT, &log_missed_flag	},
138
+	{"log_fmt",		PARAM_STRING, &log_fmt          },
139
+        {"attrs",               PARAM_STRING, &avps             },
140
+	{"radius_config",	PARAM_STRING, &radius_config	},
141
+	{"log_flag",		PARAM_INT, &log_flag	        },
142
+	{"log_missed_flag",	PARAM_INT, &log_missed_flag     },
143
+	{"service_type", 	PARAM_INT, &service_type        },
144
+	{"swap_direction",      PARAM_INT, &swap_dir            },
145 145
 	{0, 0, 0}
146 146
 };
147 147
 
... ...
@@ -179,11 +179,11 @@ static int check_ftag(struct sip_msg* msg, str* uri)
179 179
 		DBG("No ftag parameter found\n");
180 180
 		return -1;
181 181
 	}
182
-	
182
+
183 183
 	t.len -= semi - uri->s + 1;
184 184
 	t.s = semi + 1;
185 185
 	trim_leading(&t);
186
-	
186
+
187 187
 	if (parse_params(&t, CLASS_URI, &hooks, &params) < 0) {
188 188
 		ERR("Error while parsing parameters\n");
189 189
 		return -1;
... ...
@@ -229,7 +229,7 @@ static int get_direction(struct sip_msg* msg)
229 229
 		return -1;
230 230
 	}
231 231
 
232
-	ret = check_self(&msg->parsed_orig_ruri.host, 
232
+	ret = check_self(&msg->parsed_orig_ruri.host,
233 233
 			 msg->parsed_orig_ruri.port_no ? msg->parsed_orig_ruri.port_no : SIP_PORT, 0);/* match all protos*/
234 234
 	if (ret < 0) return -1;
235 235
 	if (ret > 0) {
... ...
@@ -285,7 +285,7 @@ int verify_fmt(char *fmt) {
285 285
  * transaction is marked for accounting
286 286
  */
287 287
 static inline int is_acc_on(struct sip_msg *rq)
288
-{   
288
+{
289 289
 	return log_flag && isflagset(rq, log_flag) == 1;
290 290
 }
291 291
 
... ...
@@ -391,10 +391,10 @@ static inline struct hdr_field* valid_to(struct cell* t, struct sip_msg* reply)
391 391
  * sql, whatsoever
392 392
  * tm sip_msg_clones does not clone (shmmem-zed) parsed fields, other then Via1,2. Such fields clone now or use from rq_rp
393 393
  */
394
-static int fmt2rad(char *fmt, 
395
-		   struct sip_msg *rq, 
396
-		   struct hdr_field *to, 
397
-		   unsigned int code, 
394
+static int fmt2rad(char *fmt,
395
+		   struct sip_msg *rq,
396
+		   struct hdr_field *to,
397
+		   unsigned int code,
398 398
 		   VALUE_PAIR** send,
399 399
 		   time_t req_time)       /* Timestamp of the request */
400 400
 {
... ...
@@ -427,12 +427,12 @@ static int fmt2rad(char *fmt,
427 427
 			break;
428 428
 
429 429
 		case 'c': /* sip_callid */
430
-			if (rq->callid && rq->callid->body.len) { 
430
+			if (rq->callid && rq->callid->body.len) {
431 431
 				attr = &attrs[A_ACCT_SESSION_ID];
432 432
 				val = rq->callid->body;
433 433
 			}
434 434
 			break;
435
-				  
435
+
436 436
 		case 'd': /* to_tag */
437 437
 			if (to && (pto = (struct to_body*)(to->parsed)) && pto->tag_value.len) {
438 438
 				attr = &attrs[A_SIP_TO_TAG];
... ...
@@ -463,7 +463,7 @@ static int fmt2rad(char *fmt,
463 463
 			val = rq->first_line.u.request.method;
464 464
 			break;
465 465
 
466
-		case 'n': /* sip_cseq */			
466
+		case 'n': /* sip_cseq */
467 467
 			if (rq->cseq && (cseq = get_cseq(rq)) && cseq->number.len) {
468 468
 				attr = &attrs[A_SIP_CSEQ];
469 469
 				str2int(&cseq->number, &cseq_num);
... ...
@@ -487,7 +487,7 @@ static int fmt2rad(char *fmt,
487 487
 			val.s = (char*)&src_ip;
488 488
 			val.len = sizeof(src_ip);
489 489
 			break;
490
-			
490
+
491 491
 		case 'r': /* from_tag */
492 492
 			if (rq->from && (from = get_from(rq)) && from->tag_value.len) {
493 493
 				attr = &attrs[A_SIP_FROM_TAG];
... ...
@@ -600,7 +600,7 @@ static int fmt2rad(char *fmt,
600 600
 
601 601
 		if (attr) {
602 602
 			if (!rc_avpair_add(rh, send, attr->v, val.s, val.len, 0)) {
603
-				LOG(L_ERR, "ERROR:acc:fmt2rad: Failed to add attribute %s\n", 
603
+				LOG(L_ERR, "ERROR:acc:fmt2rad: Failed to add attribute %s\n",
604 604
 				    attr->n);
605 605
 				return -1;
606 606
 			}
... ...
@@ -624,13 +624,13 @@ static inline UINT4 rad_status(struct sip_msg *rq, unsigned int code)
624 624
 	if (code == 0) {
625 625
 		return vals[V_FAILED].v;
626 626
 	}
627
-	
627
+
628 628
 	     /* Successful call start */
629 629
 	if ((rq->REQ_METHOD == METHOD_INVITE || rq->REQ_METHOD == METHOD_ACK)
630 630
 	    && code >= 200 && code < 300) {
631 631
 		return vals[V_START].v;
632 632
 	}
633
-	
633
+
634 634
 	     /* Successful call termination */
635 635
 	if ((rq->REQ_METHOD == METHOD_BYE || rq->REQ_METHOD == METHOD_CANCEL)) {
636 636
 		return vals[V_STOP].v;
... ...
@@ -665,10 +665,10 @@ static inline int add_user_name(struct sip_msg* rq, void* rh, VALUE_PAIR** send)
665 665
 				LOG(L_ERR, "ERROR:acc:add_user_name: Bad From URI\n");
666 666
 				return -1;
667 667
 			}
668
-			
668
+
669 669
 			user = &puri.user;
670 670
 			realm = &puri.host;
671
-			
671
+
672 672
 			user_name.len = user->len + 1 + realm->len;
673 673
 			user_name.s = pkg_malloc(user_name.len);
674 674
 			if (!user_name.s) {
... ...
@@ -697,7 +697,7 @@ static inline int add_user_name(struct sip_msg* rq, void* rh, VALUE_PAIR** send)
697 697
 /* skip leading text and begin with first item's
698 698
  * separator ", " which will be overwritten by the
699 699
  * leading text later
700
- * 
700
+ *
701 701
  */
702 702
 static int log_request(struct sip_msg* rq, struct hdr_field* to, unsigned int code, time_t req_time)
703 703
 {
... ...
@@ -715,7 +715,7 @@ static int log_request(struct sip_msg* rq, struct hdr_field* to, unsigned int co
715 715
 		LOG(L_ERR, "ERROR:acc:log_request: Add Status-Type\n");
716 716
 		goto error;
717 717
 	}
718
-	
718
+
719 719
 	     /* Add Service-Type attribute */
720 720
 	av_type = (service_type != -1) ? service_type : vals[V_SIP_SESSION].v;
721 721
 	if (!rc_avpair_add(rh, &send, attrs[A_SERVICE_TYPE].v, &av_type, -1, 0)) {
... ...
@@ -753,7 +753,7 @@ static void log_ack(struct cell* t , struct sip_msg *ack, time_t req_time)
753 753
 	struct hdr_field *to;
754 754
 
755 755
 	rq = t->uas.request;
756
-	if (ack->to) to = ack->to; 
756
+	if (ack->to) to = ack->to;
757 757
 	else to = rq->to;
758 758
 	log_request(ack, to, t->uas.status, req_time);
759 759
 }
... ...
@@ -810,7 +810,7 @@ static void replyout_handler(struct cell* t, int type, struct tmcb_params* ps)
810 810
 		DBG("DBG:acc:replyout_handler: No uas.request, local transaction, skipping\n");
811 811
 		return;
812 812
 	}
813
-	
813
+
814 814
 	     /* acc_onreply is bound to TMCB_REPLY which may be called
815 815
 	      * from _reply, like when FR hits; we should not miss this
816 816
 	      * event for missed calls either
... ...
@@ -829,10 +829,10 @@ static void replyin_handler(struct cell *t, int type, struct tmcb_params* ps)
829 829
 		LOG(L_ERR, "ERROR:acc:replyin_handler:replyin_handler: 0 request\n");
830 830
 		return;
831 831
 	}
832
-	
832
+
833 833
 	     /* don't parse replies in which we are not interested */
834 834
 	     /* missed calls enabled ? */
835
-	if (((is_invite(t) && ps->code >= 300 && is_mc_on(t->uas.request)) 
835
+	if (((is_invite(t) && ps->code >= 300 && is_mc_on(t->uas.request))
836 836
 	     || should_acc_reply(t, ps->code))
837 837
 	    && (ps->rpl && ps->rpl != FAKED_REPLY)) {
838 838
 		parse_headers(ps->rpl, HDR_TO_F, 0);
... ...
@@ -869,7 +869,7 @@ void on_req(struct cell* t, int type, struct tmcb_params *ps)
869 869
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_RESPONSE_IN callback\n");
870 870
 			return;
871 871
 		}
872
-		
872
+
873 873
 		     /* do some parsing in advance */
874 874
 		preparse_req(ps->req);
875 875
 		     /* also, if that is INVITE, disallow silent t-drop */
... ...
@@ -893,7 +893,7 @@ static int mod_init(void)
893 893
 	     /* let the auto-loading function load all TM stuff */
894 894
 	if (load_tm( &tmb )==-1) return -1;
895 895
 	if (verify_fmt(log_fmt)==-1) return -1;
896
-	
896
+
897 897
 	     /* register callbacks*/
898 898
 	     /* listen for all incoming requests  */
899 899
 	if (tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, on_req, 0 ) <= 0) {
... ...
@@ -901,7 +901,7 @@ static int mod_init(void)
901 901
 		    "callback\n");
902 902
 		return -1;
903 903
 	}
904
-	
904
+
905 905
 	if (regcomp(&avps_re, avps, REG_EXTENDED | REG_ICASE)) {
906 906
 		LOG(L_ERR, "ERROR: acc: Cannot compile AVP regular expression\n");
907 907
 		return -1;
... ...
@@ -959,12 +959,12 @@ static int mod_init(void)
959 959
 		LOG(L_ERR, "ERROR:acc:mod_init: Error reading radius dictionary\n");
960 960
 		return -1;
961 961
 	}
962
-	
962
+
963 963
 	INIT_AV(rh, attrs, vals, "acc", -1, -1);
964
-	
964
+
965 965
 	if (service_type != -1) {
966 966
 		vals[V_SIP_SESSION].v = service_type;
967 967
 	}
968
-	
968
+
969 969
 	return 0;
970 970
 }
... ...
@@ -160,15 +160,15 @@ static cmd_export_t cmds[] = {
160 160
 
161 161
 
162 162
 static param_export_t params[] = {
163
-	{"early_media",		INT_PARAM, &early_media         },
164
-	{"failed_transactions",	INT_PARAM, &failed_transactions },
165
-	{"report_ack",		INT_PARAM, &report_ack          },
166
-	{"report_cancels",	INT_PARAM, &report_cancels 	},
167
-	{"log_flag",		INT_PARAM, &log_flag         	},
168
-	{"log_missed_flag",	INT_PARAM, &log_missed_flag	},
169
-	{"log_level",		INT_PARAM, &log_level           },
170
-	{"log_fmt",		STR_PARAM, &log_fmt             },
171
-        {"attrs",               STR_PARAM, &attrs               },
163
+	{"early_media",		PARAM_INT, &early_media         },
164
+	{"failed_transactions",	PARAM_INT, &failed_transactions },
165
+	{"report_ack",		PARAM_INT, &report_ack          },
166
+	{"report_cancels",	PARAM_INT, &report_cancels 	},
167
+	{"log_flag",		PARAM_INT, &log_flag         	},
168
+	{"log_missed_flag",	PARAM_INT, &log_missed_flag	},
169
+	{"log_level",		PARAM_INT, &log_level           },
170
+	{"log_fmt",		PARAM_STRING, &log_fmt          },
171
+        {"attrs",               PARAM_STRING, &attrs            },
172 172
 	{0, 0, 0}
173 173
 };
174 174
 
... ...
@@ -262,7 +262,7 @@ int verify_fmt(char *fmt) {
262 262
  * transaction is marked for accounting
263 263
  */
264 264
 static inline int is_acc_on(struct sip_msg *rq)
265
-{   
265
+{
266 266
 	return log_flag && isflagset(rq, log_flag) == 1;
267 267
 }
268 268
 
... ...
@@ -378,7 +378,7 @@ static int fmt2strar(char *fmt,             /* what would you like to account ?
378 378
 		     str *atr_arr,
379 379
 		     time_t req_time)       /* Timestamp of the request */
380 380
 {
381
-	static char flags_buf[INT2STR_MAX_LEN], tm_buf[TM_BUF_LEN], 
381
+	static char flags_buf[INT2STR_MAX_LEN], tm_buf[TM_BUF_LEN],
382 382
 		rqtm_buf[TM_BUF_LEN], srcip_buf[IP_ADDR_MAX_STR_SIZE],
383 383
 		srcport_buf[INT2STR_MAX_LEN];
384 384
 	int cnt, tl, al;
... ...
@@ -412,7 +412,7 @@ static int fmt2strar(char *fmt,             /* what would you like to account ?
412 412
 			val_arr[cnt] = (rq->callid && rq->callid->body.len) ? &rq->callid->body : &na;
413 413
 			ATR(CALLID);
414 414
 			break;
415
-				  
415
+
416 416
 		case 'd': /* to_tag */
417 417
 			val_arr[cnt] = (to && (pto = (struct to_body*)(to->parsed)) && pto->tag_value.len) ? & pto->tag_value : &na;
418 418
 			ATR(TOTAG);
... ...
@@ -464,7 +464,7 @@ static int fmt2strar(char *fmt,             /* what would you like to account ?
464 464
 			val_arr[cnt] = &src_ip;
465 465
 			ATR(SRCIP);
466 466
 			break;
467
-			
467
+
468 468
 		case 'r': /* from_tag */
469 469
 			if (rq->from && (from = get_from(rq)) && from->tag_value.len) {
470 470
 				val_arr[cnt] = &from->tag_value;
... ...
@@ -587,7 +587,7 @@ static int fmt2strar(char *fmt,             /* what would you like to account ?
587 587
 /* skip leading text and begin with first item's
588 588
  * separator ", " which will be overwritten by the
589 589
  * leading text later
590
- * 
590
+ *
591 591
  */
592 592
 static int log_request(struct sip_msg* rq, struct hdr_field* to, str* txt, str* phrase, time_t req_time)
593 593
 {
... ...
@@ -625,7 +625,7 @@ static int log_request(struct sip_msg* rq, struct hdr_field* to, str* txt, str*
625 625
 		append(buf, A_EQ);
626 626
 		append_str(buf, *(val_arr[i]))
627 627
 	}
628
-	
628
+
629 629
 	     /* terminating text */
630 630
 	append(buf, A_EOL);
631 631
 
... ...
@@ -647,7 +647,7 @@ static void log_reply(struct cell* t , struct sip_msg* reply, unsigned int code,
647 647
 	static str lead = STR_STATIC_INIT(ACC_ANSWERED);
648 648
 	static char code_buf[INT2STR_MAX_LEN];
649 649
 	char* p;
650
-	
650
+
651 651
 	p = int2str(code, &code_str.len);
652 652
 	memcpy(code_buf, p, code_str.len);
653 653
 	code_str.s = code_buf;
... ...
@@ -665,7 +665,7 @@ static void log_ack(struct cell* t , struct sip_msg *ack, time_t req_time)
665 665
 	char* p;
666 666
 
667 667
 	rq = t->uas.request;
668
-	if (ack->to) to = ack->to; 
668
+	if (ack->to) to = ack->to;
669 669
 	else to = rq->to;
670 670
 	p = int2str(t->uas.status, &code_str.len);
671 671
 	memcpy(code_buf, p, code_str.len);
... ...
@@ -740,7 +740,7 @@ static void replyout_handler(struct cell* t, int type, struct tmcb_params* ps)
740 740
 		DBG("DBG:acc:replyout_handler: No uas.request, local transaction, skipping\n");
741 741
 		return;
742 742
 	}
743
-	
743
+
744 744
 	     /* acc_onreply is bound to TMCB_REPLY which may be called
745 745
 	      * from _reply, like when FR hits; we should not miss this
746 746
 	      * event for missed calls either
... ...
@@ -759,10 +759,10 @@ static void replyin_handler(struct cell *t, int type, struct tmcb_params* ps)
759 759
 		LOG(L_ERR, "ERROR:acc:replyin_handler:replyin_handler: 0 request\n");
760 760
 		return;
761 761
 	}
762
-	
762
+
763 763
 	     /* don't parse replies in which we are not interested */
764 764
 	     /* missed calls enabled ? */
765
-	if (((is_invite(t) && ps->code >= 300 && is_mc_on(t->uas.request)) 
765
+	if (((is_invite(t) && ps->code >= 300 && is_mc_on(t->uas.request))
766 766
 	     || should_acc_reply(t, ps->code))
767 767
 	    && (ps->rpl && ps->rpl != FAKED_REPLY)) {
768 768
 		parse_headers(ps->rpl, HDR_TO_F, 0);
... ...
@@ -799,7 +799,7 @@ void on_req(struct cell* t, int type, struct tmcb_params *ps)
799 799
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_RESPONSE_IN callback\n");
800 800
 			return;
801 801
 		}
802
-		
802
+
803 803
 		     /* do some parsing in advance */
804 804
 		preparse_req(ps->req);
805 805
 		     /* also, if that is INVITE, disallow silent t-drop */
... ...
@@ -823,7 +823,7 @@ static int mod_init(void)
823 823
 	     /* let the auto-loading function load all TM stuff */
824 824
 	if (load_tm( &tmb )==-1) return -1;
825 825
 	if (verify_fmt(log_fmt)==-1) return -1;
826
-	
826
+
827 827
 	     /* register callbacks*/
828 828
 	     /* listen for all incoming requests  */
829 829
 	if (tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, on_req, 0 ) <= 0) {
... ...
@@ -831,7 +831,7 @@ static int mod_init(void)
831 831
 		    "callback\n");
832 832
 		return -1;
833 833
 	}
834
-	
834
+
835 835
 	if (regcomp(&attrs_re, attrs, REG_EXTENDED | REG_ICASE)) {
836 836
 		LOG(L_ERR, "ERROR: acc: Cannot compile AVP regular expression\n");
837 837
 		return -1;
... ...
@@ -1,5 +1,5 @@
1
-/* 
2
- * $Id$ 
1
+/*
2
+ * $Id$
3 3
  *
4 4
  * Digest Authentication Module
5 5
  *
... ...
@@ -22,8 +22,8 @@
22 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 23
  * GNU General Public License for more details.
24 24
  *
25
- * You should have received a copy of the GNU General Public License 
26
- * along with this program; if not, write to the Free Software 
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program; if not, write to the Free Software
27 27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 28
  *
29 29
  * History:
... ...
@@ -32,7 +32,7 @@
32 32
  * 2003-03-10 New module interface (janakj)
33 33
  * 2003-03-16 flags export parameter added (janakj)
34 34
  * 2003-03-19 all mallocs/frees replaced w/ pkg_malloc/pkg_free (andrei)
35
- * 2003-04-28 rpid contributed by Juha Heinanen added (janakj) 
35
+ * 2003-04-28 rpid contributed by Juha Heinanen added (janakj)
36 36
  */
37 37
 
38 38
 
... ...
@@ -85,7 +85,7 @@ char* sec_rand = 0;
85 85
 
86 86
 
87 87
 /*
88
- * Exported functions 
88
+ * Exported functions
89 89
  */
90 90
 static cmd_export_t cmds[] = {
91 91
 	{"www_challenge",       www_challenge,           2, challenge_fixup, REQUEST_ROUTE},
... ...
@@ -100,9 +100,9 @@ static cmd_export_t cmds[] = {
100 100
  * Exported parameters
101 101
  */
102 102
 static param_export_t params[] = {
103
-	{"secret",           STR_PARAM, &sec_param       },
104
-	{"nonce_expire",     INT_PARAM, &nonce_expire    },
105
-	{"protect_contacts", INT_PARAM, &protect_contacts},
103
+	{"secret",           PARAM_STRING, &sec_param       },
104
+	{"nonce_expire",     PARAM_INT,    &nonce_expire    },
105
+	{"protect_contacts", PARAM_INT,    &protect_contacts},
106 106
 	{0, 0, 0}
107 107
 };
108 108
 
... ...
@@ -111,7 +111,7 @@ static param_export_t params[] = {
111 111
  * Module interface
112 112
  */
113 113
 struct module_exports exports = {
114
-	"auth", 
114
+	"auth",
115 115
 	cmds,
116 116
 	0,          /* RPC methods */
117 117
 	params,
... ...
@@ -155,7 +155,7 @@ static inline int generate_random_secret(void)
155 155
 static int mod_init(void)
156 156
 {
157 157
 	DBG("auth module - initializing\n");
158
-	
158
+
159 159
 	sl_reply = find_export("sl_send_reply", 2, 0);
160 160
 
161 161
 	if (!sl_reply) {
... ...
@@ -175,7 +175,7 @@ static int mod_init(void)
175 175
 		secret.s = sec_param;
176 176
 		secret.len = strlen(secret.s);
177 177
 	}
178
-	
178
+
179 179
 	return 0;
180 180
 }
181 181
 
... ...
@@ -1,4 +1,4 @@
1
-/* 
1
+/*
2 2
  * $Id$
3 3
  *
4 4
  * Digest Authentication Module
... ...
@@ -22,8 +22,8 @@
22 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 23
  * GNU General Public License for more details.
24 24
  *
25
- * You should have received a copy of the GNU General Public License 
26
- * along with this program; if not, write to the Free Software 
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program; if not, write to the Free Software
27 27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 28
  *
29 29
  * History:
... ...
@@ -125,14 +125,14 @@ static cmd_export_t cmds[] = {
125 125
  * Exported parameters
126 126
  */
127 127
 static param_export_t params[] = {
128
-	{"db_url",            STR_PARAM, &db_url             },
129
-	{"username_column",   STR_PARAM, &username_column.s  },
130
-	{"realm_column",      STR_PARAM, &realm_column.s     },
131
-	{"password_column",   STR_PARAM, &pass_column.s      },
132
-	{"password_column_2", STR_PARAM, &pass_column_2.s    },
133
-	{"flags_column",      STR_PARAM, &flags_column.s     },
134
-	{"calculate_ha1",     INT_PARAM, &calc_ha1           },
135
-	{"load_credentials",  STR_PARAM, &credentials_list.s },
128
+	{"db_url",            PARAM_STRING, &db_url          },
129
+	{"username_column",   PARAM_STR,    &username_column },
130
+	{"realm_column",      PARAM_STR,    &realm_column    },
131
+	{"password_column",   PARAM_STR,    &pass_column     },
132
+	{"password_column_2", PARAM_STR,    &pass_column_2   },
133
+	{"flags_column",      PARAM_STR,    &flags_column    },
134
+	{"calculate_ha1",     PARAM_INT,    &calc_ha1        },
135
+	{"load_credentials",  PARAM_STR,    &credentials_list},
136 136
 	{0, 0, 0}
137 137
 };
138 138
 
... ...
@@ -141,7 +141,7 @@ static param_export_t params[] = {
141 141
  * Module interface
142 142
  */
143 143
 struct module_exports exports = {
144
-	"auth_db", 
144
+	"auth_db",
145 145
 	cmds,       /* Exported functions */
146 146
 	0,          /* RPC methods */
147 147
 	params,     /* Exported parameters */
... ...
@@ -171,15 +171,7 @@ static int mod_init(void)
171 171
 
172 172
 	DBG("auth_db module - initializing\n");
173 173
 
174
-	username_column.len = strlen(username_column.s);
175
-	realm_column.len = strlen(realm_column.s);
176
-	pass_column.len = strlen(pass_column.s);
177
-	pass_column_2.len = strlen(pass_column.s);
178
-	flags_column.len = strlen(flags_column.s);
179
-
180
-	credentials_list.len = strlen(credentials_list.s);
181
-
182
-	     /* Find a database module */
174
+     /* Find a database module */
183 175
 
184 176
 	if (bind_dbmod(db_url, &auth_dbf) < 0){
185 177
 		LOG(L_ERR, "auth_db:child_init: Unable to bind a database driver\n");
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- * $Id$ 
2
+ * $Id$
3 3
  * Digest Authentication - Diameter support
4 4
  *
5 5
  * Copyright (C) 2001-2003 FhG Fokus
... ...
@@ -10,7 +10,7 @@
10 10
  * it under the terms of the GNU General Public License as published by
11 11
  * the Free Software Foundation; either version 2 of the License, or
12 12
  * (at your option) any later version
13
- * 
13
+ *
14 14
  * For a license to use the ser software under conditions
15 15
  * other than those described here, or to purchase support for this
16 16
  * software, please contact iptel.org by e-mail at the following addresses:
... ...
@@ -21,14 +21,14 @@
21 21
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 22
  * GNU General Public License for more details.
23 23
  *
24
- * You should have received a copy of the GNU General Public License 
25
- * along with this program; if not, write to the Free Software 
24
+ * You should have received a copy of the GNU General Public License
25
+ * along with this program; if not, write to the Free Software
26 26
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27 27
  *
28 28
  * History:
29 29
  * -------
30
- *  
31
- *  
30
+ *
31
+ *
32 32
  */
33 33
 #include <stdio.h>
34 34
 #include <stdlib.h>
... ...
@@ -36,7 +36,7 @@
36 36
 #include <sys/types.h>
37 37
 #include <sys/socket.h>
38 38
 #include <netinet/in.h>
39
-#include <netdb.h> 
39
+#include <netdb.h>
40 40
 
41 41
 #include "../../sr_module.h"
42 42
 #include "../../error.h"
... ...
@@ -56,7 +56,7 @@ int (*sl_reply)(struct sip_msg* _msg, char* _str1, char* _str2);
56 56
 
57 57
 static int mod_init(void);                        /* Module initialization function*/
58 58
 static int mod_child_init(int r);                 /* Child initialization function*/
59
-static int group_fixup(void** param, int param_no); 
59
+static int group_fixup(void** param, int param_no);
60 60
 
61 61
 int diameter_www_authorize(struct sip_msg* _msg, char* _realm, char* _s2);
62 62
 int diameter_proxy_authorize(struct sip_msg* _msg, char* _realm, char* _s2);
... ...
@@ -80,7 +80,7 @@ static cmd_export_t cmds[] = {
80 80
 	{"diameter_proxy_authorize", diameter_proxy_authorize, 1, fixup_str_1,
81 81
 			REQUEST_ROUTE},
82 82
 	{"diameter_is_user_in", diameter_is_user_in, 2, group_fixup,
83
-			REQUEST_ROUTE},		
83
+			REQUEST_ROUTE},
84 84
 	{0, 0, 0, 0, 0}
85 85
 };
86 86
 
... ...
@@ -90,9 +90,9 @@ static int mod_init(void);                /* Module initialization function*/
90 90
  * Exported parameters
91 91
  */
92 92
 static param_export_t params[] = {
93
-	{"diameter_client_host", STR_PARAM, &diameter_client_host},
94
-	{"diameter_client_port", INT_PARAM, &diameter_client_port},
95
-	{"use_domain", INT_PARAM, &use_domain},
93
+	{"diameter_client_host", PARAM_STRING, &diameter_client_host},
94
+	{"diameter_client_port", PARAM_INT, &diameter_client_port},
95
+	{"use_domain", PARAM_INT, &use_domain},
96 96
 	{0, 0, 0}
97 97
 };
98 98
 
... ...
@@ -101,7 +101,7 @@ static param_export_t params[] = {
101 101
  * Module interface
102 102
  */
103 103
 struct module_exports exports = {
104
-	"auth_diameter", 
104
+	"auth_diameter",
105 105
 	cmds,       	/* Exported functions */
106 106
 	0,              /* RPC methods */
107 107
 	params,     	/* Exported parameters */
... ...
@@ -126,17 +126,17 @@ static int mod_init(void)
126 126
 					" sl module\n");
127 127
 		return -1;
128 128
 	}
129
-	
129
+
130 130
 	return 0;
131 131
 }
132 132
 
133 133
 static int mod_child_init(int r)
134
-{	
134
+{
135 135
 	/* open TCP connection */
136 136
 	DBG("auth_diameter.c: mod_child_init(): Initializing TCP connection\n");
137 137
 
138 138
 	sockfd = init_mytcp(diameter_client_host, diameter_client_port);
139
-	if(sockfd==-1) 
139
+	if(sockfd==-1)
140 140
 	{
141 141
 		DBG("auth_diameter.c: mod_child_init(): TCP connection not"
142 142
 				" established\n");
... ...
@@ -145,7 +145,7 @@ static int mod_child_init(int r)
145 145
 
146 146
 	DBG("auth_diameter.c: mod_child_init(): TCP connection established"
147 147
 				" on socket=%d\n", sockfd);
148
-	
148
+
149 149
 	rb = (rd_buf_t*)pkg_malloc(sizeof(rd_buf_t));
150 150
 	if(!rb)
151 151
 	{
... ...
@@ -190,44 +190,44 @@ static int group_fixup(void** param, int param_no)
190 190
 	void* ptr;
191 191
 	str* s;
192 192
 
193
-	if (param_no == 1) 
193
+	if (param_no == 1)
194 194
 	{
195 195
 		ptr = *param;
196
-		
197
-		if (!strcasecmp((char*)*param, "Request-URI")) 
196
+
197
+		if (!strcasecmp((char*)*param, "Request-URI"))
198 198
 		{
199 199
 			*param = (void*)1;
200 200
 			goto end;
201
-		} 
201
+		}
202 202
 
203
-		if(!strcasecmp((char*)*param, "To")) 
203
+		if(!strcasecmp((char*)*param, "To"))
204 204
 		{
205 205
 			*param = (void*)2;
206 206
 			goto end;
207
-		} 
207
+		}
208 208
 
209
-		if (!strcasecmp((char*)*param, "From")) 
209
+		if (!strcasecmp((char*)*param, "From"))
210 210
 		{
211 211
 			*param = (void*)3;
212 212
 			goto end;
213
-		} 
213
+		}
214 214
 
215
-		if (!strcasecmp((char*)*param, "Credentials")) 
215
+		if (!strcasecmp((char*)*param, "Credentials"))
216 216
 		{
217 217
 			*param = (void*)4;
218 218
 			goto end;
219 219
 		}
220
-				
220
+
221 221
 		LOG(L_ERR, "group_fixup(): Unsupported Header Field identifier\n");
222 222
 		return E_UNSPEC;
223
-		
223
+
224 224
 		//pkg_free(ptr);
225
-	} 
226
-	
227
-	if (param_no == 2) 
225
+	}
226
+
227
+	if (param_no == 2)
228 228
 	{
229 229
 		s = (str*)pkg_malloc(sizeof(str));
230
-		if (!s) 
230
+		if (!s)
231 231
 		{
232 232
 			LOG(L_ERR, "group_fixup(): No memory left\n");
233 233
 			return E_UNSPEC;
... ...
@@ -1,5 +1,5 @@
1
-/* 
2
- * $Id$ 
1
+/*
2
+ * $Id$
3 3
  *
4 4
  * Digest Authentication - Radius support
5 5
  *
... ...
@@ -22,8 +22,8 @@
22 22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 23
  * GNU General Public License for more details.
24 24
  *
25
- * You should have received a copy of the GNU General Public License 
26
- * along with this program; if not, write to the Free Software 
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program; if not, write to the Free Software
27 27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 28
  *
29 29
  * History:
... ...
@@ -83,8 +83,8 @@ static cmd_export_t cmds[] = {
83 83
  * Exported parameters
84 84
  */
85 85
 static param_export_t params[] = {
86
-	{"radius_config",    STR_PARAM, &radius_config   },
87
-	{"service_type",     INT_PARAM, &service_type    },
86
+	{"radius_config",    PARAM_STRING, &radius_config   },
87
+	{"service_type",     PARAM_INT,   &service_type    },
88 88
 	{0, 0, 0}
89 89
 };
90 90
 
... ...
@@ -93,7 +93,7 @@ static param_export_t params[] = {
93 93
  * Module interface
94 94
  */
95 95
 struct module_exports exports = {
96
-	"auth_radius", 
96
+	"auth_radius",
97 97
 	cmds,       /* Exported functions */
98 98
 	0,          /* RPC methods */
99 99
 	params,     /* Exported parameters */
... ...
@@ -20,8 +20,8 @@
20 20
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 21
  * GNU General Public License for more details.
22 22
  *
23
- * You should have received a copy of the GNU General Public License 
24
- * along with this program; if not, write to the Free Software 
23
+ * You should have received a copy of the GNU General Public License
24
+ * along with this program; if not, write to the Free Software
25 25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 26
  */
27 27
 
... ...
@@ -30,7 +30,7 @@
30 30
  *  2005-12-22  merge changes from private branch (mma)
31 31
  *  2006-01-03  avp_body merged (mma)
32 32
  */
33
- 
33
+
34 34
 #include <string.h>
35 35
 #include <stdlib.h>
36 36
 #include "../../sr_module.h"
... ...
@@ -52,7 +52,7 @@
52 52
 #include "../../parser/parse_hname2.h"
53 53
 #include "../xlog/xl_lib.h"
54 54
 #define NO_SCRIPT -1
55
- 
55
+
56 56
 MODULE_VERSION
57 57
 
58 58
 /* name of attributed used to store flags with command flags2attr */
... ...
@@ -150,13 +150,13 @@ static cmd_export_t cmds[] = {
150 150
  * Exported parameters
151 151
  */
152 152
 static param_export_t params[] = {
153
-	{"xlbuf_size", INT_PARAM, &xlbuf_size},
153
+	{"xlbuf_size", PARAM_INT, &xlbuf_size},
154 154
 	{0, 0, 0}
155 155
 };
156 156
 
157 157
 
158 158
 struct module_exports exports = {
159
-	"avp", 
159
+	"avp",
160 160
 	cmds,           /* Exported commands */
161 161
 	0,		/* RPC */
162 162
 	params,         /* Exported parameters */
... ...
@@ -170,12 +170,12 @@ struct module_exports exports = {
170 170
 static int xl_printstr(struct sip_msg* msg, xl_elog_t* format, char** res, int* res_len)
171 171
 {
172 172
 	int len;
173
-	
173
+
174 174
 	if (!format || !res) {
175 175
 		LOG(L_ERR, "xl_printstr: Called with null format or res\n");
176 176
 		return -1;
177 177
 	}
178
-		
178
+
179 179
 	if (!xlbuf) {
180 180
 		xlbuf=pkg_malloc((xlbuf_size+1)*sizeof(char));
181 181
 		if (!xlbuf) {
... ...
@@ -189,7 +189,7 @@ static int xl_printstr(struct sip_msg* msg, xl_elog_t* format, char** res, int*
189 189
 		LOG(L_ERR, "xl_printstr: Error while formating result\n");
190 190
 		return -1;
191 191
 	}
192
-	
192
+
193 193
 	if ((xl_nul) && (xl_nul->len==len) && !strncmp(xl_nul->s, xlbuf, len))
194 194
 		return 0;
195 195
 
... ...
@@ -199,7 +199,7 @@ static int xl_printstr(struct sip_msg* msg, xl_elog_t* format, char** res, int*
199 199
 }
200 200
 
201 201
 
202
-static int set_sattr(struct sip_msg* msg, char* attr, char* val) 
202
+static int set_sattr(struct sip_msg* msg, char* attr, char* val)
203 203
 {
204 204
 	int_str name, value;
205 205
 
... ...
@@ -218,7 +218,7 @@ static int set_sattr(struct sip_msg* msg, char* attr, char* val)
218 218
 }
219 219
 
220 220
 
221
-static int set_iattr(struct sip_msg* msg, char* attr, char* nr) 
221
+static int set_iattr(struct sip_msg* msg, char* attr, char* nr)
222 222
 {
223 223
 	int_str name, value;
224 224
 
... ...
@@ -234,7 +234,7 @@ static int set_iattr(struct sip_msg* msg, char* attr, char* nr)
234 234
 
235 235
 	LOG(L_DBG, "set_iattr ok\n");
236 236
 	return 1;
237
-}	
237
+}
238 238
 
239 239
 
240 240
 static int flags2attr(struct sip_msg* msg, char* foo, char* bar)
... ...
@@ -315,7 +315,7 @@ static int attr2uri(struct sip_msg* msg, char* attr, char* foo)
315 315
 
316 316
 	name.s=*(str*)attr;
317 317
 
318
-	avp_entry = search_first_avp(AVP_NAME_STR | AVP_VAL_STR, 
318
+	avp_entry = search_first_avp(AVP_NAME_STR | AVP_VAL_STR,
319 319
 				     name, &value, NULL);
320 320
 	if (avp_entry == 0) {
321 321
 		LOG(L_ERR, "attr2uri: AVP '%.*s' not found\n", name.s.len, ZSW(name.s.s));
... ...
@@ -333,11 +333,11 @@ static int attr2uri(struct sip_msg* msg, char* attr, char* foo)
333 333
 
334 334
 
335 335
 /*
336
- *  returns 1 if msg contains an AVP with the given name and value, 
336
+ *  returns 1 if msg contains an AVP with the given name and value,
337 337
  *  returns -1 otherwise
338 338
  */
339 339
 static int avp_equals(struct sip_msg* msg, char* key, char* value)
340
-{	
340
+{
341 341
 	int_str avp_key, avp_value;
342 342
 	struct usr_avp *avp_entry;
343 343
 	struct search_state st;
... ...
@@ -349,15 +349,15 @@ static int avp_equals(struct sip_msg* msg, char* key, char* value)
349 349
 	
350 350
 	avp_key.s = *key_str;
351 351
 	avp_entry = search_first_avp(AVP_NAME_STR, avp_key, &avp_value, &st);
352
-	
352
+
353 353
 	if (avp_entry == 0) {
354 354
 		DBG("avp_equals: AVP '%.*s' not found\n", key_str->len, ZSW(key_str->s));
355 355
 		return -1;
356 356
 	}
357
-	
357
+
358 358
 	if (!value) {
359 359
 		DBG("avp_equals: at least one AVP '%.*s' found\n", key_str->len, ZSW(key_str->s));
360
-		return 1;         
360
+		return 1;
361 361
 	}
362 362
 
363 363
 	val_str = (str*)value;
... ...
@@ -365,15 +365,15 @@ static int avp_equals(struct sip_msg* msg, char* key, char* value)
365 365
 		if (avp_entry->flags & AVP_VAL_STR) {
366 366
 			if ((avp_value.s.len == val_str->len) &&
367 367
 			    !memcmp(avp_value.s.s, val_str->s, avp_value.s.len)) {
368
-				DBG("avp_equals str ('%.*s', '%.*s'): TRUE\n", 
368
+				DBG("avp_equals str ('%.*s', '%.*s'): TRUE\n",
369 369
 				    key_str->len, ZSW(key_str->s),
370 370
 				    val_str->len, ZSW(val_str->s));
371 371
 				return 1;
372 372
 			}
373 373
 		} else {
374 374
 			if (avp_value.n == str2s(val_str->s, val_str->len, 0)){
375
-				DBG("avp_equals (%.*s, %.*s): TRUE\n", 
376
-				    key_str->len, ZSW(key_str->s), 
375
+				DBG("avp_equals (%.*s, %.*s): TRUE\n",
376
+				    key_str->len, ZSW(key_str->s),
377 377
 				    val_str->len, ZSW(val_str->s));
378 378
 				return 1;
379 379
 			}
... ...
@@ -381,8 +381,8 @@ static int avp_equals(struct sip_msg* msg, char* key, char* value)
381 381
 		avp_entry = search_next_avp (&st, &avp_value);
382 382
 	}
383 383
 
384
-	DBG("avp_equals ('%.*s', '%.*s'): FALSE\n", 
385
-	    key_str->len, ZSW(key_str->s), 
384
+	DBG("avp_equals ('%.*s', '%.*s'): FALSE\n",
385
+	    key_str->len, ZSW(key_str->s),
386 386
 	    val_str->len, ZSW(val_str->s));
387 387
 	return -1;
388 388
 }
... ...
@@ -430,7 +430,7 @@ static void dump_avp_reverse(avp_t* avp)
430 430
 	if (avp) {
431 431
 		/* AVPs are added to front of the list, reverse by recursion */
432 432
 		dump_avp_reverse(avp->next);
433
-		
433
+
434 434
 		name=get_avp_name(avp);
435 435
 		get_avp_val(avp, &val);
436 436
 		switch ( avp->flags&(AVP_NAME_STR|AVP_VAL_STR) )
... ...
@@ -460,7 +460,7 @@ static void dump_avp_reverse(avp_t* avp)
460 460
 static int dump_avp(struct sip_msg* m, char* x, char* y)
461 461
 {
462 462
 	avp_list_t avp_list;
463
-	
463
+
464 464
 	avp_list=get_avp_list(AVP_CLASS_USER | AVP_TRACK_FROM);
465 465
 	INFO("track=FROM class=USER\n");
466 466
 	if (!avp_list) {
... ...
@@ -514,7 +514,7 @@ static int request_hf_helper(struct sip_msg* msg, str* hf, avp_ident_t* ident, s
514 514
 
515 515
                 pos = msg->headers;
516 516
                 while (pos && (pos->type!=HDR_EOH_T)) {
517
-                        if ((hf->len==pos->name.len) 
517
+                        if ((hf->len==pos->name.len)
518 518
                         && (!strncasecmp(hf->s, pos->name.s, pos->name.len))) {
519 519
                                 found=pos;
520 520
                                 if (front)
... ...
@@ -575,14 +575,14 @@ static int request_hf_helper(struct sip_msg* msg, str* hf, avp_ident_t* ident, s
575 575
 		memcpy(s+hf->len+2, fin_val.s, fin_val.len );
576 576
 		memcpy(s+hf->len+2+fin_val.len, "\r\n", 2);
577 577
 
578
-		
578
+
579 579
 		if (reply) {
580 580
 			if (add_lump_rpl( msg, s, len, LUMP_RPL_HDR | LUMP_RPL_NODUP) == 0) {
581 581
 				LOG(L_ERR,"ERROR: request_hf_helper: Can't insert RPL lump\n");
582 582
 				pkg_free(s);
583 583
 				return -1;
584 584
 			}
585
-		} else {		
585
+		} else {
586 586
 			if ((front && (insert_new_lump_before(new_anchor, s, len, 0) == 0))
587 587
 			|| (!front && (insert_new_lump_after(new_anchor, s, len, 0) == 0))) {
588 588
 				LOG(L_ERR, "ERROR: request_hf_helper: Can't insert lump\n");
... ...
@@ -634,7 +634,7 @@ static int append_req(struct sip_msg* m, char* hf, char* name)
634 634
 static int replace_req(struct sip_msg* m, char* hf, char* name)
635 635
 {
636 636
 	struct hdr_field* pos;
637
-	
637
+
638 638
 	if (parse_headers(m, HDR_EOH_F, 0) == -1) {
639 639
 		LOG(L_ERR, "ERROR: replace_req: Error while parsing message\n");
640 640
 		return -1;
... ...
@@ -642,7 +642,7 @@ static int replace_req(struct sip_msg* m, char* hf, char* name)
642 642
 
643 643
 	pos = m->headers;
644 644
 	while (pos && (pos->type!=HDR_EOH_T)) {
645
-		if ((((str*)hf)->len==pos->name.len) 
645
+		if ((((str*)hf)->len==pos->name.len)
646 646
 		&& (!strncasecmp(((str*)hf)->s, pos->name.s, pos->name.len))) {
647 647
 			if (del_lump(m, pos->name.s - m->buf, pos->len, 0)==0) {
648 648
 				LOG(L_ERR,"ERROR: Can't insert del lump\n");
... ...
@@ -678,7 +678,7 @@ static int w_set_destination(struct sip_msg* m, str* dest)
678 678
 	} else {
679 679
 		/* it is just URI, pass it through */
680 680
 		return set_dst_uri(m, dest);
681
-	}			
681
+	}
682 682
 }
683 683
 
684 684
 static int xlset_destination(struct sip_msg* m, char* format, char* x)
... ...
@@ -693,7 +693,7 @@ static int xlset_destination(struct sip_msg* m, char* format, char* x)
693 693
 			return -1;
694 694
 	} else
695 695
 		return -1;
696
-	
696
+
697 697
 }
698 698
 
699 699
 static int avp_destination(struct sip_msg* m, char* avp_name, char* x)
... ...
@@ -1041,22 +1041,22 @@ static int iattr_fixup(void** param, int param_no)
1041 1041
 {
1042 1042
 	unsigned long num;
1043 1043
 	int err;
1044
-	
1044
+
1045 1045
 	str* s;
1046
-	
1046
+
1047 1047
 	if (param_no == 1) {
1048 1048
 		s = (str*)pkg_malloc(sizeof(str));
1049 1049
 		if (!s) {
1050 1050
 			LOG(L_ERR, "iattr_fixup: No memory left\n");
1051 1051
 			return E_UNSPEC;
1052 1052
 		}
1053
-		
1053
+
1054 1054
 		s->s = (char*)*param;
1055 1055
 		s->len = strlen(s->s);
1056 1056
 		*param = (void*)s;
1057 1057
 	} else if (param_no == 2) {
1058 1058
 		num = str2s(*param, strlen(*param), &err);
1059
-		
1059
+
1060 1060
 		if (err == 0) {
1061 1061
 			pkg_free(*param);
1062 1062
 			*param=(void*)num;
... ...
@@ -1071,45 +1071,45 @@ static int iattr_fixup(void** param, int param_no)
1071 1071
 }
1072 1072
 
1073 1073
 
1074
-/*  
1075
- * Convert xl format string to xl format description   
1074
+/*
1075
+ * Convert xl format string to xl format description
1076 1076
  */
1077 1077
 static int fixup_xl_1(void** param, int param_no)
1078 1078
 {
1079 1079
  	xl_elog_t* model;
1080
-	
1080
+
1081 1081
 	if (!xl_print) {
1082 1082
 		xl_print=(xl_print_log_f*)find_export("xprint", NO_SCRIPT, 0);
1083
-		
1083
+
1084 1084
 		if (!xl_print) {
1085 1085
 			LOG(L_CRIT,"ERROR: cannot find \"xprint\", is module xlog loaded?\n");
1086 1086
 			return -1;
1087 1087
 		}
1088 1088
 	}
1089
-	
1089
+
1090 1090
 	if (!xl_parse) {
1091 1091
 		xl_parse=(xl_parse_format_f*)find_export("xparse", NO_SCRIPT, 0);
1092
-		
1092
+
1093 1093
 		if (!xl_parse) {
1094 1094
 			LOG(L_CRIT,"ERROR: cannot find \"xparse\", is module xlog loaded?\n");
1095 1095
 			return -1;
1096 1096
 		}
1097 1097
 	}
1098
-	
1098
+
1099 1099
 	if (!xl_nul) {
1100 1100
 		xl_getnul=(xl_get_nulstr_f*)find_export("xnulstr", NO_SCRIPT, 0);
1101 1101
 		if (xl_getnul)
1102 1102
 			xl_nul=xl_getnul();
1103
-		
1103
+
1104 1104
 		if (!xl_nul){
1105 1105
                         LOG(L_CRIT,"ERROR: cannot find \"xnulstr\", is module xlog loaded?\n");
1106 1106
                         return -1;
1107 1107
                 }
1108 1108
                 else
1109 1109
                  LOG(L_INFO,"INFO: xlog null is \"%.*s\"\n", xl_nul->len, xl_nul->s);
1110
-		                                                                
1110
+
1111 1111
 	}
1112
-	
1112
+
1113 1113
 	if (param_no == 1 ) {
1114 1114
                 if(*param) {
1115 1115
                         if(xl_parse((char*)(*param), &model)<0) {
... ...
@@ -1170,10 +1170,10 @@ static int fixup_str_1_attr_2(void** param, int param_no)
1170 1170
 	if (param_no == 1) {
1171 1171
 		return fixup_str_12(param, 1);
1172 1172
 	}
1173
-	
1173
+
1174 1174
 	if (param_no == 2) {
1175 1175
 		return fixup_attr_1(param, 1);
1176 1176
 	}
1177
-	
1177
+
1178 1178
 	return 0;
1179 1179
 }
... ...
@@ -20,8 +20,8 @@
20 20
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 21
  * GNU General Public License for more details.
22 22
  *
23
- * You should have received a copy of the GNU General Public License 
24
- * along with this program; if not, write to the Free Software 
23
+ * You should have received a copy of the GNU General Public License
24
+ * along with this program; if not, write to the Free Software
25 25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 26
  */
27 27
 
... ...
@@ -30,7 +30,7 @@
30 30
  * --------
31 31
  * 2004-06-14 added ability to read default values from DB table usr_preferences_types (kozlik)
32 32
  */
33
-   
33
+
34 34
 #include <string.h>
35 35
 #include "../../sr_module.h"
36 36
 #include "../../mem/mem.h"
... ...
@@ -85,12 +85,12 @@ static cmd_export_t cmds[] = {
85 85
  * Exported parameters
86 86
  */
87 87
 static param_export_t params[] = {
88
-	{"db_url",       STR_PARAM, &db_url      },
89
-	{"uid_column",   STR_PARAM, &uid_column  },
90
-	{"name_column",  STR_PARAM, &name_column },
91
-	{"type_column",  STR_PARAM, &name_column },
92
-	{"value_column", STR_PARAM, &val_column  },
93
-	{"flags_column", STR_PARAM, &flags_column  },
88
+	{"db_url",       PARAM_STRING, &db_url      },
89
+	{"uid_column",   PARAM_STRING, &uid_column  },
90
+	{"name_column",  PARAM_STRING, &name_column },
91
+	{"type_column",  PARAM_STRING, &name_column },
92
+	{"value_column", PARAM_STRING, &val_column  },
93
+	{"flags_column", PARAM_STRING, &flags_column  },
94 94
 	{0, 0, 0}
95 95
 };
96 96
 
... ...
@@ -155,7 +155,7 @@ static int load_attrs(str* uid, int track)
155 155
 		LOG(L_ERR, "avp_db:load_attrs: Invalid database handle\n");
156 156
 		return -1;
157 157
 	}
158
-	
158
+
159 159
 	keys[0] = uid_column;
160 160
 	kv[0].type = DB_STR;
161 161
 	kv[0].nul = 0;
... ...
@@ -21,8 +21,8 @@
21 21
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 22
  * GNU General Public License for more details.
23 23
  *
24
- * You should have received a copy of the GNU General Public License 
25
- * along with this program; if not, write to the Free Software 
24
+ * You should have received a copy of the GNU General Public License
25
+ * along with this program; if not, write to the Free Software
26 26
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27 27
  */
28 28
 
... ...
@@ -89,15 +89,15 @@ static cmd_export_t cmds[] = {
89 89
  * Exported parameters
90 90
  */
91 91
 static param_export_t params[] = {
92
-	{"radius_config",       STR_PARAM, &radius_config      },
93
-	{"caller_service_type", INT_PARAM, &caller_service_type},
94
-	{"callee_service_type", INT_PARAM, &callee_service_type},
92
+	{"radius_config",       PARAM_STRING, &radius_config      },
93
+	{"caller_service_type", PARAM_INT,    &caller_service_type},
94
+	{"callee_service_type", PARAM_INT,    &callee_service_type},
95 95
 	{0, 0, 0}
96
-};	
96
+};
97 97
 
98 98
 
99 99
 struct module_exports exports = {
100
-	"avp_radius", 
100
+	"avp_radius",
101 101
 	cmds,      /* Exported commands */
102 102
 	0,         /* RPC methods */
103 103
 	params,    /* Exported parameters */
... ...
@@ -125,20 +125,20 @@ static int mod_init(void)
125 125
 
126 126
 	     /* open log */
127 127
 	rc_openlog("ser");
128
-	
128
+