[svn-commits] phsultan: branch phsultan/jingle-support r223054 - in /team/phsultan/jingle-s...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Oct 9 10:07:47 CDT 2009


Author: phsultan
Date: Fri Oct  9 10:07:43 2009
New Revision: 223054

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=223054
Log:
Fix compile warnings and formatting.

Modified:
    team/phsultan/jingle-support/channels/chan_gtalk.c
    team/phsultan/jingle-support/channels/chan_jingle.c
    team/phsultan/jingle-support/include/asterisk/stun.h
    team/phsultan/jingle-support/main/stun.c
    team/phsultan/jingle-support/res/res_rtp_asterisk.c
    team/phsultan/jingle-support/res/res_rtp_multicast.c

Modified: team/phsultan/jingle-support/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/team/phsultan/jingle-support/channels/chan_gtalk.c?view=diff&rev=223054&r1=223053&r2=223054
==============================================================================
--- team/phsultan/jingle-support/channels/chan_gtalk.c (original)
+++ team/phsultan/jingle-support/channels/chan_gtalk.c Fri Oct  9 10:07:43 2009
@@ -1278,19 +1278,19 @@
 		sin.sin_port = htons(tmp->port);
 		ast_copy_string(credentials.local_ufrag, p->ourcandidates->username, sizeof(credentials.local_ufrag));
 		ast_copy_string(credentials.remote_ufrag, tmp->username, sizeof(credentials.remote_ufrag));
-		
+
 		/* Find out the result of the STUN */
 		ast_rtp_instance_get_remote_address(p->rtp, &aux);
 
 		/* If the STUN result is different from the IP of the hostname,
 			lock on the stun IP of the hostname advertised by the
 			remote client */
-		if (aux.sin_addr.s_addr && 
-		    aux.sin_addr.s_addr != sin.sin_addr.s_addr)
+		if (aux.sin_addr.s_addr && aux.sin_addr.s_addr != sin.sin_addr.s_addr) {
 			ast_rtp_instance_stun_request(p->rtp, &aux, &credentials);
-		else 
+		} else {
 			ast_rtp_instance_stun_request(p->rtp, &sin, &credentials);
-		
+		}
+
 		if (aux.sin_addr.s_addr) {
 			ast_debug(4, "Receiving RTP traffic from IP %s, matches with remote candidate's IP %s\n", ast_inet_ntoa(aux.sin_addr), tmp->ip);
 			ast_debug(4, "Sending STUN request to %s\n", tmp->ip);

Modified: team/phsultan/jingle-support/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/team/phsultan/jingle-support/channels/chan_jingle.c?view=diff&rev=223054&r1=223053&r2=223054
==============================================================================
--- team/phsultan/jingle-support/channels/chan_jingle.c (original)
+++ team/phsultan/jingle-support/channels/chan_jingle.c Fri Oct  9 10:07:43 2009
@@ -116,9 +116,9 @@
 	char local_ufrag[JINGLE_MAX_ATTRLEN];
 	char remote_ufrag[JINGLE_MAX_ATTRLEN];
 	char audio_content_name[JINGLE_MAX_ATTRLEN];    /*!< name attribute of content tag */
-	struct ast_rtp_instance *rtp;             	/*!< RTP audio session */
+	struct ast_rtp_instance *rtp;			/*!< RTP audio session */
 	char video_content_name[JINGLE_MAX_ATTRLEN];    /*!< name attribute of content tag */
-	struct ast_rtp_instance *vrtp;            	/*!< RTP video session */
+	struct ast_rtp_instance *vrtp;			/*!< RTP video session */
 	int capability;			/*!< Channel codec capability */
 	int peercapability;		/*!< Peer advertized codec capability */
 	int peernoncodeccapability;	/*!< Peer advertized non codec capability (ex. DTMF) */
@@ -675,7 +675,7 @@
 	if (p->ourcandidates) {
 		p->ourcandidates->next = candidate;
 	} else {
-		p->ourcandidates = candidate;	
+		p->ourcandidates = candidate;
 	}
 
 	res = 1;
@@ -786,7 +786,7 @@
 	}
 	ast_rtp_instance_get_local_address(p->rtp, &sin);
 	jingle_append_candidate(p, ours1, sin, 0);
