浏览代码

rtpproxy: removed svn id, history and fixed indentation

Daniel-Constantin Mierla 9 年之前
父节点
当前提交
6fbf225f6a

+ 32 - 17
modules/rtpproxy/rtpproxy.c

@@ -774,7 +774,8 @@ mod_init(void)
 	if (nortpproxy_str.s==NULL || nortpproxy_str.len<=0) {
 		nortpproxy_str.len = 0;
 	} else {
-		while (nortpproxy_str.len > 0 && (nortpproxy_str.s[nortpproxy_str.len - 1] == '\r' ||
+		while (nortpproxy_str.len > 0
+				&& (nortpproxy_str.s[nortpproxy_str.len - 1] == '\r' ||
 					nortpproxy_str.s[nortpproxy_str.len - 1] == '\n'))
 			nortpproxy_str.len--;
 	}
@@ -806,11 +807,14 @@ mod_init(void)
 	if (ice_candidate_priority_avp_param) {
 		s.s = ice_candidate_priority_avp_param; s.len = strlen(s.s);
 		if (pv_parse_spec(&s, &avp_spec) == 0 || avp_spec.type != PVT_AVP) {
-			LM_ERR("malformed or non AVP definition <%s>\n", ice_candidate_priority_avp_param);
+			LM_ERR("malformed or non AVP definition <%s>\n",
+					ice_candidate_priority_avp_param);
 			return -1;
 		}
-		if (pv_get_avp_name(0, &(avp_spec.pvp), &ice_candidate_priority_avp, &avp_flags) != 0) {
-			LM_ERR("invalid AVP definition <%s>\n", ice_candidate_priority_avp_param);
+		if (pv_get_avp_name(0, &(avp_spec.pvp), &ice_candidate_priority_avp,
+					&avp_flags) != 0) {
+			LM_ERR("invalid AVP definition <%s>\n",
+					ice_candidate_priority_avp_param);
 			return -1;
 		}
 		ice_candidate_priority_avp_type = avp_flags;
@@ -820,9 +824,10 @@ mod_init(void)
 		rtp_inst_pvar = pv_cache_get(&rtp_inst_pv_param);
 		if ((rtp_inst_pvar == NULL) ||
 				((rtp_inst_pvar->type != PVT_AVP) &&
-				(rtp_inst_pvar->type != PVT_XAVP) &&
-				(rtp_inst_pvar->type != PVT_SCRIPTVAR))) {
-			LM_ERR("Invalid pvar name <%.*s>\n", rtp_inst_pv_param.len, rtp_inst_pv_param.s);
+					(rtp_inst_pvar->type != PVT_XAVP) &&
+					(rtp_inst_pvar->type != PVT_SCRIPTVAR))) {
+			LM_ERR("Invalid pvar name <%.*s>\n", rtp_inst_pv_param.len,
+					rtp_inst_pv_param.s);
 			return -1;
 		}
 	}
@@ -1071,7 +1076,8 @@ extract_mediaip(str *body, str *mediaip, int *pf, char *line)
 		return -1;
 
 	mediaip->s = cp1 + 2;
-	mediaip->len = eat_line(mediaip->s, body->s + body->len - mediaip->s) - mediaip->s;
+	mediaip->len = eat_line(mediaip->s, body->s + body->len - mediaip->s)
+						- mediaip->s;
 	trim_len(mediaip->len, mediaip->s, *mediaip);
 
 	nextisip = 0;
@@ -1717,7 +1723,8 @@ unforce_rtp_proxy(struct sip_msg* msg, char* flags)
 	str extra_id;
 	int ret;
 	struct rtpp_node *node;
-	struct iovec v[1 + 4 + 3 + 2] = {{NULL, 0}, {"D", 1}, {" ", 1}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {" ", 1}, {NULL, 0}, {" ", 1}, {NULL, 0}};
+	struct iovec v[1 + 4 + 3 + 2] = {{NULL, 0}, {"D", 1}, {" ", 1}, {NULL, 0},
+			{NULL, 0}, {NULL, 0}, {" ", 1}, {NULL, 0}, {" ", 1}, {NULL, 0}};
 	/* 1 */   /* 2 */   /* 3 */    /* 4 */    /* 5 */    /* 6 */   /* 7 */    /* 8 */   /* 9 */
 
 
@@ -1881,7 +1888,8 @@ rtpproxy_manage(struct sip_msg *msg, char *flags, char *ip)
 	method = get_cseq(msg)->method_id;
 
 	if(!(method==METHOD_INVITE || method==METHOD_ACK || method==METHOD_CANCEL
-				|| method==METHOD_BYE || method==METHOD_UPDATE || method==METHOD_PRACK))
+				|| method==METHOD_BYE || method==METHOD_UPDATE
+				|| method==METHOD_PRACK))
 		return -1;
 
 	if(method==METHOD_CANCEL || method==METHOD_BYE)
