Browse code

registrar: coherent code formatting

Daniel-Constantin Mierla authored on 01/10/2018 06:34:21
Showing 2 changed files
... ...
@@ -83,7 +83,7 @@ int regapi_lookup(sip_msg_t *msg, str *table)
83 83
  *
84 84
  * table->s must be zero-terminated
85 85
  */
86
-int regapi_lookup_uri(sip_msg_t *msg, str *table, str * uri)
86
+int regapi_lookup_uri(sip_msg_t *msg, str *table, str *uri)
87 87
 {
88 88
 	udomain_t* d;
89 89
 
... ...
@@ -144,7 +144,7 @@ int regapi_lookup_to_dset(sip_msg_t *msg, str *table, str *uri)
144 144
 /**
145 145
  *
146 146
  */
147
-int bind_registrar(registrar_api_t* api)
147
+int bind_registrar(registrar_api_t *api)
148 148
 {
149 149
 	if (!api) {
150 150
 		ERR("Invalid parameter value\n");
... ...
@@ -74,7 +74,8 @@ static int w_registered(struct sip_msg* _m, char* _d, char* _uri);
74 74
 static int w_unregister(struct sip_msg* _m, char* _d, char* _uri);
75 75
 static int w_unregister2(struct sip_msg* _m, char* _d, char* _uri, char *_ruid);
76 76
 static int w_registered3(struct sip_msg* _m, char* _d, char* _uri, char* _flags);
77
-static int w_registered4(struct sip_msg* _m, char* _d, char* _uri, char* _flags, char* _actionflags);
77
+static int w_registered4(struct sip_msg* _m, char* _d, char* _uri, char* _flags,
78
+		char* _actionflags);
78 79
 
79 80
 /*! \brief Fixup functions */
80 81
 static int domain_fixup(void** param, int param_no);
... ...
@@ -86,16 +87,22 @@ static int registered_fixup(void** param, int param_no);
86 87
 /*! \brief Functions */
87 88
 static int w_add_sock_hdr(struct sip_msg* msg, char *str, char *foo);
88 89
 
89
-int tcp_persistent_flag = -1;			/*!< if the TCP connection should be kept open */
90
-int method_filtering = 0;			/*!< if the looked up contacts should be filtered based on supported methods */
91
-int path_enabled = 0;				/*!< if the Path HF should be handled */
92
-int path_mode = PATH_MODE_STRICT;		/*!< if the Path HF should be inserted in the reply.
93
-			*   - STRICT (2): always insert, error if no support indicated in request
94
-			*   - LAZY   (1): insert only if support indicated in request
95
-			*   - OFF    (0): never insert */
90
+/*!< if the TCP connection should be kept open */
91
+int tcp_persistent_flag = -1;
92
+/*!< if the looked up contacts should be filtered based on supported methods */
93
+int method_filtering = 0;
94
+/*!< if the Path HF should be handled */
95
+int path_enabled = 0;
96
+/*!< if the Path HF should be inserted in the reply.
97
+	*   - STRICT (2): always insert, error if no support indicated in request
98
+	*   - LAZY   (1): insert only if support indicated in request
99
+	*   - OFF    (0): never insert */
100
+int path_mode = PATH_MODE_STRICT;
101
+
102
+/*!< if the received- and nat-parameters of last Path uri should be used
103
+	* to determine if UAC is nat'ed */
104
+int path_use_params = 0;
96 105
 
97
-int path_use_params = 0;			/*!< if the received- and nat-parameters of last Path uri should be used
98
-						 * to determine if UAC is nat'ed */
99 106
 int path_check_local = 0;
100 107
 
101 108
 /* sruid to get internal uid */
... ...
@@ -223,7 +230,7 @@ static param_export_t params[] = {
223 230
 	{"use_path",           INT_PARAM, &path_enabled        					},
224 231
 	{"path_mode",          INT_PARAM, &path_mode           					},
225 232
 	{"path_use_received",  INT_PARAM, &path_use_params     					},
226
-	{"path_check_local",   INT_PARAM, &path_check_local                                     },
233
+	{"path_check_local",   INT_PARAM, &path_check_local                     },
227 234
 	{"xavp_cfg",           PARAM_STR, &reg_xavp_cfg     					},
228 235
 	{"xavp_rcd",           PARAM_STR, &reg_xavp_rcd     					},
229 236
 	{"gruu_enabled",       INT_PARAM, &reg_gruu_enabled    					},
... ...
@@ -291,11 +298,13 @@ static int mod_init(void)
291 298
 
292 299
 	/* bind the SL API */
293 300
 	if (sl_load_api(&slb)!=0) {
294
-		LM_ERR("Cannot bind to SL API. Please load the SL module before loading this module.\n");
301
+		LM_ERR("Cannot bind to SL API. Please load the SL module before"
302
+				" loading this module.\n");
295 303
 		return -1;
296 304
 	}
297 305
 
298
-	if(cfg_declare("registrar", registrar_cfg_def, &default_registrar_cfg, cfg_sizeof(registrar), &registrar_cfg)){
306
+	if(cfg_declare("registrar", registrar_cfg_def, &default_registrar_cfg,
307
+				cfg_sizeof(registrar), &registrar_cfg)){
299 308
 		LM_ERR("Failed to declare the configuration parameters.\n");
300 309
 		return -1;
301 310
 	}
... ...
@@ -320,7 +329,8 @@ static int mod_init(void)
320 329
 
321 330
 	bind_usrloc = (bind_usrloc_t)find_export("ul_bind_usrloc", 1, 0);
322 331
 	if (!bind_usrloc) {
323
-		LM_ERR("Can't bind to the usrloc module. Please load it before this module.\n");
332
+		LM_ERR("Can't bind to the usrloc module."
333
+				"Please load it before this module.\n");
324 334
 		return -1;
325 335
 	}
326 336
 
... ...
@@ -353,11 +363,13 @@ static int mod_init(void)
353 363
 					reg_event_callback.s);
354 364
 			}
355 365
 		}
356
-		if (reg_expire_event_rt>=0 || (reg_event_callback.s!=NULL && keng !=NULL)) {
366
+		if (reg_expire_event_rt>=0 || (reg_event_callback.s!=NULL
367
+					&& keng !=NULL)) {
357 368
 			set_child_rpc_sip_mode();
358 369
 			if(ul.register_ulcb(UL_CONTACT_EXPIRE, reg_ul_expired_contact, 0)< 0)
359 370
 			{
360
-				LM_ERR("Can not register callback for expired contacts (usrloc module)\n");
371
+				LM_ERR("Can not register callback for expired contacts"
372
+						" (usrloc module)\n");
361 373
 				return -1;
362 374
 			}
363 375
 		}
... ...
@@ -379,17 +391,20 @@ static int mod_init(void)
379 391
 			sock_flag = -1;
380 392
 		}
381 393
 	} else if (sock_flag!=-1) {
382
-		LM_INFO("sock_flag defined but no sock_hdr_name or no reg_xavp_cfg -> resetting flag\n");
394
+		LM_INFO("sock_flag defined but no sock_hdr_name"
395
+				" or no reg_xavp_cfg -> resetting flag\n");
383 396
 		sock_flag = -1;
384 397
 	}
385 398
 
386 399
 	if (reg_outbound_mode < 0 || reg_outbound_mode > 2) {
387
-		LM_ERR("outbound_mode modparam must be 0 (not supported), 1 (supported), or 2 (supported and required)\n");
400
+		LM_ERR("outbound_mode modparam must be 0 (not supported),"
401
+				" 1 (supported), or 2 (supported and required)\n");
388 402
 		return -1;
389 403
 	}
390 404
 
391 405
 	if (reg_regid_mode < 0 || reg_regid_mode > 1) {
392
-		LM_ERR("regid_mode modparam must be 0 (use with outbound), 1 (use always)\n");
406
+		LM_ERR("regid_mode modparam must be 0 (use with outbound),"
407
+				" 1 (use always)\n");
393 408
 		return -1;
394 409
 	}
395 410
 
... ...
@@ -416,9 +431,9 @@ static int child_init(int rank)
416 431
 	if (rank==1) {
417 432
 		/* init stats */
418 433
 		//TODO if parameters are modified via cfg framework do i change them?
419
-		update_stat( max_expires_stat, default_registrar_cfg.max_expires );
420
-		update_stat( max_contacts_stat, default_registrar_cfg.max_contacts );
421
-		update_stat( default_expire_stat, default_registrar_cfg.default_expires );
434
+		update_stat(max_expires_stat, default_registrar_cfg.max_expires);
435
+		update_stat(max_contacts_stat, default_registrar_cfg.max_contacts);
436
+		update_stat(default_expire_stat, default_registrar_cfg.default_expires);
422 437
 	}
423 438
 
424 439
 	return 0;
... ...
@@ -453,7 +468,8 @@ static int w_save3(struct sip_msg* _m, char* _d, char* _cflags, char* _uri)
453 468
 static int w_lookup(struct sip_msg* _m, char* _d, char* _uri)
454 469
 {
455 470
 	str uri = {0};
456
-	if(_uri!=NULL && (fixup_get_svalue(_m, (gparam_p)_uri, &uri)!=0 || uri.len<=0))
471
+	if(_uri!=NULL && (fixup_get_svalue(_m, (gparam_p)_uri, &uri)!=0
472
+				|| uri.len<=0))
457 473
 	{
458 474
 		LM_ERR("invalid uri parameter\n");
459 475
 		return -1;
... ...
@@ -468,7 +484,8 @@ static int w_lookup(struct sip_msg* _m, char* _d, char* _uri)
468 484
 static int w_lookup_to_dset(struct sip_msg* _m, char* _d, char* _uri)
469 485
 {
470 486
 	str uri = {0};
471
-	if(_uri!=NULL && (fixup_get_svalue(_m, (gparam_p)_uri, &uri)!=0 || uri.len<=0))
487
+	if(_uri!=NULL && (fixup_get_svalue(_m, (gparam_p)_uri, &uri)!=0
488
+				|| uri.len<=0))
472 489
 	{
473 490
 		LM_ERR("invalid uri parameter\n");
474 491
 		return -1;
... ...
@@ -501,7 +518,8 @@ static int ki_lookup_branches(sip_msg_t* _m, str* _dtable)
501 518
 static int w_registered(struct sip_msg* _m, char* _d, char* _uri)
502 519
 {
503 520
 	str uri = {0};
504
-	if(_uri!=NULL && (fixup_get_svalue(_m, (gparam_p)_uri, &uri)!=0 || uri.len<=0))
521
+	if(_uri!=NULL && (fixup_get_svalue(_m, (gparam_p)_uri, &uri)!=0
522
+				|| uri.len<=0))
505 523
 	{
506 524
 		LM_ERR("invalid uri parameter\n");
507 525
 		return -1;
... ...
@@ -525,7 +543,8 @@ static int w_registered3(struct sip_msg* _m, char* _d, char* _uri, char* _flags)
525 543
 {
526 544
 	str uri = {0};
527 545
 	int flags = 0;
528
-	if(_uri!=NULL && (fixup_get_svalue(_m, (gparam_p)_uri, &uri)!=0 || uri.len<=0))
546
+	if(_uri!=NULL && (fixup_get_svalue(_m, (gparam_p)_uri, &uri)!=0
547
+				|| uri.len<=0))
529 548
 	{
530 549
 		LM_ERR("invalid uri parameter\n");
531 550
 		return -1;
... ...
@@ -550,12 +569,14 @@ static int ki_registered_flags(sip_msg_t* _m, str* _dtable, str* _uri, int _f)
550 569
 	return registered3(_m, d, (_uri && _uri->len>0)?_uri:NULL, _f);
551 570
 }
552 571
 
553
-static int w_registered4(struct sip_msg* _m, char* _d, char* _uri, char* _flags, char* _actionflags)
572
+static int w_registered4(struct sip_msg* _m, char* _d, char* _uri,
573
+		char* _flags, char* _actionflags)
554 574
 {
555 575
 	str uri = {0};
556 576
 	int flags = 0;
557 577
 	int actionflags = 0;
558
-	if(_uri!=NULL && (fixup_get_svalue(_m, (gparam_p)_uri, &uri)!=0 || uri.len<=0))
578
+	if(_uri!=NULL && (fixup_get_svalue(_m, (gparam_p)_uri, &uri)!=0
579
+				|| uri.len<=0))
559 580
 	{
560 581
 		LM_ERR("invalid uri parameter\n");
561 582
 		return -1;
... ...
@@ -565,12 +586,14 @@ static int w_registered4(struct sip_msg* _m, char* _d, char* _uri, char* _flags,
565 586
 		LM_ERR("invalid flags parameter\n");
566 587
 		return -1;
567 588
 	}
568
-	if(_actionflags!=NULL && (fixup_get_ivalue(_m, (fparam_t*)_actionflags, &actionflags)) < 0)
589
+	if(_actionflags!=NULL && (fixup_get_ivalue(_m, (fparam_t*)_actionflags,
590
+					&actionflags)) < 0)
569 591
 	{
570 592
 		LM_ERR("invalid action flag parameter\n");
571 593
 		return -1;
572 594
 	}
573
-	return registered4(_m, (udomain_t*)_d, (uri.len>0)?&uri:NULL, flags, actionflags);
595
+	return registered4(_m, (udomain_t*)_d, (uri.len>0)?&uri:NULL, flags,
596
+			actionflags);
574 597
 }
575 598
 
576 599
 static int ki_registered_action(sip_msg_t* _m, str* _dtable, str* _uri,
... ...
@@ -838,20 +861,27 @@ static int w_add_sock_hdr(struct sip_msg* msg, char *name, char *foo)
838 861
 	return ki_add_sock_hdr(msg, &hdr_name);
839 862
 }
840 863
 
841
-void default_expires_stats_update(str* gname, str* name){
842
-	update_stat(default_expire_stat, cfg_get(registrar, registrar_cfg, default_expires));
864
+void default_expires_stats_update(str* gname, str* name)
865
+{
866
+	update_stat(default_expire_stat, cfg_get(registrar, registrar_cfg,
867
+				default_expires));
843 868
 }
844 869
 
845
-void max_expires_stats_update(str* gname, str* name){
846
-	update_stat(max_expires_stat, cfg_get(registrar, registrar_cfg, max_expires));
870
+void max_expires_stats_update(str* gname, str* name)
871
+{
872
+	update_stat(max_expires_stat, cfg_get(registrar, registrar_cfg,
873
+				max_expires));
847 874
 }
848 875
 
849
-void default_expires_range_update(str* gname, str* name){
850
-	update_stat(default_expire_range_stat, cfg_get(registrar, registrar_cfg, default_expires_range));
876
+void default_expires_range_update(str* gname, str* name)
877
+{
878
+	update_stat(default_expire_range_stat, cfg_get(registrar, registrar_cfg,
879
+				default_expires_range));
851 880
 }
852 881
 
853 882
 void expires_range_update(str* gname, str* name){
854
-	update_stat(expire_range_stat, cfg_get(registrar, registrar_cfg, expires_range));
883
+	update_stat(expire_range_stat, cfg_get(registrar, registrar_cfg,
884
+				expires_range));
855 885
 }
856 886
 
857 887
 /**