Переглянути джерело

tmx: coherent indentation and whitespacing

Daniel-Constantin Mierla 9 роки тому
батько
коміт
21af57b567

+ 36 - 36
modules/tmx/t_mi.c

@@ -16,8 +16,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
@@ -58,7 +58,7 @@ static inline int uri2su(str *uri, union sockaddr_union *to_su, int proto)
 		return -1;
 	}
 
-	hostent2su(to_su, &proxy->host, proxy->addr_idx, 
+	hostent2su(to_su, &proxy->host, proxy->addr_idx,
 		(proxy->port) ? proxy->port : SIP_PORT);
 	proto = proxy->proto;
 
@@ -173,14 +173,14 @@ static inline char *get_hfblock( str *uri, struct hdr_field *hf, int *l, struct
 	for (; hf; hf=hf->next) {
 		if (tm_skip_hf(hf)) continue;
 
-		begin=needle=hf->name.s; 
+		begin=needle=hf->name.s;
 		hf_avail=hf->len;
 
 		/* substitution loop */
 		while(hf_avail) {
 			d=memchr(needle, SUBST_CHAR, hf_avail);
 			if (!d || d+1>=needle+hf_avail) { /* nothing to substitute */
-				new=append_str_list(begin, hf_avail, &last, &total_len); 
+				new=append_str_list(begin, hf_avail, &last, &total_len);
 				if (!new) goto error;
 				break;
 			} else {
@@ -189,7 +189,7 @@ static inline char *get_hfblock( str *uri, struct hdr_field *hf, int *l, struct
 				switch(*d) {
 					case SUBST_CHAR:	/* double SUBST_CHAR: IP */
 						/* string before substitute */
-						new=append_str_list(begin, frag_len, &last, &total_len); 
+						new=append_str_list(begin, frag_len, &last, &total_len);
 						if (!new) goto error;
 						/* substitute */
 						if (!sock_name) {
@@ -412,7 +412,7 @@ static void mi_uac_dlg_hdl( struct cell *t, int type, struct tmcb_params *ps )
 		pkg_free(text.s);
 		mi_print_uris( &rpl_tree->node, 0 );
 		add_mi_node_child( &rpl_tree->node, 0, 0, 0, ".",1);
-	} else { 
+	} else {
 		addf_mi_node_child( &rpl_tree->node, 0, 0, 0, "%d %.*s",
 			ps->rpl->first_line.u.reply.statuscode,
 			ps->rpl->first_line.u.reply.reason.len,
@@ -439,13 +439,13 @@ done:
 
 
 /*
-  Syntax of "t_uac_dlg" :
-    method
-    RURI
-    NEXT_HOP
-    socket
-    headers
-    [Body]
+ * Syntax of "t_uac_dlg" :
+ *   method
+ *   RURI
+ *   NEXT_HOP
+ *   socket
+ *   headers
+ *   [Body]
 */
 struct mi_root*  mi_tm_uac_dlg(struct mi_root* cmd_tree, void* param)
 {
@@ -520,7 +520,7 @@ struct mi_root*  mi_tm_uac_dlg(struct mi_root* cmd_tree, void* param)
 		hdrs = &node->value;
 		/* use SIP parser to look at what is in the FIFO request */
 		memset( &tmp_msg, 0, sizeof(struct sip_msg));
-		tmp_msg.len = hdrs->len; 
+		tmp_msg.len = hdrs->len;
 		tmp_msg.buf = tmp_msg.unparsed = hdrs->s;
 		if (parse_headers( &tmp_msg, HDR_EOH_F, 0) == -1 )
 			return init_mi_tree( 400, "Bad headers", 11);
@@ -619,9 +619,9 @@ struct mi_root*  mi_tm_uac_dlg(struct mi_root* cmd_tree, void* param)
 
 
 /*
-  Syntax of "t_uac_cancel" :
-    callid
-    cseq
+ * Syntax of "t_uac_cancel" :
+ *   callid
+ *   cseq
 */
 struct mi_root* mi_tm_cancel(struct mi_root* cmd_tree, void* param)
 {
@@ -650,8 +650,8 @@ struct mi_root* mi_tm_cancel(struct mi_root* cmd_tree, void* param)
 
 
 /*
-  Syntax of "t_hash" :
-    no nodes
+ * Syntax of "t_hash" :
+ *   no nodes
 */
 struct mi_root* mi_tm_hash(struct mi_root* cmd_tree, void* param)
 {
@@ -703,13 +703,13 @@ error:
 
 
 /*
-  Syntax of "t_reply" :
-  code
-  reason
-  trans_id
-  to_tag
-  new headers
-  [Body]
+ * Syntax of "t_reply" :
+ * code
+ * reason
+ * trans_id
+ * to_tag
+ * new headers
+ * [Body]
 */
 struct mi_root* mi_tm_reply(struct mi_root* cmd_tree, void* param)
 {
@@ -774,7 +774,7 @@ struct mi_root* mi_tm_reply(struct mi_root* cmd_tree, void* param)
 	if (node)
 		body = node->value;
 
-	/* it's refcounted now, t_reply_with body unrefs for me -- I can 
+	/* it's refcounted now, t_reply_with body unrefs for me -- I can
 	 * continue but may not use T anymore  */
 	n = _tmx_tmb.t_reply_with_body(trans, rpl_code, &reason, &body,
 			&new_hdrs, &totag);
@@ -786,14 +786,14 @@ struct mi_root* mi_tm_reply(struct mi_root* cmd_tree, void* param)
 }
 
 /*
-  Syntax of "t_reply_callid" :
-  code
-  reason
-  callid
-  cseq
-  to_tag
-  new headers
-  [Body]
+ * Syntax of "t_reply_callid" :
+ * code
+ * reason
+ * callid
+ * cseq
+ * to_tag
+ * new headers
+ * [Body]
 */
 struct mi_root* mi_tm_reply_callid(struct mi_root* cmd_tree, void* param)
 {

+ 2 - 2
modules/tmx/t_mi.h

@@ -15,8 +15,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */

+ 1 - 1
modules/tmx/t_var.c

@@ -556,7 +556,7 @@ int pv_get_tm_reply_reason(struct sip_msg *msg, pv_param_t *param,
 		switch (get_route_type()) {
 			case CORE_ONREPLY_ROUTE:
 				/*  t_check() above has the side effect of setting T and
-					REFerencing T => we must unref and unset it for the 
+					REFerencing T => we must unref and unset it for the
 					main/core onreply_route. */
 				_tmx_tmb.t_unref(msg);
 				/* no break */

+ 2 - 2
modules/tmx/t_var.h

@@ -23,7 +23,7 @@
  * \ingroup tm
  * - Module: \ref tm
  */
-		       
+
 #ifndef _T_VAR_H_
 #define _T_VAR_H_
 
@@ -45,7 +45,7 @@ int pv_get_tm_branch_idx(struct sip_msg *msg, pv_param_t *param,
 int pv_get_tm_reply_ruid(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res);
 int pv_get_t_branch(struct sip_msg *msg,  pv_param_t *param,
-		    pv_value_t *res);
+		pv_value_t *res);
 int pv_get_tm_reply_code(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res);
 int pv_get_tm_reply_reason(struct sip_msg *msg, pv_param_t *param,

+ 39 - 39
modules/tmx/tmx_mod.c

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 /*! \file
@@ -59,12 +59,12 @@ static void destroy(void);
 static int t_cancel_branches(struct sip_msg* msg, char *k, char *s2);
 static int fixup_cancel_branches(void** param, int param_no);
 static int w_t_cancel_callid_3(struct sip_msg* msg, char *cid, char *cseq,
-				char *flag);
+		char *flag);
 static int w_t_cancel_callid_4(struct sip_msg* msg, char *cid, char *cseq,
-				char *flag, char *creason);
+		char *flag, char *creason);
 static int fixup_cancel_callid(void** param, int param_no);
 static int t_reply_callid(struct sip_msg* msg, char *cid, char *cseq,
-				char *rc, char *rs);
+		char *rc, char *rs);
 static int fixup_reply_callid(void** param, int param_no);
 
 static int t_flush_flags(struct sip_msg* msg, char*, char* );
@@ -140,19 +140,19 @@ static stat_export_t mod_stats[] = {
 static pv_export_t mod_pvs[] = {
 	{ {"T_branch_idx", sizeof("T_branch_idx")-1}, PVT_OTHER,
 		pv_get_tm_branch_idx, 0,
-		 0, 0, 0, 0 },
+		0, 0, 0, 0 },
 	{ {"T_reply_ruid", sizeof("T_reply_ruid")-1}, PVT_OTHER,
 		pv_get_tm_reply_ruid, 0,
-		 0, 0, 0, 0 },
+		0, 0, 0, 0 },
 	{ {"T_reply_code", sizeof("T_reply_code")-1}, PVT_OTHER,
 		pv_get_tm_reply_code, 0,
-		 0, 0, 0, 0 },
+		0, 0, 0, 0 },
 	{ {"T_reply_reason", sizeof("T_reply_reason")-1}, PVT_OTHER,
 		pv_get_tm_reply_reason, 0,
-		 0, 0, 0, 0 },
+		0, 0, 0, 0 },
 	{ {"T_reply_last", sizeof("T_reply_last")-1}, PVT_OTHER,
 		pv_get_tm_reply_last_received, 0,
-		 0, 0, 0, 0 },
+		0, 0, 0, 0 },
 	{ {"T_inv", sizeof("T_inv")-1}, PVT_OTHER, pv_get_t_var_inv, 0,
 		pv_parse_t_var_name, 0, 0, 0 },
 	{ {"T_req", sizeof("T_req")-1}, PVT_OTHER, pv_get_t_var_req, 0,
@@ -186,17 +186,17 @@ static cmd_export_t cmds[]={
 	{"t_reply_callid", (cmd_function)t_reply_callid,    4,
 		fixup_reply_callid, 0, ANY_ROUTE },
 	{"t_flush_flags",   (cmd_function)t_flush_flags,    0, 0,
-			0, ANY_ROUTE  },
+		0, ANY_ROUTE  },
 	{"t_is_failure_route",   (cmd_function)t_is_failure_route,   0, 0,
-			0, ANY_ROUTE  },
+		0, ANY_ROUTE  },
 	{"t_is_branch_route",    (cmd_function)t_is_branch_route,    0, 0,
-			0, ANY_ROUTE  },
+		0, ANY_ROUTE  },
 	{"t_is_reply_route",    (cmd_function)t_is_reply_route,    0, 0,
-			0, ANY_ROUTE  },
+		0, ANY_ROUTE  },
 	{"t_is_request_route",    (cmd_function)t_is_request_route,    0, 0,
-			0, ANY_ROUTE  },
+		0, ANY_ROUTE  },
 	{"t_suspend",    (cmd_function)w_t_suspend,    0, 0,
-			0, ANY_ROUTE  },
+		0, ANY_ROUTE  },
 	{"t_continue", (cmd_function)w_t_continue,     3,
 		fixup_t_continue, 0, ANY_ROUTE },
 	{"t_reuse_branch", (cmd_function)w_t_reuse_branch, 0, 0, 0,
@@ -345,7 +345,7 @@ static int t_cancel_branches(struct sip_msg* msg, char *k, char *s2)
 			if(msg->first_line.u.reply.statuscode>=200)
 				break;
 			cancel_data.cancel_bitmap = 1<<idx;
-		break;
+			break;
 		default:
 			if (msg->first_line.u.reply.statuscode>=200)
 				/* prepare cancel for every branch except idx */
@@ -678,30 +678,30 @@ static int w_t_reuse_branch(struct sip_msg* msg, char *p1, char *p2)
 	/* first get the transaction */
 	if (_tmx_tmb.t_check(msg, 0) == -1) return -1;
 	if ((t = _tmx_tmb.t_gett()) == 0) {
-	    LM_ERR("no transaction\n");
-	    return -1;
+		LM_ERR("no transaction\n");
+		return -1;
 	}
 	switch (get_route_type()) {
-	case BRANCH_FAILURE_ROUTE:
-	    /* use the reason of the winning reply */
-	    if ((branch = _tmx_tmb.t_get_picked_branch()) < 0) {
-		LM_CRIT("no picked branch (%d) for a final response"
-			" in MODE_ONFAILURE\n", branch);
-		return -1;
-	    }
-	    rewrite_uri(msg, &(t->uac[branch].uri));
-	    set_ruid(msg, &(t->uac[branch].ruid));
-	    if (t->uac[branch].path.len) {
-		set_path_vector(msg, &(t->uac[branch].path));
-	    } else {
-		reset_path_vector(msg);
-	    }
-	    setbflagsval(0, t->uac[branch].branch_flags);
-	    set_instance(msg, &(t->uac[branch].instance));
-	    return 1;
-	default:
-	    LM_ERR("unsupported route_type %d\n", get_route_type());
-	    return -1;
+		case BRANCH_FAILURE_ROUTE:
+			/* use the reason of the winning reply */
+			if ((branch = _tmx_tmb.t_get_picked_branch()) < 0) {
+				LM_CRIT("no picked branch (%d) for a final response"
+						" in MODE_ONFAILURE\n", branch);
+				return -1;
+			}
+			rewrite_uri(msg, &(t->uac[branch].uri));
+			set_ruid(msg, &(t->uac[branch].ruid));
+			if (t->uac[branch].path.len) {
+				set_path_vector(msg, &(t->uac[branch].path));
+			} else {
+				reset_path_vector(msg);
+			}
+			setbflagsval(0, t->uac[branch].branch_flags);
+			set_instance(msg, &(t->uac[branch].instance));
+			return 1;
+		default:
+			LM_ERR("unsupported route_type %d\n", get_route_type());
+			return -1;
 	}
 }
 

+ 2 - 2
modules/tmx/tmx_mod.h

@@ -13,8 +13,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 

+ 21 - 21
modules/tmx/tmx_pretran.c

@@ -81,11 +81,11 @@ int tmx_init_pretran_table(void)
 		return -1;
 	/* get the highest power of two less than number of processes */
 	n = -1;
-    while (pn >> ++n > 0);
-    n--;
-    if(n<=1) n = 2;
-    if(n>8) n = 8;
-     _tmx_ptran_size = 1<<n;
+	while (pn >> ++n > 0);
+	n--;
+	if(n<=1) n = 2;
+	if(n>8) n = 8;
+	_tmx_ptran_size = 1<<n;
 
 	_tmx_ptran_table = (pretran_slot_t*)shm_malloc(_tmx_ptran_size*sizeof(pretran_slot_t));
 	if(_tmx_ptran_table == NULL) {
@@ -148,7 +148,7 @@ void tmx_pretran_unlink_safe(int slotid)
 	if(_tmx_proc_ptran->prev==NULL) {
 		_tmx_ptran_table[slotid].plist = _tmx_proc_ptran->next;
 		if(_tmx_ptran_table[slotid].plist!=NULL)
-				_tmx_ptran_table[slotid].plist->prev = NULL;
+			_tmx_ptran_table[slotid].plist->prev = NULL;
 	} else {
 		_tmx_proc_ptran->prev->next = _tmx_proc_ptran->next;
 		if(_tmx_proc_ptran->next)
@@ -169,7 +169,7 @@ void tmx_pretran_unlink(void)
 	if(_tmx_proc_ptran==NULL)
 		return;
 
-	slotid = _tmx_proc_ptran->hid & (_tmx_ptran_size-1);	
+	slotid = _tmx_proc_ptran->hid & (_tmx_ptran_size-1);
 	lock_get(&_tmx_ptran_table[slotid].lock);
 	tmx_pretran_unlink_safe(slotid);
 	lock_release(&_tmx_ptran_table[slotid].lock);
@@ -256,7 +256,7 @@ int tmx_check_pretran(sip_msg_t *msg)
 		_tmx_proc_ptran->pid = my_pid();
 	}
 	dsize = scallid.len + scseqnum.len + scseqmet.len
-			+ sftag.len + 4;
+		+ sftag.len + 4;
 	if(likely(vbr!=NULL)) {
 		svbranch = vbr->value;
 		trim(&svbranch);
@@ -284,26 +284,26 @@ int tmx_check_pretran(sip_msg_t *msg)
 	_tmx_proc_ptran->callid.s[_tmx_proc_ptran->callid.len] = '\0';
 
 	_tmx_proc_ptran->ftag.s = _tmx_proc_ptran->callid.s
-			+ _tmx_proc_ptran->callid.len + 1;
+		+ _tmx_proc_ptran->callid.len + 1;
 	memcpy(_tmx_proc_ptran->ftag.s, sftag.s, sftag.len);
 	_tmx_proc_ptran->ftag.len = sftag.len;
 	_tmx_proc_ptran->ftag.s[_tmx_proc_ptran->ftag.len] = '\0';
 
 	_tmx_proc_ptran->cseqnum.s = _tmx_proc_ptran->ftag.s
-			+ _tmx_proc_ptran->ftag.len + 1;
+		+ _tmx_proc_ptran->ftag.len + 1;
 	memcpy(_tmx_proc_ptran->cseqnum.s, scseqnum.s, scseqnum.len);
 	_tmx_proc_ptran->cseqnum.len = scseqnum.len;
 	_tmx_proc_ptran->cseqnum.s[_tmx_proc_ptran->cseqnum.len] = '\0';
 
 	_tmx_proc_ptran->cseqmet.s = _tmx_proc_ptran->cseqnum.s
-			+ _tmx_proc_ptran->cseqnum.len + 1;
+		+ _tmx_proc_ptran->cseqnum.len + 1;
 	memcpy(_tmx_proc_ptran->cseqmet.s, scseqmet.s, scseqmet.len);
 	_tmx_proc_ptran->cseqmet.len = scseqmet.len;
 	_tmx_proc_ptran->cseqmet.s[_tmx_proc_ptran->cseqmet.len] = '\0';
 
 	if(likely(vbr!=NULL)) {
 		_tmx_proc_ptran->vbranch.s = _tmx_proc_ptran->cseqmet.s
-				+ _tmx_proc_ptran->cseqmet.len + 1;
+			+ _tmx_proc_ptran->cseqmet.len + 1;
 		memcpy(_tmx_proc_ptran->vbranch.s, svbranch.s, svbranch.len);
 		_tmx_proc_ptran->vbranch.len = svbranch.len;
 		_tmx_proc_ptran->vbranch.s[_tmx_proc_ptran->vbranch.len] = '\0';
@@ -336,22 +336,22 @@ int tmx_check_pretran(sip_msg_t *msg)
 						it->vbranch.s, it->vbranch.len)!=0)
 				continue;
 			/* shall stop by matching magic cookie?
-			if (vbr && vbr->value.s && vbr->value.len > MCOOKIE_LEN
-					&& memcmp(vbr->value.s, MCOOKIE, MCOOKIE_LEN)==0) {
-				LM_DBG("rfc3261 cookie found in Via branch\n");
-			}
-			*/
+			 *  if (vbr && vbr->value.s && vbr->value.len > MCOOKIE_LEN
+			 *  && memcmp(vbr->value.s, MCOOKIE, MCOOKIE_LEN)==0) {
+			 *  LM_DBG("rfc3261 cookie found in Via branch\n");
+			 *  }
+			 */
 		}
 		if(memcmp(_tmx_proc_ptran->callid.s,
-						it->callid.s, it->callid.len)!=0
+					it->callid.s, it->callid.len)!=0
 				|| memcmp(_tmx_proc_ptran->ftag.s,
-						it->ftag.s, it->ftag.len)!=0
+					it->ftag.s, it->ftag.len)!=0
 				|| memcmp(_tmx_proc_ptran->cseqnum.s,
-						it->cseqnum.s, it->cseqnum.len)!=0)
+					it->cseqnum.s, it->cseqnum.len)!=0)
 			continue;
 		if((it->cseqmetid==METHOD_OTHER || it->cseqmetid==METHOD_UNDEF)
 				&& memcmp(_tmx_proc_ptran->cseqmet.s,
-						it->cseqmet.s, it->cseqmet.len)!=0)
+					it->cseqmet.s, it->cseqmet.len)!=0)
 			continue;
 		LM_DBG("matched another pre-transaction by pid %d for [%.*s]\n",
 				it->pid, it->callid.len, it->callid.s);

+ 1 - 1
modules/tmx/tmx_pretran.h

@@ -23,7 +23,7 @@
  * \ingroup tm
  * - Module: \ref tm
  */
-		       
+
 #ifndef _TMX_PRETRANS_H_
 #define _TMX_PRETRANS_H_