ソースを参照

sdpops: removed svn $Id$ lines, coherent indentation and whitespacing

- added license header text
Daniel-Constantin Mierla 9 年 前
コミット
c429922598
4 ファイル変更129 行追加114 行削除
  1. 21 0
      modules/sdpops/api.h
  2. 6 8
      modules/sdpops/sdpops_data.c
  3. 2 4
      modules/sdpops/sdpops_data.h
  4. 100 102
      modules/sdpops/sdpops_mod.c

+ 21 - 0
modules/sdpops/api.h

@@ -1,3 +1,24 @@
+/*
+ * Copyright (C) 2011 Daniel-Constantin Mierla (asipto.com)
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Kamailio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version
+ *
+ * Kamailio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
 #ifndef SDPOPS_API_H
 #define SDPOPS_API_H
 #include "../../str.h"

+ 6 - 8
modules/sdpops/sdpops_data.c

@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * Copyright (C) 2011 Daniel-Constantin Mierla (asipto.com)
  *
  * 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
  *
  */
@@ -47,7 +45,7 @@ Registry:
 PT        encoding name   audio/video (A/V)  clock rate (Hz)  channels (audio)  Reference
 --------  --------------  -----------------  ---------------  ----------------  ---------
 0         PCMU            A                  8000             1                 [RFC3551]
-1         Reserved	  
+1         Reserved
 2         Reserved
 3         GSM             A                  8000             1                 [RFC3551]
 4         G723            A                  8000             1                 [Kumar][RFC3551]
@@ -84,7 +82,7 @@ PT        encoding name   audio/video (A/V)  clock rate (Hz)  channels (audio)
 35-71     Unassigned      ?
 72-76     Reserved for RTCP conflict avoidance                                  [RFC3551]
 77-95     Unassigned      ?
-96-127    dynamic         ?                                                     [RFC3551] 
+96-127    dynamic         ?                                                     [RFC3551]
 
 
 Registry Name: RTP Payload Format media types
@@ -271,8 +269,8 @@ int str_find_token(str *text, str *result, char delim)
 		return -1;
 	if(text->s[0] == delim)
 	{
-		 text->s += 1;
-		 text->len -= 1;
+		text->s += 1;
+		text->len -= 1;
 	}
 	trim_leading(text);
 	result->s = text->s;

+ 2 - 4
modules/sdpops/sdpops_data.h

@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * Copyright (C) 2011 Daniel-Constantin Mierla (asipto.com)
  *
  * 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
  *
  */

+ 100 - 102
modules/sdpops/sdpops_mod.c

@@ -1,7 +1,5 @@
 /*
- * $Id$
- *
- * Copyright (C) 2011 Daniel-Constantin Mierla (asipto.com)
+ * Copyright (C) 2011-2016 Daniel-Constantin Mierla (asipto.com)
  *
  * 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
  *
  */
@@ -147,8 +145,8 @@ struct module_exports exports= {
 	0           /* per-child init function */
 };
 
-/** 
- * 
+/**
+ *
  */
 static int mod_init(void)
 {
@@ -354,7 +352,7 @@ int sdp_remove_codecs_by_id(sip_msg_t* msg, str* codecs)
 			if(!sdp_stream) break;
 
 			LM_DBG("stream %d of %d - payloads [%.*s]\n",
-					sdp_stream_num, sdp_session_num, 
+					sdp_stream_num, sdp_session_num,
 					sdp_stream->payloads.len, sdp_stream->payloads.s);
 			sdp_codecs = sdp_stream->payloads;
 			tmp_codecs = *codecs;
@@ -756,7 +754,7 @@ static int w_sdp_keep_codecs_by_name(sip_msg_t* msg, char* codecs, char* media)
 	return 1;
 }
 
-/** 
+/**
  * @brief check 'media' matches the value of any 'm=value ...' lines
  * @return -1 - error; 0 - not found; 1 - found
  */
@@ -1006,7 +1004,7 @@ static int w_sdp_remove_media(sip_msg_t* msg, char* media, char *bar)
 }
 
 
-/** 
+/**
  * @brief check 'media' matches the value of any 'm=media port value ...' lines
  * @return -1 - error; 0 - not found; 1 - found
  */