-       	jingle_append_candidate(p, ours2, sin, 1);
+	jingle_append_candidate(p, ours2, sin, 1);
 
 	/* Select our native format based on codec preference until we receive
 	   something from another device to the contrary. */
@@ -796,7 +796,7 @@
 		p->capability = global_capability;
 	}
 
-	/* Nothing has been received from the remote Jingle peer yet */ 
+	/* Nothing has been received from the remote Jingle peer yet */
 	p->peercapability = 0;
 	p->peernoncodeccapability = 0;
 	p->jointcapability = 0;
@@ -878,7 +878,7 @@
 	jingle = iks_new("jingle");
 	reason = iks_new("reason");
 	cause = iks_new(causestring ? causestring : "gone");
-	
+
 	if (!iq || !jingle || !reason || !cause) {
 		ast_log(LOG_ERROR, "Memory allocation error\n");
 		goto safeout;
@@ -901,10 +901,10 @@
 
 safeout:
 	iks_delete(cause);
-	iks_delete(reason);	
+	iks_delete(reason);
 	iks_delete(jingle);
 	iks_delete(iq);
-	
+
 	return res;
 }
 
@@ -983,15 +983,15 @@
 	}
 
  	if (!strcasecmp(client->name, "guest")){
- 		/* the guest account is not tied to any configured XMPP client,
- 		   let's set it now */
- 		client->connection = ast_aji_get_client(from);
- 		if (!client->connection) {
- 			ast_log(LOG_ERROR, "No XMPP client to talk to, us (partial JID) : %s\n", from);
+		/* the guest account is not tied to any configured XMPP client,
+		   let's set it now */
+		client->connection = ast_aji_get_client(from);
+		if (!client->connection) {
+			ast_log(LOG_ERROR, "No XMPP client to talk to, us (partial JID) : %s\n", from);
 			jingle_response(client, pak, "service-unavailable", NULL);
- 			return -1;
- 		}
- 	}
+			return -1;
+		}
+	}
 
 	p = jingle_alloc(client, pak->from->partial, iks_find_attrib(pak->query, JINGLE_SID));
 	if (!p) {
@@ -1012,8 +1012,8 @@
 	if (iks_find_attrib(pak->query, JINGLE_SID)) {
 		ast_copy_string(p->sid, iks_find_attrib(pak->query, JINGLE_SID), sizeof(p->sid));
 	}
-	
-	/* content points to the first <content/> tag */	
+
+	/* content points to the first <content/> tag */
 	content = iks_child(iks_child(pak->x));
 	if (!content) {
 		ast_log(LOG_WARNING, "No content tag found, aborting\n");
@@ -1048,7 +1048,7 @@
 				codec = iks_next(codec);
 			}
 		}
-		
+
 		description = NULL;
 		codec = NULL;
 
@@ -1064,7 +1064,7 @@
 				codec = iks_next(codec);
 			}
 		}
-		
+
 		content = iks_next(content);
 	}
 
@@ -1085,7 +1085,7 @@
 	ast_mutex_unlock(&p->lock);
 	ast_setstate(chan, AST_STATE_RING);
 	res = ast_pbx_start(chan);
