Bladeren bron

pua_bla: clang-format

* use STR_NULL
Victor Seva 5 jaren geleden
bovenliggende
commit
e542b779b2

+ 153 - 184
src/modules/pua_bla/notify.c

@@ -30,219 +30,188 @@
 #include "../pua/hash.h"
 #include "pua_bla.h"
 
-int bla_handle_notify(struct sip_msg* msg, char* s1, char* s2)
+int bla_handle_notify(struct sip_msg *msg, char *s1, char *s2)
 {
- 	publ_info_t publ;
+	publ_info_t publ;
 	struct to_body *pto = NULL, TO = {0}, *pfrom = NULL;
- 	str body;
- 	ua_pres_t dialog;
- 	unsigned int expires= 0;
-	struct hdr_field* hdr;
+	str body;
+	ua_pres_t dialog;
+	unsigned int expires = 0;
+	struct hdr_field *hdr;
 	str subs_state;
-	int found= 0;
- 	str extra_headers= {0, 0};
- 	static char buf[255];
+	int found = 0;
+	str extra_headers = {0, 0};
+	static char buf[255];
 	str contact;
 
 	memset(&publ, 0, sizeof(publ_info_t));
 	memset(&dialog, 0, sizeof(ua_pres_t));
 
-  	LM_DBG("start\n");
-
-  	if ( parse_headers(msg,HDR_EOH_F, 0)==-1 )
-  	{
-  		LM_ERR("parsing headers\n");
-  		return -1;
-  	}
-
-  	if( msg->to==NULL || msg->to->body.s==NULL)
-  	{
-  		LM_ERR("cannot parse TO header\n");
-  		goto error;
-  	}
-  	/* examine the to header */
-  	if(msg->to->parsed != NULL)
-  	{
-  		pto = (struct to_body*)msg->to->parsed;
-  		LM_DBG("'To' header ALREADY PARSED: <%.*s>\n",
-  				pto->uri.len, pto->uri.s );
-  	}
- 	else
-  	{
-  		parse_to(msg->to->body.s,msg->to->body.s + msg->to->body.len + 1, &TO);
-  		if(TO.uri.len <= 0)
-  		{
-  			LM_DBG("'To' header NOT parsed\n");
-  			goto error;
-  		}
-  		pto = &TO;
-  	}
-  	publ.pres_uri= &pto->uri;
-  	dialog.watcher_uri= publ.pres_uri;
-
-  	if (pto->tag_value.s==NULL || pto->tag_value.len==0 )
-  	{
-  		LM_ERR("NULL to_tag value\n");
+	LM_DBG("start\n");
+
+	if(parse_headers(msg, HDR_EOH_F, 0) == -1) {
+		LM_ERR("parsing headers\n");
+		return -1;
+	}
+
+	if(msg->to == NULL || msg->to->body.s == NULL) {
+		LM_ERR("cannot parse TO header\n");
+		goto error;
+	}
+	/* examine the to header */
+	if(msg->to->parsed != NULL) {
+		pto = (struct to_body *)msg->to->parsed;
+		LM_DBG("'To' header ALREADY PARSED: <%.*s>\n", pto->uri.len,
+				pto->uri.s);
+	} else {
+		parse_to(msg->to->body.s, msg->to->body.s + msg->to->body.len + 1, &TO);
+		if(TO.uri.len <= 0) {
+			LM_DBG("'To' header NOT parsed\n");
+			goto error;
+		}
+		pto = &TO;
+	}
+	publ.pres_uri = &pto->uri;
+	dialog.watcher_uri = publ.pres_uri;
+
+	if(pto->tag_value.s == NULL || pto->tag_value.len == 0) {
+		LM_ERR("NULL to_tag value\n");
+		goto error;
+	}
+	dialog.from_tag = pto->tag_value;
+
+	if(msg->callid == NULL || msg->callid->body.s == NULL) {
+		LM_ERR("cannot parse callid header\n");
+		goto error;
+	}
+	dialog.call_id = msg->callid->body;
+
+	if(!msg->from || !msg->from->body.s) {
+		LM_ERR("cannot find 'from' header!\n");
+		goto error;
+	}
+	if(msg->from->parsed == NULL) {
+		LM_DBG(" 'From' header not parsed\n");
+		/* parsing from header */
+		if(parse_from_header(msg) < 0) {
+			LM_DBG(" ERROR cannot parse From header\n");
+			goto error;
+		}
+	}
+	pfrom = (struct to_body *)msg->from->parsed;
+	dialog.pres_uri = &pfrom->uri;
+
+	if(pfrom->tag_value.s == NULL || pfrom->tag_value.len == 0) {
+		LM_ERR("no from tag value present\n");
 		goto error;
-  	}
-  	dialog.from_tag= pto->tag_value;
-
-  	if( msg->callid==NULL || msg->callid->body.s==NULL)
- 	{
-  		LM_ERR("cannot parse callid header\n");
-  		goto error;
-  	}
-  	dialog.call_id = msg->callid->body;
-
-  	if (!msg->from || !msg->from->body.s)
-  	{
-  		LM_ERR("cannot find 'from' header!\n");
-  		goto error;
-  	}
-  	if (msg->from->parsed == NULL)
-  	{
-  		LM_DBG(" 'From' header not parsed\n");
-  		/* parsing from header */
-  		if ( parse_from_header( msg )<0 )
-  		{
-  			LM_DBG(" ERROR cannot parse From header\n");
-  			goto error;
-  		}
- 	}
- 	pfrom = (struct to_body*)msg->from->parsed;
- 	dialog.pres_uri= &pfrom->uri;
-
- 	if( pfrom->tag_value.s ==NULL || pfrom->tag_value.len == 0)
- 	{
- 		LM_ERR("no from tag value present\n");
- 		goto error;
- 	}
-
- 	dialog.to_tag= pfrom->tag_value;
- 	dialog.event= BLA_EVENT;
- 	dialog.flag= BLA_SUBSCRIBE;
- 	if(pua_is_dialog(&dialog)< 0)
- 	{
- 		LM_ERR("Notify in a non existing dialog\n");
- 		goto error;
- 	}
- 	LM_DBG("found a matching dialog\n");
-
- 	/* parse Subscription-State and extract expires if existing */
+	}
+
+	dialog.to_tag = pfrom->tag_value;
+	dialog.event = BLA_EVENT;
+	dialog.flag = BLA_SUBSCRIBE;
+	if(pua_is_dialog(&dialog) < 0) {
+		LM_ERR("Notify in a non existing dialog\n");
+		goto error;
+	}
+	LM_DBG("found a matching dialog\n");
+
+	/* parse Subscription-State and extract expires if existing */
 	hdr = msg->headers;
-	while (hdr!= NULL)
-	{
- 		if(cmp_hdrname_strzn(&hdr->name, "Subscription-State",18)==0)
- 		{
- 			found = 1;
- 			break;
- 		}
+	while(hdr != NULL) {
+		if(cmp_hdrname_strzn(&hdr->name, "Subscription-State", 18) == 0) {
+			found = 1;
+			break;
+		}
 		hdr = hdr->next;
-  	}
-	if(found==0 )
-	{
+	}
+	if(found == 0) {
 		LM_ERR("No Subscription-State header found\n");
 		goto error;
- 	}
- 	subs_state= hdr->body;
-	if(strncmp(subs_state.s, "terminated", 10)== 0)
- 		expires= 0;
- 	else
- 		if(strncmp(subs_state.s, "active", 6)== 0 ||
-				strncmp(subs_state.s, "pending", 7)==0 )
- 		{
-   			char* sep= NULL;
-   			str exp= {0, 0};
-  			sep= strchr(subs_state.s, ';');
-   			if(sep== NULL)
-   			{
-   				LM_ERR("No expires found in Notify\n");
-   				goto error;
-   			}
-   			if(strncmp(sep+1, "expires=", 8)!= 0)
-   			{
-   				LM_ERR("No expires found in Notify\n");
-   				goto error;
-   			}
-   			exp.s= sep+ 9;
-   			sep= exp.s;
-   			while((*sep)>='0' && (*sep)<='9')
-   			{
-   				sep++;
-   				exp.len++;
-   			}
-   			if( str2int(&exp, &expires)< 0)
-   			{
-   				LM_ERR("while parsing int\n");
-   				goto error;
-   			}
-   		}
-
-   	if ( get_content_length(msg) == 0 )
-   	{
-   		LM_ERR("content length= 0\n");
-   		goto error;
-   	}
-   	else
-   	{
-   		body.s=get_body(msg);
-   		if (body.s== NULL)
-   		{
-   			LM_ERR("cannot extract body from msg\n");
-   			goto error;
-   		}
-   		body.len = get_content_length( msg );
-   	}
-
-	if(msg->contact== NULL || msg->contact->body.s== NULL)
-	{
+	}
+	subs_state = hdr->body;
+	if(strncmp(subs_state.s, "terminated", 10) == 0)
+		expires = 0;
+	else if(strncmp(subs_state.s, "active", 6) == 0
+			|| strncmp(subs_state.s, "pending", 7) == 0) {
+		char *sep = NULL;
+		str exp = {0, 0};
+		sep = strchr(subs_state.s, ';');
+		if(sep == NULL) {
+			LM_ERR("No expires found in Notify\n");
+			goto error;
+		}
+		if(strncmp(sep + 1, "expires=", 8) != 0) {
+			LM_ERR("No expires found in Notify\n");
+			goto error;
+		}
+		exp.s = sep + 9;
+		sep = exp.s;
+		while((*sep) >= '0' && (*sep) <= '9') {
+			sep++;
+			exp.len++;
+		}
+		if(str2int(&exp, &expires) < 0) {
+			LM_ERR("while parsing int\n");
+			goto error;
+		}
+	}
+
+	if(get_content_length(msg) == 0) {
+		LM_ERR("content length= 0\n");
+		goto error;
+	} else {
+		body.s = get_body(msg);
+		if(body.s == NULL) {
+			LM_ERR("cannot extract body from msg\n");
+			goto error;
+		}
+		body.len = get_content_length(msg);
+	}
+
+	if(msg->contact == NULL || msg->contact->body.s == NULL) {
 		LM_ERR("no contact header found");
 		goto error;
 	}
-	if( parse_contact(msg->contact) <0 )
-	{
+	if(parse_contact(msg->contact) < 0) {
 		LM_ERR(" cannot parse contact header\n");
 		goto error;
 	}
 
-	if(msg->contact->parsed == NULL)
-	{
+	if(msg->contact->parsed == NULL) {
 		LM_ERR("cannot parse contact header\n");
 		goto error;
 	}
-	contact = ((contact_body_t* )msg->contact->parsed)->contacts->uri;
+	contact = ((contact_body_t *)msg->contact->parsed)->contacts->uri;
 
 	/* build extra_headers with Sender*/
-   	extra_headers.s= buf;
-   	memcpy(extra_headers.s, header_name.s, header_name.len);
-   	extra_headers.len= header_name.len;
-   	memcpy(extra_headers.s+extra_headers.len,": ",2);
-   	extra_headers.len+= 2;
-   	memcpy(extra_headers.s+ extra_headers.len, contact.s, contact.len);
-   	extra_headers.len+= contact.len;
-   	memcpy(extra_headers.s+ extra_headers.len, CRLF, CRLF_LEN);
-   	extra_headers.len+= CRLF_LEN;
-
-   	publ.body= &body;
-   	publ.source_flag= BLA_PUBLISH;
-   	publ.expires= expires;
-   	publ.event= BLA_EVENT;
-   	publ.extra_headers= &extra_headers;
-
-   	if(pua_send_publish(&publ)< 0)
-   	{
-   		LM_ERR("while sending Publish\n");
-   		goto error;
-   	}
-
-   	xmlCleanupParser();
-   	xmlMemoryDump();
+	extra_headers.s = buf;
+	memcpy(extra_headers.s, header_name.s, header_name.len);
+	extra_headers.len = header_name.len;
+	memcpy(extra_headers.s + extra_headers.len, ": ", 2);
+	extra_headers.len += 2;
+	memcpy(extra_headers.s + extra_headers.len, contact.s, contact.len);
+	extra_headers.len += contact.len;
+	memcpy(extra_headers.s + extra_headers.len, CRLF, CRLF_LEN);
+	extra_headers.len += CRLF_LEN;
+
+	publ.body = &body;
+	publ.source_flag = BLA_PUBLISH;
+	publ.expires = expires;
+	publ.event = BLA_EVENT;
+	publ.extra_headers = &extra_headers;
+
+	if(pua_send_publish(&publ) < 0) {
+		LM_ERR("while sending Publish\n");
+		goto error;
+	}
+
+	xmlCleanupParser();
+	xmlMemoryDump();
 
 	free_to_params(&TO);
 	return 1;
 
 error:
 	free_to_params(&TO);
-   	return 0;
+	return 0;
 }
-

+ 63 - 81
src/modules/pua_bla/pua_bla.c

@@ -32,50 +32,53 @@
 #include "registrar_cb.h"
 
 MODULE_VERSION
+
 /* Structure containing pointers to pua functions */
 pua_api_t pua;
 /* Structure containing pointers to usrloc functions */
 usrloc_api_t ul;
-str default_domain= {NULL, 0};
-str header_name= {0, 0};
-str bla_outbound_proxy= {0, 0};
-int is_bla_aor= 0;
-str reg_from_uri= {0, 0};
+str default_domain = STR_NULL;
+str header_name = STR_NULL;
+str bla_outbound_proxy = STR_NULL;
+int is_bla_aor = 0;
+str reg_from_uri = STR_NULL;
 static int mod_init(void);
 
 send_publish_t pua_send_publish;
 send_subscribe_t pua_send_subscribe;
 query_dialog_t pua_is_dialog;
-int bla_set_flag(struct sip_msg* , char*, char*);
-str server_address= {0, 0};
-static cmd_export_t cmds[]=
-{
-	{"bla_set_flag", (cmd_function)bla_set_flag,		 0, 0, 0, REQUEST_ROUTE},
-	{"bla_handle_notify", (cmd_function)bla_handle_notify,   0, 0, 0, REQUEST_ROUTE},
+int bla_set_flag(struct sip_msg *, char *, char *);
+str server_address = STR_NULL;
+
+/* clang-format off */
+static cmd_export_t cmds[] = {
+	{"bla_set_flag", (cmd_function)bla_set_flag, 0, 0, 0, REQUEST_ROUTE},
+	{"bla_handle_notify", (cmd_function)bla_handle_notify, 0, 0, 0, REQUEST_ROUTE},
 	{0, 0, 0, 0, 0, 0}
 };
-static param_export_t params[]=
-{
-	{"server_address",	 PARAM_STR, &server_address	 },
-	{"default_domain",	 PARAM_STR, &default_domain	 },
-	{"header_name",      PARAM_STR, &header_name       },
-	{"outbound_proxy",   PARAM_STR, &bla_outbound_proxy    },
-	{0,							 0,			0            }
+
+static param_export_t params[] = {
+	{"server_address",	PARAM_STR, &server_address},
+	{"default_domain",	PARAM_STR, &default_domain},
+	{"header_name",		PARAM_STR, &header_name},
+	{"outbound_proxy",	PARAM_STR, &bla_outbound_proxy},
+	{0, 0, 0}
 };
 
 /** module exports */
-struct module_exports exports= {
-	"pua_bla",			/* module name */
-	DEFAULT_DLFLAGS,	/* dlopen flags */
-	cmds,				/* exported functions */
-	params,				/* exported parameters */
-	0,					/* RPC method exports */
-	0,					/* exported pseudo-variables */
-	0,					/* response handling function */
-	mod_init,			/* module initialization function */
-	0,					/* per-child init function */
-	0					/* module destroy function */
+struct module_exports exports = {
+	"pua_bla",		 /* module name */
+	DEFAULT_DLFLAGS, /* dlopen flags */
+	cmds,			 /* exported functions */
+	params,			 /* exported parameters */
+	0,				 /* RPC method exports */
+	0,				 /* exported pseudo-variables */
+	0,				 /* response handling function */
+	mod_init,		 /* module initialization function */
+	0,				 /* per-child init function */
+	0				 /* module destroy function */
 };
+/* clang-format on */
 
 /**
  * init module function
@@ -85,107 +88,90 @@ static int mod_init(void)
 	bind_pua_t bind_pua;
 	bind_usrloc_t bind_usrloc;
 
-	if(!server_address.s || server_address.len<=0)
-	{
+	if(!server_address.s || server_address.len <= 0) {
 		LM_ERR("compulsory 'server_address' parameter not set!");
 		return -1;
 	}
 
-	if(!default_domain.s || default_domain.len<=0)
-	{
+	if(!default_domain.s || default_domain.len <= 0) {
 		LM_ERR("default domain not found\n");
 		return -1;
 	}
 
-	if(!header_name.s || header_name.len<=0)
-	{
+	if(!header_name.s || header_name.len <= 0) {
 		LM_ERR("header_name parameter not set\n");
 		return -1;
 	}
 
-	if(!bla_outbound_proxy.s || bla_outbound_proxy.len<=0)
-	{
+	if(!bla_outbound_proxy.s || bla_outbound_proxy.len <= 0) {
 		LM_DBG("No outbound proxy set\n");
 	}
 
-	bind_pua= (bind_pua_t)find_export("bind_pua", 1,0);
-	if (!bind_pua)
-	{
+	bind_pua = (bind_pua_t)find_export("bind_pua", 1, 0);
+	if(!bind_pua) {
 		LM_ERR("Can't bind pua\n");
 		return -1;
 	}
 
-	if (bind_pua(&pua) < 0)
-	{
+	if(bind_pua(&pua) < 0) {
 		LM_ERR("Can't bind pua\n");
 		return -1;
 	}
-	if(pua.send_publish == NULL)
-	{
+	if(pua.send_publish == NULL) {
 		LM_ERR("Could not import send_publish\n");
 		return -1;
 	}
-	pua_send_publish= pua.send_publish;
+	pua_send_publish = pua.send_publish;
 
-	if(pua.send_subscribe == NULL)
-	{
+	if(pua.send_subscribe == NULL) {
 		LM_ERR("Could not import send_subscribe\n");
 		return -1;
 	}
-	pua_send_subscribe= pua.send_subscribe;
+	pua_send_subscribe = pua.send_subscribe;
 
-	if(pua.is_dialog == NULL)
-	{
+	if(pua.is_dialog == NULL) {
 		LM_ERR("Could not import send_subscribe\n");
 		return -1;
 	}
-	pua_is_dialog= pua.is_dialog;
+	pua_is_dialog = pua.is_dialog;
 
-	if(pua.register_puacb== NULL)
-	{
+	if(pua.register_puacb == NULL) {
 		LM_ERR("Could not import register callback\n");
 		return -1;
 	}
 
 	bind_usrloc = (bind_usrloc_t)find_export("ul_bind_usrloc", 1, 0);
-	if (!bind_usrloc)
-	{
+	if(!bind_usrloc) {
 		LM_ERR("Can't bind usrloc\n");
 		return -1;
 	}
-	if (bind_usrloc(&ul) < 0)
-	{
+	if(bind_usrloc(&ul) < 0) {
 		LM_ERR("Can't bind usrloc\n");
 		return -1;
 	}
-	if(ul.register_ulcb == NULL)
-	{
+	if(ul.register_ulcb == NULL) {
 		LM_ERR("Could not import ul_register_ulcb\n");
 		return -1;
 	}
 
-	if(ul.register_ulcb(UL_CONTACT_INSERT, bla_cb , 0)< 0)
-	{
+	if(ul.register_ulcb(UL_CONTACT_INSERT, bla_cb, 0) < 0) {
 		LM_ERR("can not register callback for"
-				" insert\n");
+			   " insert\n");
 		return -1;
 	}
-	if(ul.register_ulcb(UL_CONTACT_EXPIRE, bla_cb, 0)< 0)
-	{
+	if(ul.register_ulcb(UL_CONTACT_EXPIRE, bla_cb, 0) < 0) {
 		LM_ERR("can not register callback for"
-				" insert\n");
+			   " insert\n");
 		return -1;
 	}
-	if(ul.register_ulcb(UL_CONTACT_UPDATE, bla_cb, 0)< 0)
-	{
+	if(ul.register_ulcb(UL_CONTACT_UPDATE, bla_cb, 0) < 0) {
 		LM_ERR("can not register callback for"
-				" update\n");
+			   " update\n");
 		return -1;
 	}
-	if(ul.register_ulcb(UL_CONTACT_DELETE, bla_cb, 0)< 0)
-	{
+	if(ul.register_ulcb(UL_CONTACT_DELETE, bla_cb, 0) < 0) {
 		LM_ERR("can not register callback for"
-				" delete\n");
+			   " delete\n");
 		return -1;
 	}
 
@@ -193,30 +179,26 @@ static int mod_init(void)
 }
 
 
-int bla_set_flag(struct sip_msg* msg , char* s1, char* s2)
+int bla_set_flag(struct sip_msg *msg, char *s1, char *s2)
 {
 	LM_DBG("mark as bla aor\n");
 
-	is_bla_aor= 1;
+	is_bla_aor = 1;
 
-	if( parse_headers(msg,HDR_EOH_F, 0)==-1 )
-	{
+	if(parse_headers(msg, HDR_EOH_F, 0) == -1) {
 		LM_ERR("parsing headers\n");
 		return -1;
 	}
 
 
-	if (msg->from->parsed == NULL)
-	{
-		if ( parse_from_header( msg )<0 )
-		{
+	if(msg->from->parsed == NULL) {
+		if(parse_from_header(msg) < 0) {
 			LM_DBG("cannot parse From header\n");
 			return -1;
 		}
 	}
 
-	reg_from_uri= ((struct to_body*)(msg->from->parsed))->uri;
+	reg_from_uri = ((struct to_body *)(msg->from->parsed))->uri;
 
 	return 1;
 }
-

+ 1 - 1
src/modules/pua_bla/pua_bla.h

@@ -34,6 +34,6 @@ extern str reg_from_uri;
 extern send_publish_t pua_send_publish;
 extern send_subscribe_t pua_send_subscribe;
 extern query_dialog_t pua_is_dialog;
-extern int bla_handle_notify(struct sip_msg* msg, char* s1, char* s2);
+extern int bla_handle_notify(struct sip_msg *msg, char *s1, char *s2);
 
 #endif

+ 33 - 39
src/modules/pua_bla/registrar_cb.c

@@ -29,36 +29,33 @@
 #include "pua_bla.h"
 
 
-void bla_cb(ucontact_t* c, int type, void* param)
+void bla_cb(ucontact_t *c, int type, void *param)
 {
 	subs_info_t subs;
-	str uri={0, 0};
-	char* at;
+	str uri = STR_NULL;
+	char *at;
 	LM_DBG("start\n");
-	if(is_bla_aor== 0)
-	{
+	if(is_bla_aor == 0) {
 		LM_DBG("Not a recognized BLA AOR\n");
-		return ;
+		return;
 	}
 
 	if(type & UL_CONTACT_INSERT)
 		LM_DBG("type= UL_CONTACT_INSERT\n");
-	else
-	if(type & UL_CONTACT_UPDATE)
+	else if(type & UL_CONTACT_UPDATE)
 		LM_DBG("type= UL_CONTACT_UPDATE\n");
-	else
-	if(type & UL_CONTACT_EXPIRE)
+	else if(type & UL_CONTACT_EXPIRE)
 		LM_DBG("type= UL_CONTACT_EXPIRE\n");
-	else
-	if(type & UL_CONTACT_DELETE)
+	else if(type & UL_CONTACT_DELETE)
 		LM_DBG("type= UL_CONTACT_DELETE\n");
 
 	memset(&subs, 0, sizeof(subs_info_t));
-	subs.remote_target= &c->c;
+	subs.remote_target = &c->c;
 
-	subs.pres_uri= &reg_from_uri;
+	subs.pres_uri = &reg_from_uri;
 
-	uri.s = (char*)pkg_malloc(sizeof(char)*(c->aor->len+default_domain.len+6));
+	uri.s = (char *)pkg_malloc(
+			sizeof(char) * (c->aor->len + default_domain.len + 6));
 	if(uri.s == NULL) {
 		PKG_MEM_ERROR;
 		goto error;
@@ -67,44 +64,41 @@ void bla_cb(ucontact_t* c, int type, void* param)
 	memcpy(uri.s, "sip:", 4);
 	uri.len = 4;
 
-	memcpy(uri.s+ uri.len, c->aor->s, c->aor->len);
-	uri.len+= c->aor->len;
+	memcpy(uri.s + uri.len, c->aor->s, c->aor->len);
+	uri.len += c->aor->len;
 	at = memchr(c->aor->s, '@', c->aor->len);
-	if(!at)
-	{
-		uri.s[uri.len++]= '@';
-		memcpy(uri.s+ uri.len, default_domain.s, default_domain.len);
-		uri.len+= default_domain.len;
+	if(!at) {
+		uri.s[uri.len++] = '@';
+		memcpy(uri.s + uri.len, default_domain.s, default_domain.len);
+		uri.len += default_domain.len;
 	}
 
-	subs.watcher_uri= &uri;
-	if(type & UL_CONTACT_DELETE || type & UL_CONTACT_EXPIRE )
-		subs.expires= 0;
+	subs.watcher_uri = &uri;
+	if(type & UL_CONTACT_DELETE || type & UL_CONTACT_EXPIRE)
+		subs.expires = 0;
 	else
-		subs.expires= c->expires - (int)time(NULL);
+		subs.expires = c->expires - (int)time(NULL);
 
 
-	subs.source_flag= BLA_SUBSCRIBE;
-	subs.event= BLA_EVENT;
-	subs.contact= &server_address;
+	subs.source_flag = BLA_SUBSCRIBE;
+	subs.event = BLA_EVENT;
+	subs.contact = &server_address;
 
 	if(bla_outbound_proxy.s && bla_outbound_proxy.len)
-		subs.outbound_proxy= &bla_outbound_proxy;
-	else
-	if(c->received.s && c->received.len)
-		subs.outbound_proxy= &c->received;
+		subs.outbound_proxy = &bla_outbound_proxy;
+	else if(c->received.s && c->received.len)
+		subs.outbound_proxy = &c->received;
 
 	if(type & UL_CONTACT_INSERT)
-		subs.flag|= INSERT_TYPE;
+		subs.flag |= INSERT_TYPE;
 	else
-		subs.flag|= UPDATE_TYPE;
+		subs.flag |= UPDATE_TYPE;
 
-	if(pua_send_subscribe(&subs)< 0)
-	{
+	if(pua_send_subscribe(&subs) < 0) {
 		LM_ERR("while sending subscribe\n");
 	}
 	pkg_free(uri.s);
 error:
-	is_bla_aor= 0;
-	return ;
+	is_bla_aor = 0;
+	return;
 }

+ 1 - 1
src/modules/pua_bla/registrar_cb.h

@@ -26,4 +26,4 @@
 #include "../../core/dprint.h"
 #include "../usrloc/usrloc.h"
 
-void bla_cb(ucontact_t* c, int type, void* param);
+void bla_cb(ucontact_t *c, int type, void *param);