@@ -2094,7 +2102,8 @@ struct new_mediaip {
 };
 
 	static int
-force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer, int forcedIP)
+force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer,
+		int forcedIP)
 {
 	str body, body1, oldport, oldip, newport;
 	struct new_mediaip newip;
@@ -2428,7 +2437,8 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer, int forc
 		for(;;) {
 			sdp_stream = get_sdp_stream(msg, sdp_session_num, sdp_stream_num);
 			if (!sdp_stream ||
-					(ice_candidate_priority_val.n && sdp_stream->remote_candidates.len)) break;
+					(ice_candidate_priority_val.n
+						&& sdp_stream->remote_candidates.len)) break;
 
 			if (sdp_stream->ip_addr.s && sdp_stream->ip_addr.len>0) {
 				oldip = sdp_stream->ip_addr;
@@ -2452,7 +2462,8 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer, int forc
 			/* XXX must compare address families in all addresses */
 			if (pf == AF_INET6) {
 				if (autobridge_ipv4v6 != 0) {
-					if ((append_opts(&opts, 'E') == -1) || (append_opts(&opts, 'I') == -1))  {
+					if ((append_opts(&opts, 'E') == -1)
+							|| (append_opts(&opts, 'I') == -1))  {
 						LM_ERR("out of pkg memory\n");
 						FORCE_RTP_PROXY_RET (-1);
 					}
@@ -2468,7 +2479,8 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer, int forc
 				v[1].iov_len = opts.oidx;
 			} else {
 				if (autobridge_ipv4v6 != 0) {
-					if ((append_opts(&opts, 'I') == -1) || (append_opts(&opts, 'E') == -1))  {
+					if ((append_opts(&opts, 'I') == -1)
+							|| (append_opts(&opts, 'E') == -1))  {
 						LM_ERR("out of pkg memory\n");
 						FORCE_RTP_PROXY_RET (-1);
 					}
@@ -2519,9 +2531,11 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer, int forc
 					}
 				}
 #ifdef EXTRA_DEBUG
-				LM_DBG("payload_types='%.*s'\n", payload_types.len, payload_types.s);
+				LM_DBG("payload_types='%.*s'\n", payload_types.len,
+						payload_types.s);
 #endif
-				if (sdp_stream->is_rtp && payload_types.len > 0 && node->rn_ptl_supported != 0) {
+				if (sdp_stream->is_rtp && payload_types.len > 0
+						&& node->rn_ptl_supported != 0) {
 					pt_opts.oidx = 0;
 					if (append_opts(&pt_opts, 'c') == -1) {
 						LM_ERR("out of pkg memory\n");
@@ -2779,7 +2793,8 @@ static int start_recording_f(struct sip_msg* msg, char *foo, char *bar)
 	str from_tag = {0, 0};
 	str to_tag = {0, 0};
 	struct rtpp_node *node;
-	struct iovec v[1 + 4 + 3] = {{NULL, 0}, {"R", 1}, {" ", 1}, {NULL, 0}, {" ", 1}, {NULL, 0}, {" ", 1}, {NULL, 0}};
+	struct iovec v[1 + 4 + 3] = {{NULL, 0}, {"R", 1}, {" ", 1}, {NULL, 0},
+		{" ", 1}, {NULL, 0}, {" ", 1}, {NULL, 0}};
 	/* 1 */   /* 2 */   /* 3 */    /* 4 */   /* 5 */    /* 6 */   /* 1 */
 
 	if (get_callid(msg, &callid) == -1 || callid.len == 0) {

+ 6 - 8
modules/rtpproxy/rtpproxy.h

@@ -1,4 +1,4 @@
-/* $Id: nathelper.c 1808 2007-03-10 17:36:19Z bogdan_iancu $
+/*
  *
  * Copyright (C) 2003 Porta Software Ltd
  *
@@ -18,10 +18,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
- * History:
- * ---------
- * 2007-04-13   splitted from nathelper.c (ancuta)
-*/
+ */
 
 
 #ifndef _RTPPROXY_H
@@ -42,8 +39,8 @@ struct rtpp_node {
 	int					rn_disabled;	/* found unaccessible? */
 	unsigned			rn_weight;		/* for load balancing */
 	unsigned int		rn_recheck_ticks;
-        int                     rn_rep_supported;
-        int                     rn_ptl_supported;
+	int                 rn_rep_supported;
+	int                 rn_ptl_supported;
 	struct rtpp_node	*rn_next;
 };
 
@@ -70,7 +67,8 @@ struct rtpp_node *select_rtpp_node(str, int);
 char *send_rtpp_command(struct rtpp_node *, struct iovec *, int);
 
 struct rtpp_set *get_rtpp_set(str *set_name);
-int insert_rtpp_node(struct rtpp_set *const rtpp_list, const str *const url, const int weight, const int disabled);
+int insert_rtpp_node(struct rtpp_set *const rtpp_list, const str *const url,
+		const int weight, const int disabled);
 
 int set_rtp_inst_pvar(struct sip_msg *msg, const str * const uri);
 

+ 9 - 5
modules/rtpproxy/rtpproxy_db.c

@@ -67,7 +67,8 @@ static int rtpp_load_db(void)
 	db1_res_t *res = NULL;
 	db_val_t *values = NULL;
 	db_row_t *rows = NULL;
-	db_key_t query_cols[] = {&rtpp_setid_col, &rtpp_url_col, &rtpp_weight_col, &rtpp_flags_col};
+	db_key_t query_cols[] = {&rtpp_setid_col, &rtpp_url_col, &rtpp_weight_col,
+		&rtpp_flags_col};
 
 	str set, url;
 	int weight, flags;
@@ -81,7 +82,8 @@ static int rtpp_load_db(void)
 	}
 	if (rtpp_dbf.use_table(rtpp_db_handle, &rtpp_table_name) < 0)
 	{
-		LM_ERR("unable to use table '%.*s'\n", rtpp_table_name.len, rtpp_table_name.s);
+		LM_ERR("unable to use table '%.*s'\n", rtpp_table_name.len,
+				rtpp_table_name.s);
 		return -1;
 	}
 	if (rtpp_dbf.query(rtpp_db_handle, 0, 0, 0, query_cols, 0, n_cols, 0, &res) < 0)
@@ -115,7 +117,8 @@ static int rtpp_load_db(void)
 		}
 		if (insert_rtpp_node(rtpp_list, &url, weight, flags) < 0)
 		{
-			LM_ERR("error inserting '%.*s' into set '%.*s'\n", url.len, url.s, set.len, set.s);
+			LM_ERR("error inserting '%.*s' into set '%.*s'\n", url.len, url.s,
+					set.len, set.s);
 		}
 	}
 
@@ -133,7 +136,8 @@ int init_rtpproxy_db(void)
 
 	if (db_bind_mod(&rtpp_db_url, &rtpp_dbf) < 0)
 	{
-		LM_ERR("Unable to bind to db driver - %.*s\n", rtpp_db_url.len, rtpp_db_url.s);
+		LM_ERR("Unable to bind to db driver - %.*s\n",
+				rtpp_db_url.len, rtpp_db_url.s);
 		return -1;
 	}
 	if (rtpp_connect_db() != 0)
@@ -154,7 +158,7 @@ int init_rtpproxy_db(void)
 			break;
 		default:
 			LM_ERR("invalid table version (found %d, require %d)\n",
-			  rtpp_table_version, RTPP_TABLE_VERSION);
+					rtpp_table_version, RTPP_TABLE_VERSION);
 			ret = -1;
 			goto done;
 	}

+ 87 - 95
modules/rtpproxy/rtpproxy_funcs.c

@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * Copyright (C) 2001-2003 FhG Fokus
  *
  * This file is part of Kamailio, a free SIP server.
@@ -15,16 +13,10 @@
  * 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
  *
- * History:
- * --------
- *  2003-11-06  body len is computed using the message len (it's
- *               not taken any more from the msg. content-length) (andrei)
- *  2008-08-30  body len is taken from Conent-length header as it is more 
- *               reliable (UDP packages may contain garbage at the end)(bogdan)
  */
 
 #include <stdio.h>
@@ -54,16 +46,16 @@
 #define advance(_ptr,_n,_str,_error) \
 	do{\
 		if ((_ptr)+(_n)>(_str).s+(_str).len)\
-			goto _error;\
+		goto _error;\
 		(_ptr) = (_ptr) + (_n);\
 	}while(0);
 #define one_of_16( _x , _t ) \
 	(_x==_t[0]||_x==_t[15]||_x==_t[8]||_x==_t[2]||_x==_t[3]||_x==_t[4]\
-	||_x==_t[5]||_x==_t[6]||_x==_t[7]||_x==_t[1]||_x==_t[9]||_x==_t[10]\
-	||_x==_t[11]||_x==_t[12]||_x==_t[13]||_x==_t[14])
+	 ||_x==_t[5]||_x==_t[6]||_x==_t[7]||_x==_t[1]||_x==_t[9]||_x==_t[10]\
+	 ||_x==_t[11]||_x==_t[12]||_x==_t[13]||_x==_t[14])
 #define one_of_8( _x , _t ) \
 	(_x==_t[0]||_x==_t[7]||_x==_t[1]||_x==_t[2]||_x==_t[3]||_x==_t[4]\
-	||_x==_t[5]||_x==_t[6])
+	 ||_x==_t[5]||_x==_t[6])
 
 
 
@@ -104,7 +96,7 @@ int check_content_type(struct sip_msg *msg)
 	if (!msg->content_type)
 	{
 		LM_WARN("the header Content-TYPE is absent!"
-			"let's assume the content is text/plain ;-)\n");
+				"let's assume the content is text/plain ;-)\n");
 		return 1;
 	}
 
@@ -112,7 +104,7 @@ int check_content_type(struct sip_msg *msg)
 	if (str_type.len>=15 && (*str_type.s=='m' || *str_type.s=='M')
 			&& strncasecmp(str_type.s, "multipart/mixed", 15) == 0) {
 		return 2;
-    }
+	}
 	p = str_type.s;
 	advance(p,4,str_type,error_1);
 	x = READ(p-4);