-	
+
 	switch (res) {
 	case AST_PBX_FAILED:
 		ast_log(LOG_WARNING, "Failed to start PBX :(\n");
@@ -1182,7 +1182,7 @@
 				newcandidate->protocol = AJI_PROTOCOL_UDP;
 			else if (!strcasecmp(iks_find_attrib(traversenodes, "protocol"), "ssltcp"))
 				newcandidate->protocol = AJI_PROTOCOL_SSLTCP;
-			
+
 			if (!strcasecmp(iks_find_attrib(traversenodes, "type"), "host"))
 				newcandidate->type = AJI_CONNECT_HOST;
 			else if (!strcasecmp(iks_find_attrib(traversenodes, "type"), "prflx"))
@@ -1194,7 +1194,7 @@
 
 			newcandidate->network = atoi(iks_find_attrib(traversenodes, "network"));
 			newcandidate->generation = atoi(iks_find_attrib(traversenodes, "generation"));
-		
+
 			newcandidate->next = p->theircandidates;
 			p->theircandidates = newcandidate;
 			p->laststun = 0;
@@ -1204,7 +1204,7 @@
 		traversenodes = iks_next(traversenodes);
 	}
 	ast_log(LOG_NOTICE, "Candidates parsed\n");
-	
+
 	receipt = iks_new("iq");
 	iks_insert_attrib(receipt, "type", "result");
 	iks_insert_attrib(receipt, "from", c->jid->full);
@@ -1597,7 +1597,7 @@
 			return NULL;
 		}
 	}
-       
+
 	ASTOBJ_WRLOCK(client);
 	p = jingle_alloc(client, to, NULL);
 	if (p) {

Modified: team/phsultan/jingle-support/include/asterisk/stun.h
URL: http://svnview.digium.com/svn/asterisk/team/phsultan/jingle-support/include/asterisk/stun.h?view=diff&rev=223054&r1=223053&r2=223054
==============================================================================
--- team/phsultan/jingle-support/include/asterisk/stun.h (original)
+++ team/phsultan/jingle-support/include/asterisk/stun.h Fri Oct  9 10:07:43 2009
@@ -56,7 +56,7 @@
  * \param s the socket used to send the request
  * \param dst the address of the STUN server
  * \param credentials if non null, use its members for STUN message integrity
- * 	checks, namely FINGERPRINT and MESSAGE_INTEGRITY.
+ * checks, namely FINGERPRINT and MESSAGE_INTEGRITY.
  * \param answer if non null, the function waits for a response and
  *    puts here the externally visible address.
  * \return 0 on success, other values on error.

Modified: team/phsultan/jingle-support/main/stun.c
URL: http://svnview.digium.com/svn/asterisk/team/phsultan/jingle-support/main/stun.c?view=diff&rev=223054&r1=223053&r2=223054
==============================================================================
--- team/phsultan/jingle-support/main/stun.c (original)
+++ team/phsultan/jingle-support/main/stun.c Fri Oct  9 10:07:43 2009
@@ -63,7 +63,7 @@
  * STUN is also used as a connectivity check method between two peers
  * like described by the ICE mechanism (required by the XMPP media protocol
  * Jingle). See http://tools.ietf.org/html/draft-ietf-mmusic-ice-19
- * 
+ *
  * All STUN packets start with a simple header made of a type,
  * length (excluding the header) and a 16-byte random transaction id.
  * Following the header we may have zero or more attributes, each
@@ -223,8 +223,8 @@
 		state->authreq |= AST_STUN_MESSAGE_INTEGRITY;
 		break;
 	case STUN_FINGERPRINT:
-		/* the advertized message length covers the STUN attributes 
-		 * only. Therefore, we need to add the STUN header length 
+		/* the advertized message length covers the STUN attributes
+		 * only. Therefore, we need to add the STUN header length
 		 * as well, which equals 20 bytes */
 		crc = crc32(0L, data, 20 + msglen - 8) ^ 0x5354554e;
 		memcpy(&rcrc, attr->value, sizeof(rcrc));
@@ -243,7 +243,7 @@
 	return 0;
 }
 
