Browse code

dialog: some formatting fixes and updates

Daniel-Constantin Mierla authored on 17/08/2022 09:21:54
Showing 1 changed files
... ...
@@ -265,7 +265,7 @@ static cmd_export_t cmds[]={
265 265
 	{"dlg_set_property", (cmd_function)w_dlg_set_property,1,fixup_spve_null,
266 266
 			0, ANY_ROUTE },
267 267
 	{"dlg_reset_property", (cmd_function)w_dlg_reset_property,1,fixup_spve_null,
268
-            0, ANY_ROUTE },
268
+			0, ANY_ROUTE },
269 269
 	{"dlg_remote_profile", (cmd_function)w_dlg_remote_profile, 5, fixup_dlg_remote_profile,
270 270
 			0, ANY_ROUTE },
271 271
 	{"dlg_set_ruri",       (cmd_function)w_dlg_set_ruri,  0, NULL,
... ...
@@ -573,8 +573,8 @@ static int mod_init(void)
573 573
 	}
574 574
 
575 575
 	if (timeout_spec.s) {
576
-		if ( pv_parse_spec(&timeout_spec, &timeout_avp)==0
577
-				&& (timeout_avp.type!=PVT_AVP)){
576
+		if (pv_parse_spec(&timeout_spec, &timeout_avp)==0
577
+				&& (timeout_avp.type!=PVT_AVP)) {
578 578
 			LM_ERR("malformed or non AVP timeout "
579 579
 				"AVP definition in '%.*s'\n", timeout_spec.len,timeout_spec.s);
580 580
 			return -1;
... ...
@@ -603,9 +603,8 @@ static int mod_init(void)
603 603
 		return -1;
604 604
 	}
605 605
 
606
-	if (seq_match_mode!=SEQ_MATCH_NO_ID &&
607
-	seq_match_mode!=SEQ_MATCH_FALLBACK &&
608
-	seq_match_mode!=SEQ_MATCH_STRICT_ID ) {
606
+	if (seq_match_mode!=SEQ_MATCH_NO_ID && seq_match_mode!=SEQ_MATCH_FALLBACK
607
+			&& seq_match_mode!=SEQ_MATCH_STRICT_ID ) {
609 608
 		LM_ERR("invalid value %d for seq_match_mode param!!\n",seq_match_mode);
610 609
 		return -1;
611 610
 	}
... ...
@@ -699,7 +698,8 @@ static int mod_init(void)
699 698
 
700 699
 	/* init handlers */
701 700
 	init_dlg_handlers( rr_param, dlg_flag,
702
-		timeout_spec.s?&timeout_avp:0, default_timeout, seq_match_mode, dlg_keep_proxy_rr);
701
+			timeout_spec.s?&timeout_avp:0, default_timeout, seq_match_mode,
702
+			dlg_keep_proxy_rr);
703 703
 
704 704
 	/* init timer */
705 705
 	if (init_dlg_timer(dlg_ontimeout)!=0) {
... ...
@@ -736,8 +736,8 @@ static int mod_init(void)
736 736
 	if (dlg_db_mode==DB_MODE_NONE) {
737 737
 		db_url.s = 0; db_url.len = 0;
738 738
 	} else {
739
-		if (dlg_db_mode!=DB_MODE_REALTIME &&
740
-		dlg_db_mode!=DB_MODE_DELAYED && dlg_db_mode!=DB_MODE_SHUTDOWN ) {
739
+		if (dlg_db_mode!=DB_MODE_REALTIME && dlg_db_mode!=DB_MODE_DELAYED
740
+				&& dlg_db_mode!=DB_MODE_SHUTDOWN ) {
741 741
 			LM_ERR("unsupported db_mode %d\n", dlg_db_mode);
742 742
 			return -1;
743 743
 		}
... ...
@@ -745,13 +745,13 @@ static int mod_init(void)
745 745
 			LM_ERR("db_url not configured for db_mode %d\n", dlg_db_mode);
746 746
 			return -1;
747 747
 		}
748
-		if (init_dlg_db(&db_url, dlg_hash_size, db_update_period, db_fetch_rows, db_skip_load)!=0) {
748
+		if (init_dlg_db(&db_url, dlg_hash_size, db_update_period, db_fetch_rows,
749
+					db_skip_load)!=0) {
749 750
 			LM_ERR("failed to initialize the DB support\n");
750 751
 			return -1;
751 752
 		}
752 753
 	}
753 754
 
754
-
755 755
 	/* timer process to send keep alive requests */
756 756
 	if(dlg_ka_timer>0 && dlg_ka_interval>0)
757 757
 		register_sync_timers(1);
... ...
@@ -1260,7 +1260,8 @@ static int fixup_dlg_req_with_headers_and_content(void** param, int param_no)
1260 1260
 	return 0;
1261 1261
 }
1262 1262
 
1263
-static int w_dlg_req_with_headers_and_content(struct sip_msg *msg, char *side, char *method, char* headers, char *content_type, char *content)
1263
+static int w_dlg_req_with_headers_and_content(struct sip_msg *msg, char *side,
1264
+		char *method, char* headers, char *content_type, char *content)
1264 1265
 {
1265 1266
 	dlg_cell_t *dlg = NULL;
1266 1267
 	int n;
... ...
@@ -1294,7 +1295,7 @@ static int w_dlg_req_with_headers_and_content(struct sip_msg *msg, char *side, c
1294 1295
 		{
1295 1296
 			LM_ERR("invalid Headers parameter\n");
1296 1297
 			goto error;
1297
-		}		
1298
+		}
1298 1299
 	}
1299 1300
 	if (content_type && content) {
1300 1301
 		if(fixup_get_svalue(msg, (gparam_p)content_type, &str_content_type)!=0)
... ...
@@ -1306,7 +1307,7 @@ static int w_dlg_req_with_headers_and_content(struct sip_msg *msg, char *side, c
1306 1307
 		{
1307 1308
 			LM_ERR("invalid Headers parameter\n");
1308 1309
 			goto error;
1309
-		}		
1310
+		}
1310 1311
 		if(fixup_get_svalue(msg, (gparam_p)content, &str_content)!=0)
1311 1312
 		{
1312 1313
 			LM_ERR("unable to get Content\n");
... ...
@@ -1316,23 +1317,27 @@ static int w_dlg_req_with_headers_and_content(struct sip_msg *msg, char *side, c
1316 1317
 		{
1317 1318
 			LM_ERR("invalid Content parameter\n");
1318 1319
 			goto error;
1319
-		}		
1320
+		}
1320 1321
 	}
1321
-	
1322
+
1322 1323
 	n = (int)(long)side;
1323 1324
 	if(n==1)
1324 1325
 	{
1325
-		if(dlg_request_within(msg, dlg, DLG_CALLER_LEG, &str_method, &str_headers, &str_content_type, &str_content)!=0)
1326
+		if(dlg_request_within(msg, dlg, DLG_CALLER_LEG, &str_method, &str_headers,
1327
+					&str_content_type, &str_content)!=0)
1326 1328
 			goto error;
1327 1329
 		goto done;
1328 1330
 	} else if(n==2) {
1329
-		if(dlg_request_within(msg, dlg, DLG_CALLEE_LEG, &str_method, &str_headers, &str_content_type, &str_content)!=0)
1331
+		if(dlg_request_within(msg, dlg, DLG_CALLEE_LEG, &str_method, &str_headers,
1332
+					&str_content_type, &str_content)!=0)
1330 1333
 			goto error;
1331 1334
 		goto done;
1332 1335
 	} else {
1333
-		if(dlg_request_within(msg, dlg, DLG_CALLER_LEG, &str_method, &str_headers, &str_content_type, &str_content)!=0)
1336
+		if(dlg_request_within(msg, dlg, DLG_CALLER_LEG, &str_method, &str_headers,
1337
+					&str_content_type, &str_content)!=0)
1334 1338
 			goto error;
1335
-		if(dlg_request_within(msg, dlg, DLG_CALLEE_LEG, &str_method, &str_headers, &str_content_type, &str_content)!=0)
1339
+		if(dlg_request_within(msg, dlg, DLG_CALLEE_LEG, &str_method, &str_headers,
1340
+					&str_content_type, &str_content)!=0)
1336 1341
 			goto error;
1337 1342
 		goto done;
1338 1343
 	}
... ...
@@ -1343,15 +1348,18 @@ done:
1343 1348
 
1344 1349
 error:
1345 1350
 	dlg_release(dlg);
1346
-	return -1;		
1351
+	return -1;
1347 1352
 }
1348 1353
 
1349
-static int w_dlg_req_with_content(struct sip_msg *msg, char *side, char *method, char *content_type, char *content)
1354
+static int w_dlg_req_with_content(struct sip_msg *msg, char *side, char *method,
1355
+		char *content_type, char *content)
1350 1356
 {
1351
-	return w_dlg_req_with_headers_and_content(msg, side, method, NULL, content_type, content);
1357
+	return w_dlg_req_with_headers_and_content(msg, side, method, NULL,
1358
+			content_type, content);
1352 1359
 }
1353 1360
 
1354
-static int w_dlg_req_with_headers(struct sip_msg *msg, char *side, char *method, char *headers)
1361
+static int w_dlg_req_with_headers(struct sip_msg *msg, char *side, char *method,
1362
+		char *headers)
1355 1363
 {
1356 1364
 	return w_dlg_req_with_headers_and_content(msg, side, method, headers, NULL, NULL);
1357 1365
 }
... ...
@@ -1369,7 +1377,7 @@ static int w_dlg_bye(struct sip_msg *msg, char *side, char *s2)
1369 1377
 	dlg = dlg_get_ctx_dialog();
1370 1378
 	if(dlg==NULL)
1371 1379
 		return -1;
1372
-	
1380
+
1373 1381
 	n = (int)(long)side;
1374 1382
 	if(n==1)
1375 1383
 	{
... ...
@@ -1404,7 +1412,7 @@ static int w_dlg_refer(struct sip_msg *msg, char *side, char *to)
1404 1412
 	dlg = dlg_get_ctx_dialog();
1405 1413
 	if(dlg==NULL)
1406 1414
 		return -1;
1407
-	
1415
+
1408 1416
 	n = (int)(long)side;
1409 1417
 
1410 1418
 	if(fixup_get_svalue(msg, (gparam_p)to, &st)!=0)
... ...
@@ -1658,7 +1666,7 @@ static int w_dlg_reset_property(struct sip_msg *msg, char *prop, char *s2)
1658 1666
 }
1659 1667
 
1660 1668
 static int w_dlg_set_timeout_by_profile3(struct sip_msg *msg, char *profile,
1661
-					char *value, char *timeout_str) 
1669
+					char *value, char *timeout_str)
1662 1670
 {
1663 1671
 	pv_elem_t *pve = NULL;
1664 1672
 	str val_s;
... ...
@@ -1666,22 +1674,21 @@ static int w_dlg_set_timeout_by_profile3(struct sip_msg *msg, char *profile,
1666 1674
 	pve = (pv_elem_t *) value;
1667 1675
 
1668 1676
 	if(pve != NULL && ((struct dlg_profile_table *) profile)->has_value) {
1669
-		if(pv_printf_s(msg,pve, &val_s) != 0 || 
1670
-		   !val_s.s || val_s.len == 0) {
1677
+		if(pv_printf_s(msg,pve, &val_s) != 0 || !val_s.s || val_s.len == 0) {
1671 1678
 			LM_WARN("cannot get string for value\n");
1672 1679
 			return -1;
1673 1680
 		}
1674 1681
 	}
1675 1682
 
1676 1683
 	if(dlg_set_timeout_by_profile((struct dlg_profile_table *) profile,
1677
-				   &val_s, atoi(timeout_str)) != 0)
1684
+				&val_s, atoi(timeout_str)) != 0)
1678 1685
 		return -1;
1679 1686
 
1680 1687
 	return 1;
1681 1688
 }
1682 1689
 
1683
-static int w_dlg_set_timeout_by_profile2(struct sip_msg *msg, 
1684
-					 char *profile, char *timeout_str)
1690
+static int w_dlg_set_timeout_by_profile2(struct sip_msg *msg,
1691
+		char *profile, char *timeout_str)
1685 1692
 {
1686 1693
 	return w_dlg_set_timeout_by_profile3(msg, profile, NULL, timeout_str);
1687 1694
 }
... ...
@@ -3086,12 +3093,12 @@ static const char *rpc_end_dlg_entry_id_doc[2] = {
3086 3093
 	"End a given dialog based on [h_entry] [h_id]", 0
3087 3094
 };
3088 3095
 static const char *rpc_dlg_terminate_dlg_doc[2] = {
3089
-        "End a given dialog based on callid", 0
3096
+	"End a given dialog based on callid", 0
3090 3097
 };
3091 3098
 static const char *rpc_dlg_set_state_doc[3] = {
3092
-        "Set state for a dialog based on callid and tags",
3093
-        "It is targeting the need to update from state 4 (confirmed) to 5 (terminated)",
3094
-        0
3099
+	"Set state for a dialog based on callid and tags",
3100
+	"It is targeting the need to update from state 4 (confirmed) to 5 (terminated)",
3101
+	0
3095 3102
 };
3096 3103
 static const char *rpc_profile_get_size_doc[2] = {
3097 3104
 	"Returns the number of dialogs belonging to a profile", 0
... ...
@@ -3157,10 +3164,10 @@ static void rpc_dlg_terminate_dlg(rpc_t *rpc,void *c){
3157 3164
 	LM_DBG("Dialog bye return code %d \n",ret);
3158 3165
 
3159 3166
 	if(ret>=0) {
3160
-        LM_WARN("Dialog is terminated callid: '%.*s' \n",
3161
-        		callid.len, callid.s);
3162
-        dlg_release(dlg);
3163
-    }
3167
+		LM_WARN("Dialog is terminated callid: '%.*s' \n",
3168
+		callid.len, callid.s);
3169
+		dlg_release(dlg);
3170
+	}
3164 3171
 }
3165 3172
 
3166 3173
 static void rpc_dlg_set_state(rpc_t *rpc,void *c){
... ...
@@ -3251,7 +3258,7 @@ static void rpc_dlg_is_alive(rpc_t *rpc, void *c)
3251 3258
 		return;
3252 3259
 	}
3253 3260
 	state = dlg->state;
3254
-    dlg_release(dlg);
3261
+	dlg_release(dlg);
3255 3262
 	if (state != DLG_STATE_CONFIRMED) {
3256 3263
 		LM_DBG("Dialog with Call-ID '%.*s' is in state: %d (confirmed: %d)\n",
3257 3264
 				callid.len, callid.s, state, DLG_STATE_CONFIRMED);
... ...
@@ -3548,7 +3555,7 @@ static void rpc_dlg_list_match_ex(rpc_t *rpc, void *c, int with_context)
3548 3555
 						matched = 1;
3549 3556
 					}
3550 3557
 				break;
3551
-				case 3:		
3558
+				case 3:
3552 3559
 					/* greater than */
3553 3560
 					if (str2int(&mval, &mival) == 0 && ival > mival) {
3554 3561
 						matched = 1;