@@ -174,13 +166,13 @@ int extract_body(struct sip_msg *msg, str *body )
 	char *rest, *p1, *p2;
 	struct hdr_field hf;
 	unsigned int mime;
-	
+
 	body->s = get_body(msg);
 	if (body->s==0) {
 		LM_ERR("failed to get the message body\n");
 		goto error;
 	}
-	
+
 	/*
 	 * Better use the content-len value - no need of any explicit
 	 * parcing as get_body() parsed all headers and Conten-Length
@@ -203,7 +195,7 @@ int extract_body(struct sip_msg *msg, str *body )
 		goto error;
 	}
 
-	/* no need for parse_headers(msg, EOH), get_body will 
+	/* no need for parse_headers(msg, EOH), get_body will
 	 * parse everything */
 	/*is the content type correct?*/
 	if((ret = check_content_type(msg))==-1)
@@ -248,7 +240,7 @@ int extract_body(struct sip_msg *msg, str *body )
 				return -1;
 			if(hf.type==HDR_CONTENTTYPE_T) {
 				if(decode_mime_type(hf.body.s, hf.body.s + hf.body.len,
-						&mime)==NULL)
+							&mime)==NULL)
 					return -1;
 				if (((((unsigned int)mime)>>16) == TYPE_APPLICATION)
 						&& ((mime&0x00ff) == SUBTYPE_SDP)) {
@@ -288,31 +280,31 @@ done:
  * pattern b2 of size len2 in memory block b1 of size len1 or
  * NULL if none is found. Obtained from NetBSD.
  */
-void *
+	void *
 ser_memmem(const void *b1, const void *b2, size_t len1, size_t len2)
 {
-        /* Initialize search pointer */
-        char *sp = (char *) b1;
+	/* Initialize search pointer */
+	char *sp = (char *) b1;
 
-        /* Initialize pattern pointer */
-        char *pp = (char *) b2;
+	/* Initialize pattern pointer */
+	char *pp = (char *) b2;
 
-        /* Initialize end of search address space pointer */
-        char *eos = sp + len1 - len2;
+	/* Initialize end of search address space pointer */
+	char *eos = sp + len1 - len2;
 
-        /* Sanity check */
-        if(!(b1 && b2 && len1 && len2))
-                return NULL;
+	/* Sanity check */
+	if(!(b1 && b2 && len1 && len2))
+		return NULL;
 
-        while (sp <= eos) {
-                if (*sp == *pp)
-                        if (memcmp(sp, pp, len2) == 0)
-                                return sp;
+	while (sp <= eos) {
+		if (*sp == *pp)
+			if (memcmp(sp, pp, len2) == 0)
+				return sp;
 
-                        sp++;
-        }
+		sp++;
+	}
 
-        return NULL;
+	return NULL;
 }
 
 /*
@@ -325,24 +317,24 @@ ser_memmem(const void *b1, const void *b2, size_t len1, size_t len2)
  * (so make sure it is, before calling this function or
  *  it might fail even if the message _has_ a callid)
  */
-int
+	int
 get_callid(struct sip_msg* _m, str* _cid)
 {
 
-        if ((parse_headers(_m, HDR_CALLID_F, 0) == -1)) {
-                LM_ERR("failed to parse call-id header\n");
-                return -1;
-        }
+	if ((parse_headers(_m, HDR_CALLID_F, 0) == -1)) {
+		LM_ERR("failed to parse call-id header\n");
+		return -1;
+	}
 
-        if (_m->callid == NULL) {
-                LM_ERR("call-id not found\n");
-                return -1;
-        }
+	if (_m->callid == NULL) {
+		LM_ERR("call-id not found\n");
+		return -1;
+	}
 
-        _cid->s = _m->callid->body.s;
-        _cid->len = _m->callid->body.len;
-        trim(_cid);
-        return 0;
+	_cid->s = _m->callid->body.s;
+	_cid->len = _m->callid->body.len;
+	trim(_cid);
+	return 0;
 }
 
 /*
@@ -350,79 +342,79 @@ get_callid(struct sip_msg* _m, str* _cid)
  * assumes the to header is already parsed, so
  * make sure it really is before calling this function
  */
-int
+	int
 get_to_tag(struct sip_msg* _m, str* _tag)
 {
 
-        if (!_m->to) {
-                LM_ERR("To header field missing\n");
-                return -1;
-        }
+	if (!_m->to) {
+		LM_ERR("To header field missing\n");
+		return -1;
+	}
 
-        if (get_to(_m)->tag_value.len) {
-                _tag->s = get_to(_m)->tag_value.s;
-                _tag->len = get_to(_m)->tag_value.len;
-        } else {
-                _tag->s = NULL; /* fixes gcc 4.0 warnings */
-                _tag->len = 0;
-        }
+	if (get_to(_m)->tag_value.len) {
+		_tag->s = get_to(_m)->tag_value.s;
+		_tag->len = get_to(_m)->tag_value.len;
+	} else {
+		_tag->s = NULL; /* fixes gcc 4.0 warnings */
+		_tag->len = 0;
+	}
 
-        return 0;
+	return 0;
 }
 
 /*
  * Extract tag from From header field of a request
  */
-int
+	int
 get_from_tag(struct sip_msg* _m, str* _tag)
 {
 
-        if (parse_from_header(_m)<0) {
-                LM_ERR("failed to parse From header\n");
-                return -1;
-        }
+	if (parse_from_header(_m)<0) {
+		LM_ERR("failed to parse From header\n");
+		return -1;
+	}
 
-        if (get_from(_m)->tag_value.len) {
-                _tag->s = get_from(_m)->tag_value.s;
-                _tag->len = get_from(_m)->tag_value.len;
-        } else {
-                _tag->s = NULL; /* fixes gcc 4.0 warnings */
-                _tag->len = 0;
-        }
+	if (get_from(_m)->tag_value.len) {
+		_tag->s = get_from(_m)->tag_value.s;
+		_tag->len = get_from(_m)->tag_value.len;
+	} else {
+		_tag->s = NULL; /* fixes gcc 4.0 warnings */
+		_tag->len = 0;
+	}
 
-        return 0;
+	return 0;
 }
 
 /*
  * Extract URI from the Contact header field
  */
-int
+	int
 get_contact_uri(struct sip_msg* _m, struct sip_uri *uri, contact_t** _c)
 {
 
-        if ((parse_headers(_m, HDR_CONTACT_F, 0) == -1) || !_m->contact)
-                return -1;
-        if (!_m->contact->parsed && parse_contact(_m->contact) < 0) {
-                LM_ERR("failed to parse Contact body\n");
-                return -1;
-        }
-        *_c = ((contact_body_t*)_m->contact->parsed)->contacts;
-        if (*_c == NULL)
-                /* no contacts found */
-                return -1;
-
-        if (parse_uri((*_c)->uri.s, (*_c)->uri.len, uri) < 0 || uri->host.len <= 0) {
-                LM_ERR("failed to parse Contact URI [%.*s]\n",
-                        (*_c)->uri.len, ((*_c)->uri.s)?(*_c)->uri.s:"");
-                return -1;
-        }
-        return 0;
+	if ((parse_headers(_m, HDR_CONTACT_F, 0) == -1) || !_m->contact)
+		return -1;
+	if (!_m->contact->parsed && parse_contact(_m->contact) < 0) {
+		LM_ERR("failed to parse Contact body\n");
+		return -1;
+	}
+	*_c = ((contact_body_t*)_m->contact->parsed)->contacts;
+	if (*_c == NULL)
+		/* no contacts found */
+		return -1;
+
+	if (parse_uri((*_c)->uri.s, (*_c)->uri.len, uri) < 0 || uri->host.len <= 0) {
+		LM_ERR("failed to parse Contact URI [%.*s]\n",
+				(*_c)->uri.len, ((*_c)->uri.s)?(*_c)->uri.s:"");
+		return -1;
+	}
+	return 0;
 }
 
 /*
  * Extract branch from Via header
  */
-int
+	int
 get_via_branch(struct sip_msg* msg, int vianum, str* _branch)
 {
 	struct via_body *via;

+ 2 - 4
modules/rtpproxy/rtpproxy_funcs.h

@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * Copyright (C) 2001-2003 FhG Fokus
  *
  * This file is part of Kamailio, a free SIP server.
@@ -15,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
  */
 

+ 164 - 165
modules/rtpproxy/rtpproxy_stream.c

@@ -1,5 +1,4 @@
-/* $Id: rtpproxy_stream.c,v 1.2 2008/11/04 22:28:04 sobomax Exp $
- *
+/*
  * Copyright (C) 2008 Sippy Software, Inc., http://www.sippysoft.com
  *
  * This file is part of ser, a free SIP server.
@@ -35,202 +34,202 @@
 #include "rtpproxy.h"
 #include "rtpproxy_funcs.h"
 
-int
+	int
 fixup_var_str_int(void **param, int param_no)
 {
-    int ret;
-    pv_elem_t *model;
-    str s;
-
-    if (param_no == 1) {
-        model = NULL;
-        s.s = (char *)(*param);
-        s.len = strlen(s.s);
-        if (pv_parse_format(&s, &model) < 0) {
-            LM_ERR("wrong format[%s]!\n", (char *)(*param));
-            return E_UNSPEC;
-        }
-        if (model == NULL) {
-            LM_ERR("empty parameter!\n");
-            return E_UNSPEC;
-        }
-        *param = (void *)model;
-    } else if (param_no == 2) {
-	/* According to
-	 * http://www.kamailio.org/docs/modules/1.5.x/nathelper.html#rtpproxy_stream2xxx
-	 * this could be -1 */
-	s.s = (char *)(*param);
-	s.len = strlen(s.s);
-	if (str2sint(&s, &ret)==0) {
-		pkg_free(*param);
-		*param = (void *)(long)ret;
-        } else {
-            LM_ERR("bad number <%s>\n", (char *)(*param));
-            return E_CFG;
-        }
-    }
-    return 0;
+	int ret;
+	pv_elem_t *model;
+	str s;
+
+	if (param_no == 1) {
+		model = NULL;
+		s.s = (char *)(*param);
+		s.len = strlen(s.s);
+		if (pv_parse_format(&s, &model) < 0) {
+			LM_ERR("wrong format[%s]!\n", (char *)(*param));
+			return E_UNSPEC;
+		}
+		if (model == NULL) {
+			LM_ERR("empty parameter!\n");
+			return E_UNSPEC;
+		}
+		*param = (void *)model;
+	} else if (param_no == 2) {
+		/* According to
+		 * http://www.kamailio.org/docs/modules/1.5.x/nathelper.html#rtpproxy_stream2xxx
+		 * this could be -1 */
+		s.s = (char *)(*param);
+		s.len = strlen(s.s);
+		if (str2sint(&s, &ret)==0) {
+			pkg_free(*param);
+			*param = (void *)(long)ret;
+		} else {
+			LM_ERR("bad number <%s>\n", (char *)(*param));
+			return E_CFG;
+		}
+	}
+	return 0;
 }
 
