[svn-commits] oej: branch oej/darjeeling-prack-1.8 r369619 - in /team/oej/darjeeling-prack-...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 5 04:09:10 CDT 2012


Author: oej
Date: Thu Jul  5 04:09:05 2012
New Revision: 369619

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369619
Log:
Making sure that all instances of the rseq is uint32_t and handled that way.


Modified:
    team/oej/darjeeling-prack-1.8/channels/chan_sip.c
    team/oej/darjeeling-prack-1.8/channels/sip/include/dialog.h

Modified: team/oej/darjeeling-prack-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/chan_sip.c?view=diff&rev=369619&r1=369618&r2=369619
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/chan_sip.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/chan_sip.c Thu Jul  5 04:09:05 2012
@@ -3970,7 +3970,7 @@
 
 /*! \brief Acknowledges receipt of a packet and stops retransmission
  * called with p locked*/
-int __sip_ack(struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod, int rseqno)
+int __sip_ack(struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod, uint32_t rseqno)
 {
 	struct sip_pkt *cur, *prev = NULL;
 	const char *msg = "Not Found";	/* used only for debugging */
@@ -4210,8 +4210,8 @@
 			add_header(req, "Rseq", buf);
 			req->rseqno = p->rseq;
 			req->reqsipoptions |= SIP_OPT_100REL;
-			append_history(p, "PRACK", "PRACK Required: Our Rseq %d", p->rseq);
-			ast_debug(2, "=!=!=!=!=!=!=!= PRACK USED HERE. Rseq %d \n", p->rseq);
+			append_history(p, "PRACK", "PRACK Required: Our Rseq %u", p->rseq);
+			ast_debug(2, "=!=!=!=!=!=!=!= PRACK USED HERE. Rseq %u \n", p->rseq);
 		} else {
 			ast_debug(2, "=!=!=!=!=!=!=!= PRACK COULD BE USED HERE. Exactly HERE\n");
 		}
@@ -12309,17 +12309,17 @@
 /*! 
  * \brief transmit SIP PRACK as a response to a provisional response with a Rseq and Require: 100rel header 
  */
-static int transmit_prack(struct sip_pvt *p, int their_rseq)
+static int transmit_prack(struct sip_pvt *p, uint32_t their_rseq)
 {
 	if (their_rseq == p->irseq) {
-		ast_debug(3, "!?!?!?!?!? This is a retransmit of the previous response. %d \n", their_rseq);
+		ast_debug(3, "!?!?!?!?!? This is a retransmit of the previous response. %u \n", their_rseq);
 		/* RFC 3262: In particular, a UAC SHOULD NOT retransmit the PRACK request
    		   	when it receives a retransmission of the provisional response being
    		   	acknowledged, although doing so does not create a protocol error.*/
 		return -2;	/* Not used by transmit_invite et al */
 	}
 	if (p->irseq > 0 && their_rseq != p->irseq + 1) {
-		ast_debug(3, "!?!?!?!?!? This is a response out of sequence! ignored. %d \n", their_rseq);
+		ast_debug(3, "!?!?!?!?!? This is a response out of sequence! ignored. %u \n", their_rseq);
 		/* RFC 3262: if the UAC receives another reliable provisional
    			response to the same request, and its RSeq value is not one higher
    			than the value of the sequence number, that response MUST NOT be
@@ -12392,7 +12392,7 @@
 		/* Place holder */
 		/* Add headers for PRACK */
 		char buf[SIPBUFSIZE/2];
-		snprintf(buf, sizeof(buf), "%d %d %s", p->irseq, p->lastinvite, "INVITE");
+		snprintf(buf, sizeof(buf), "%u %u %s", p->irseq, p->lastinvite, "INVITE");
 		add_header(&req, "RAck", buf);
 	}
 
@@ -21349,14 +21349,14 @@
 		if (activeextensions & SIP_OPT_100REL) {
 
 			const char *rseq = get_header(req, "RSeq");
-			int their_rseq;
+			uint32_t their_rseq;
 			int res;
 			ast_debug(3, "!=!=!=!=!=! Response relies on PRACK! Rseq %s\n", rseq);
 
 			/* XXX If the response relies on PRACK, we need to start a PRACK transaction
 			 */
 			sscanf(get_header(req, "RSeq"), "%30u ", &their_rseq);
-			append_history(p, "TxPrack", "Their Rseq %d\n", their_rseq);
+			append_history(p, "TxPrack", "Their Rseq %u\n", their_rseq);
 			parse_ok_contact(p, req);
 			build_route(p, req, 1, resp);
 			
@@ -22550,19 +22550,19 @@
 static int handle_request_prack(struct sip_pvt *p, struct sip_request *req)
 {
 	const char *rack = get_header(req, "RAck");
-	int rseq, cseq;
-
-	if(sscanf(rack, "%30d %30d", &rseq, &cseq) != 2) {
+	uint32_t rseq, cseq;
+
+	if(sscanf(rack, "%30u %30u", &rseq, &cseq) != 2) {
 		/* we did not get proper rseq/cseq */
 		transmit_response(p, "481 Could not get proper rseq/cseq in Rack", req);
 	}
-	ast_debug(3, "!=!=!=!=!=!= Got PRACK with rseq %d and cseq %d \n", rseq, cseq);
+	ast_debug(3, "!=!=!=!=!=!= Got PRACK with rseq %u and cseq %u \n", rseq, cseq);
 	if (rseq <= p->rseq) {
 		/* Ack the retransmits */
 		int acked = __sip_ack(p, cseq, 1 /* response */, 0, rseq);
 		ast_debug(2, "!=!=!=!=!=! Tried acking the response - %s \n", acked ? "Sucess" : "Total utterly failure");
 	}
-	append_history(p, "PRACK", "PRACK received Rseq %d", rseq);
+	append_history(p, "PRACK", "PRACK received Rseq %u", rseq);
 	transmit_response(p, "200 OK", req);
 	if (ast_test_flag(&p->flags[2], SIP_PAGE3_ANSWER_WAIT_FOR_PRACK)) {
 		/* If the response sent reliably contained an SDP, we're not allowed to  answer

Modified: team/oej/darjeeling-prack-1.8/channels/sip/include/dialog.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/sip/include/dialog.h?view=diff&rev=369619&r1=369618&r2=369619
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/sip/include/dialog.h (original)
+++ team/oej/darjeeling-prack-1.8/channels/sip/include/dialog.h Thu Jul  5 04:09:05 2012
@@ -67,7 +67,7 @@
 
 /*! \brief Acknowledges receipt of a packet and stops retransmission
  * called with p locked*/
-int __sip_ack(struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod, int rseqno);
+int __sip_ack(struct sip_pvt *p, uint32_t seqno, int resp, int sipmethod, uint32_t rseqno);
 
 /*! \brief Pretend to ack all packets
  * called with p locked */




More information about the svn-commits mailing list