-/*! \brief append a string to a STUN message 
+/*! \brief append a string to a STUN message
  * STUN attributes length must be a multiple of 4 and must therefore be padded
  * with 1, 2 or 3 bytes if needed. Note that the STUN message length reflects
  * the actual size (padding bytes included) whereas the length advertized in the
@@ -461,7 +461,7 @@
 			break;
 		case STUN_BINDRESP:
 			/* TODO : We need to handle responses too */
-			break;	
+			break;
 		default:
 			if (stundebug)
 				ast_verbose("Dunno what to do with STUN message %04x (%s)\n", ntohs(hdr->msgtype), stun_msg2str(ntohs(hdr->msgtype)));
@@ -521,11 +521,11 @@
 	req->msglen = 0;
 	attr = (struct stun_attr *)req->ies;
 	if (credentials) {
-		/* username is "remote_ufrag:local_ufrag" for STUN requests */ 
+		/* username is "remote_ufrag:local_ufrag" for STUN requests */
 		snprintf(username, sizeof(username), "%s:%s", credentials->remote_ufrag, credentials->local_ufrag);
 		append_attr_string(&attr, STUN_USERNAME, username, &reqlen, &reqleft);
 
-		if (!ast_strlen_zero(credentials->remote_password)) { 
+		if (!ast_strlen_zero(credentials->remote_password)) {
 			/* fill the STUN packet with a dummy STUN_MESSAGE_INTEGRITY
 			 * attribute, update packet length before computing the HMAC,
 			 * and replace the dummy value with the result.

Modified: team/phsultan/jingle-support/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/phsultan/jingle-support/res/res_rtp_asterisk.c?view=diff&rev=223054&r1=223053&r2=223054
==============================================================================
--- team/phsultan/jingle-support/res/res_rtp_asterisk.c (original)
+++ team/phsultan/jingle-support/res/res_rtp_asterisk.c Fri Oct  9 10:07:43 2009
@@ -1551,7 +1551,7 @@
 
 	/* Handle STUN packets */
 	if ((rtcpheader[0] & 0xC0000000) == 0) {
-		ast_stun_handle_packet(rtp->rtcp->s, &sin, rtcpdata + AST_FRIENDLY_OFFSET, res, NULL, NULL, credentials);
+		ast_stun_handle_packet(rtp->rtcp->s, &sin, (unsigned char *)rtcpdata + AST_FRIENDLY_OFFSET, res, NULL, NULL, credentials);
 		return &ast_null_frame;
 	}
 

Modified: team/phsultan/jingle-support/res/res_rtp_multicast.c
URL: http://svnview.digium.com/svn/asterisk/team/phsultan/jingle-support/res/res_rtp_multicast.c?view=diff&rev=223054&r1=223053&r2=223054
==============================================================================
--- team/phsultan/jingle-support/res/res_rtp_multicast.c (original)
+++ team/phsultan/jingle-support/res/res_rtp_multicast.c Fri Oct  9 10:07:43 2009
@@ -92,7 +92,7 @@
 static int multicast_rtp_activate(struct ast_rtp_instance *instance);
 static int multicast_rtp_destroy(struct ast_rtp_instance *instance);
 static int multicast_rtp_write(struct ast_rtp_instance *instance, struct ast_frame *frame);
-static struct ast_frame *multicast_rtp_read(struct ast_rtp_instance *instance, int rtcp);
+static struct ast_frame *multicast_rtp_read(struct ast_rtp_instance *instance, int rtcp, struct stun_credentials *credentials);
 
 /* RTP Engine Declaration */
 static struct ast_rtp_engine multicast_rtp_engine = {
@@ -237,7 +237,7 @@
 }
 
 /*! \brief Function called to read from a multicast instance */
-static struct ast_frame *multicast_rtp_read(struct ast_rtp_instance *instance, int rtcp)
+static struct ast_frame *multicast_rtp_read(struct ast_rtp_instance *instance, int rtcp, struct stun_credentials *credentials)
 {
 	return &ast_null_frame;
 }




More information about the svn-commits mailing list