-static int
+	static int
 rtpproxy_stream(struct sip_msg* msg, str *pname, int count, int stream2uac)
 {
-    int nitems;
-    str callid, from_tag, to_tag;
-    struct rtpp_node *node;
-    char cbuf[16];
-    struct iovec v[] = {
-        {NULL,        0},
-        {cbuf,        0}, /* 1 P<count> */
-        {" ",         1},
-        {NULL,        0}, /* 3 callid */
-        {" ",         1},
-        {NULL,        0}, /* 5 pname */
-        {" session ", 9},
-        {NULL,        0}, /* 7 from tag */
-        {";1 ",       3},
-        {NULL,        0}, /* 9 to tag */
-        {";1",        2}
-    };
-
-    if (get_callid(msg, &callid) == -1 || callid.len == 0) {
-        LM_ERR("can't get Call-Id field\n");
-        return -1;
-    }
-    if (get_to_tag(msg, &to_tag) == -1) {
-        LM_ERR("can't get To tag\n");
-        return -1;
-    }
-    if (get_from_tag(msg, &from_tag) == -1 || from_tag.len == 0) {
-        LM_ERR("can't get From tag\n");
-        return -1;
-    }
-    v[1].iov_len = sprintf(cbuf, "P%d", count);
-    STR2IOVEC(callid, v[3]);
-    STR2IOVEC(*pname, v[5]);
-    node = select_rtpp_node(callid, 1);
-    if (!node) {
-        LM_ERR("no available proxies\n");
-        return -1;
-    }
-    if (node->rn_ptl_supported == 0) {
-        LM_ERR("required functionality is not "
-          "supported by the version of the RTPproxy running on the selected "
-          "node.  Please upgrade the RTPproxy and try again.\n");
-        return -1;
-    }
-    set_rtp_inst_pvar(msg, &node->rn_url);
-    nitems = 11;
-    if (stream2uac == 0) {
-        if (to_tag.len == 0)
-            return -1;
-        STR2IOVEC(to_tag, v[7]);
-        STR2IOVEC(from_tag, v[9]);
-    } else {
-        STR2IOVEC(from_tag, v[7]);
-        STR2IOVEC(to_tag, v[9]);
-        if (to_tag.len <= 0)
-            nitems -= 2;
-    }
-    send_rtpp_command(node, v, nitems);
-
-    return 1;
+	int nitems;
+	str callid, from_tag, to_tag;
+	struct rtpp_node *node;
+	char cbuf[16];
+	struct iovec v[] = {
+		{NULL,        0},
+		{cbuf,        0}, /* 1 P<count> */
+		{" ",         1},
+		{NULL,        0}, /* 3 callid */
+		{" ",         1},
+		{NULL,        0}, /* 5 pname */
+		{" session ", 9},
+		{NULL,        0}, /* 7 from tag */
+		{";1 ",       3},
+		{NULL,        0}, /* 9 to tag */
+		{";1",        2}
+	};
+
+	if (get_callid(msg, &callid) == -1 || callid.len == 0) {
+		LM_ERR("can't get Call-Id field\n");
+		return -1;
+	}
+	if (get_to_tag(msg, &to_tag) == -1) {
+		LM_ERR("can't get To tag\n");
+		return -1;
+	}
+	if (get_from_tag(msg, &from_tag) == -1 || from_tag.len == 0) {
+		LM_ERR("can't get From tag\n");
+		return -1;
+	}
+	v[1].iov_len = sprintf(cbuf, "P%d", count);
+	STR2IOVEC(callid, v[3]);
+	STR2IOVEC(*pname, v[5]);
+	node = select_rtpp_node(callid, 1);
+	if (!node) {
+		LM_ERR("no available proxies\n");
+		return -1;
+	}
+	if (node->rn_ptl_supported == 0) {
+		LM_ERR("required functionality is not "
+				"supported by the version of the RTPproxy running on the selected "
+				"node.  Please upgrade the RTPproxy and try again.\n");
+		return -1;
+	}
+	set_rtp_inst_pvar(msg, &node->rn_url);
+	nitems = 11;
+	if (stream2uac == 0) {
+		if (to_tag.len == 0)
+			return -1;
+		STR2IOVEC(to_tag, v[7]);
+		STR2IOVEC(from_tag, v[9]);
+	} else {
+		STR2IOVEC(from_tag, v[7]);
+		STR2IOVEC(to_tag, v[9]);
+		if (to_tag.len <= 0)
+			nitems -= 2;
+	}
+	send_rtpp_command(node, v, nitems);
+
+	return 1;
 }
 