@@ -1040,13 +1038,13 @@ static int sdp_with_transport(sip_msg_t *msg, str *transport, int like)
 					sdp_stream_num, sdp_session_num,
 					sdp_stream->transport.len, sdp_stream->transport.s);
 			if (like == 0) {
-			    if(transport->len==sdp_stream->transport.len
-			       && strncasecmp(sdp_stream->transport.s, transport->s,
-					      transport->len)==0)
+				if(transport->len==sdp_stream->transport.len
+						&& strncasecmp(sdp_stream->transport.s, transport->s,
+							transport->len)==0)
 				return 1;
 			} else {
-			    if (ser_memmem(sdp_stream->transport.s, transport->s,
-					   sdp_stream->transport.len, transport->len)!=NULL)
+				if (ser_memmem(sdp_stream->transport.s, transport->s,
+						sdp_stream->transport.len, transport->len)!=NULL)
 				return 1;
 			}
 			sdp_stream_num++;
@@ -1057,83 +1055,83 @@ static int sdp_with_transport(sip_msg_t *msg, str *transport, int like)
 	return 0;
 }
 
-/** 
+/**
  * @brief assigns common media transport (if any) of 'm' lines to pv argument
  * @return -1 - error; 0 - not found; 1 - found
  */
 static int w_sdp_transport(sip_msg_t* msg, char *avp)
 {
-    int_str avp_val;
-    int_str avp_name;
-    static unsigned short avp_type = 0;
-    str s;
-    pv_spec_t *avp_spec = NULL;
-    int sdp_session_num;
-    int sdp_stream_num;
-    sdp_session_cell_t* sdp_session;
-    sdp_stream_cell_t* sdp_stream;
-    str *transport;
-
-    s.s = avp; s.len = strlen(s.s);
-    if (pv_locate_name(&s) != s.len) {
-	LM_ERR("invalid avp parameter %s\n", avp);
-	return -1;
-    }
-    if (((avp_spec = pv_cache_get(&s)) == NULL)
-	|| avp_spec->type!=PVT_AVP) {
-	LM_ERR("malformed or non AVP %s\n", avp);
-	return -1;
-    }
-    if (pv_get_avp_name(0, &avp_spec->pvp, &avp_name, &avp_type) != 0) {
-	LM_ERR("invalid AVP definition %s\n", avp);
-	return -1;
-    }
+	int_str avp_val;
+	int_str avp_name;
+	static unsigned short avp_type = 0;
+	str s;
+	pv_spec_t *avp_spec = NULL;
+	int sdp_session_num;
+	int sdp_stream_num;
+	sdp_session_cell_t* sdp_session;
+	sdp_stream_cell_t* sdp_stream;
+	str *transport;
 
-    if(parse_sdp(msg) < 0) {
-	LM_ERR("unable to parse sdp\n");
-	return -1;
-    }
+	s.s = avp; s.len = strlen(s.s);
+	if (pv_locate_name(&s) != s.len) {
+		LM_ERR("invalid avp parameter %s\n", avp);
+		return -1;
+	}
+	if (((avp_spec = pv_cache_get(&s)) == NULL)
+			|| avp_spec->type!=PVT_AVP) {
+		LM_ERR("malformed or non AVP %s\n", avp);
+		return -1;
+	}
+	if (pv_get_avp_name(0, &avp_spec->pvp, &avp_name, &avp_type) != 0) {
+		LM_ERR("invalid AVP definition %s\n", avp);
+		return -1;
+	}
 
-    sdp_session_num = 0;
-    transport = (str *)NULL;
+	if(parse_sdp(msg) < 0) {
+		LM_ERR("unable to parse sdp\n");
+		return -1;
+	}
+
+	sdp_session_num = 0;
+	transport = (str *)NULL;
 
-    for (;;) {
-	sdp_session = get_sdp_session(msg, sdp_session_num);
-	if (!sdp_session) break;
-	sdp_stream_num = 0;
 	for (;;) {
-	    sdp_stream = get_sdp_stream(msg, sdp_session_num,
+		sdp_session = get_sdp_session(msg, sdp_session_num);
+		if (!sdp_session) break;
+		sdp_stream_num = 0;
+		for (;;) {
+			sdp_stream = get_sdp_stream(msg, sdp_session_num,
 					sdp_stream_num);
-	    if (!sdp_stream) break;
-	    LM_DBG("stream %d of %d - transport [%.*s]\n",
-		   sdp_stream_num, sdp_session_num,
-		   sdp_stream->transport.len, sdp_stream->transport.s);
-	    if (transport) {
-		if (transport->len != sdp_stream->transport.len
-		    || strncasecmp(sdp_stream->transport.s, transport->s,
-				   transport->len) != 0) {
-		    LM_DBG("no common transport\n");
-		    return -2;
+			if (!sdp_stream) break;
+			LM_DBG("stream %d of %d - transport [%.*s]\n",
+			sdp_stream_num, sdp_session_num,
+			sdp_stream->transport.len, sdp_stream->transport.s);
+			if (transport) {
+				if (transport->len != sdp_stream->transport.len
+						|| strncasecmp(sdp_stream->transport.s, transport->s,
+								transport->len) != 0) {
+					LM_DBG("no common transport\n");
+					return -2;
+				}
+			} else {
+				transport = &sdp_stream->transport;
+			}
+			sdp_stream_num++;
 		}
-	    } else {
-		transport = &sdp_stream->transport;
-	    }
-	    sdp_stream_num++;
-	}
-	sdp_session_num++;
-    }
-    if (transport) {
-	avp_val.s.s = transport->s;
-	avp_val.s.len = transport->len;
-	LM_DBG("found common transport '%.*s'\n",
-	       transport->len, transport->s);
-	if (add_avp(AVP_VAL_STR | avp_type, avp_name, avp_val) != 0) {
-	    LM_ERR("failed to add transport avp");
-	    return -1;
-	}
-    }
-
-    return 1;
+		sdp_session_num++;
+	}
+	if (transport) {
+		avp_val.s.s = transport->s;
+		avp_val.s.len = transport->len;
+		LM_DBG("found common transport '%.*s'\n",
+				transport->len, transport->s);
+		if (add_avp(AVP_VAL_STR | avp_type, avp_name, avp_val) != 0) {
+			LM_ERR("failed to add transport avp");
+			return -1;
+		}
+	}
+
+	return 1;
 }
 
 
@@ -1569,30 +1567,30 @@ static int w_sdp_content_sloppy(sip_msg_t* msg, char* foo, char *bar)
  */
 int sdp_with_ice(sip_msg_t* msg)
 {
-    str ice, body;
+	str ice, body;
 
-    ice.s = "a=candidate";
-    ice.len = 11;
+	ice.s = "a=candidate";
+	ice.len = 11;
 
-    body.s = get_body(msg);
-    if (body.s == NULL) {
-	LM_DBG("failed to get the message body\n");
-	return -1;
-    }
+	body.s = get_body(msg);
+	if (body.s == NULL) {
+		LM_DBG("failed to get the message body\n");
+		return -1;
+	}
 
-    body.len = msg->len -(int)(body.s - msg->buf);
-    if (body.len == 0) {
-	LM_DBG("message body has length zero\n");
-	return -1;
-    }
+	body.len = msg->len -(int)(body.s - msg->buf);
+	if (body.len == 0) {
+		LM_DBG("message body has length zero\n");
+		return -1;
+	}
 
-    if (ser_memmem(body.s, ice.s, body.len, ice.len) != NULL) {
-	LM_DBG("found ice attribute\n");
-	return 1;
-    } else {
-	LM_DBG("didn't find ice attribute\n");
-	return -1;
-    }
+	if (ser_memmem(body.s, ice.s, body.len, ice.len) != NULL) {
+		LM_DBG("found ice attribute\n");
+		return 1;
+	} else {
+		LM_DBG("didn't find ice attribute\n");
+		return -1;
+	}
 }
 
 /**
@@ -1600,7 +1598,7 @@ int sdp_with_ice(sip_msg_t* msg)
  */
 static int w_sdp_with_ice(sip_msg_t* msg, char* foo, char *bar)
 {
-    return sdp_with_ice(msg);
+	return sdp_with_ice(msg);
 }
 
 /**