-static int
+	static int
 rtpproxy_stream2_f(struct sip_msg *msg, char *str1, int count, int stream2uac)
 {
-    str pname;
+	str pname;
 
-    if (str1 == NULL || pv_printf_s(msg, (pv_elem_p)str1, &pname) != 0)
-	return -1;
-    return rtpproxy_stream(msg, &pname, count, stream2uac);
+	if (str1 == NULL || pv_printf_s(msg, (pv_elem_p)str1, &pname) != 0)
+		return -1;
+	return rtpproxy_stream(msg, &pname, count, stream2uac);
 }
 
-int
+	int
 rtpproxy_stream2uac2_f(struct sip_msg* msg, char* str1, char* str2)
 {
 
-    return rtpproxy_stream2_f(msg, str1, (int)(long)str2, 1);
+	return rtpproxy_stream2_f(msg, str1, (int)(long)str2, 1);
 }
 
-int
+	int
 rtpproxy_stream2uas2_f(struct sip_msg* msg, char* str1, char* str2)
 {
 
-    return rtpproxy_stream2_f(msg, str1, (int)(long)str2, 0);
+	return rtpproxy_stream2_f(msg, str1, (int)(long)str2, 0);
 }
 
-static int
+	static int
 rtpproxy_stop_stream(struct sip_msg* msg, int stream2uac)
 {
-    int nitems;
-    str callid, from_tag, to_tag;
-    struct rtpp_node *node;
-    struct iovec v[] = {
-        {NULL,        0},
-        {"S",         1}, /* 1 */
-        {" ",         1},
-        {NULL,        0}, /* 3 callid */
-        {" ",         1},
-        {NULL,        0}, /* 5 from tag */
-        {";1 ",       3},
-        {NULL,        0}, /* 7 to tag */
-        {";1",        2}
-    };
-
-    if (get_callid(msg, &callid) == -1 || callid.len == 0) {
-        LM_ERR("can't get Call-Id field\n");
-        return -1;
-    }
-    if (get_to_tag(msg, &to_tag) == -1) {
-        LM_ERR("can't get To tag\n");
-        return -1;
-    }
-    if (get_from_tag(msg, &from_tag) == -1 || from_tag.len == 0) {
-        LM_ERR("can't get From tag\n");
-        return -1;
-    }
-    STR2IOVEC(callid, v[3]);
-    node = select_rtpp_node(callid, 1);
-    if (!node) {
-        LM_ERR("no available proxies\n");
-        return -1;
-    }
-    if (node->rn_ptl_supported == 0) {
-        LM_ERR("required functionality is not "
-          "supported by the version of the RTPproxy running on the selected "
-          "node.  Please upgrade the RTPproxy and try again.\n");
-        return -1;
-    }
-    set_rtp_inst_pvar(msg, &node->rn_url);
-    nitems = 9;
-    if (stream2uac == 0) {
-        if (to_tag.len == 0)
-            return -1;
-        STR2IOVEC(to_tag, v[5]);
-        STR2IOVEC(from_tag, v[7]);
-    } else {
-        STR2IOVEC(from_tag, v[5]);
-        STR2IOVEC(to_tag, v[7]);
-        if (to_tag.len <= 0)
-            nitems -= 2;
-    }
-    send_rtpp_command(node, v, nitems);
-
-    return 1;
+	int nitems;
+	str callid, from_tag, to_tag;
+	struct rtpp_node *node;
+	struct iovec v[] = {
+		{NULL,        0},
+		{"S",         1}, /* 1 */
+		{" ",         1},
+		{NULL,        0}, /* 3 callid */
+		{" ",         1},
+		{NULL,        0}, /* 5 from tag */
+		{";1 ",       3},
+		{NULL,        0}, /* 7 to tag */
+		{";1",        2}
+	};
+
+	if (get_callid(msg, &callid) == -1 || callid.len == 0) {
+		LM_ERR("can't get Call-Id field\n");
+		return -1;
+	}
+	if (get_to_tag(msg, &to_tag) == -1) {
+		LM_ERR("can't get To tag\n");
+		return -1;
+	}
+	if (get_from_tag(msg, &from_tag) == -1 || from_tag.len == 0) {
+		LM_ERR("can't get From tag\n");
+		return -1;
+	}
+	STR2IOVEC(callid, v[3]);
+	node = select_rtpp_node(callid, 1);
+	if (!node) {
+		LM_ERR("no available proxies\n");
+		return -1;
+	}
+	if (node->rn_ptl_supported == 0) {
+		LM_ERR("required functionality is not "
+				"supported by the version of the RTPproxy running on the selected "
+				"node.  Please upgrade the RTPproxy and try again.\n");
+		return -1;
+	}
+	set_rtp_inst_pvar(msg, &node->rn_url);
+	nitems = 9;
+	if (stream2uac == 0) {
+		if (to_tag.len == 0)
+			return -1;
+		STR2IOVEC(to_tag, v[5]);
+		STR2IOVEC(from_tag, v[7]);
+	} else {
+		STR2IOVEC(from_tag, v[5]);
+		STR2IOVEC(to_tag, v[7]);
+		if (to_tag.len <= 0)
+			nitems -= 2;
+	}
+	send_rtpp_command(node, v, nitems);
+
+	return 1;
 }
 
-int
+	int
 rtpproxy_stop_stream2uac2_f(struct sip_msg* msg, char* str1, char* str2)
 {
 
-    return rtpproxy_stop_stream(msg, 1);
+	return rtpproxy_stop_stream(msg, 1);
 }
 
-int
+	int
 rtpproxy_stop_stream2uas2_f(struct sip_msg* msg, char* str1, char* str2)
 {
 
-    return rtpproxy_stop_stream(msg, 0);
+	return rtpproxy_stop_stream(msg, 0);
 }

+ 1 - 1
modules/rtpproxy/rtpproxy_stream.h

@@ -1,4 +1,4 @@
-/* $Id: rtpproxy_stream.h,v 1.1 2008/11/04 21:10:07 sobomax Exp $
+/*
  *
  * Copyright (C) 2008 Sippy Software, Inc., http://www.sippysoft.com
  *