[Asterisk-cvs] asterisk/channels chan_sip.c, 1.614, 1.615 chan_iax2.c, 1.230, 1.231

markster at lists.digium.com markster at lists.digium.com
Wed Jan 5 17:00:52 CST 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv20921/channels

Modified Files:
	chan_sip.c chan_iax2.c 
Log Message:
More flagification (bug #3254)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.614
retrieving revision 1.615
diff -u -d -r1.614 -r1.615
--- chan_sip.c	5 Jan 2005 15:15:12 -0000	1.614
+++ chan_sip.c	5 Jan 2005 23:05:49 -0000	1.615
@@ -311,7 +311,7 @@
 	unsigned int callgroup;			/* Call group */
 	unsigned int pickupgroup;		/* Pickup group */
 	int lastinvite;				/* Last Cseq of invite */
-	int flags;				/* SIP_ flags */	
+	unsigned int flags;			/* SIP_ flags */	
 	int capability;				/* Special capability (codec) */
 	int jointcapability;			/* Supported capability at both ends (codecs ) */
 	int peercapability;			/* Supported peer capability */
@@ -406,7 +406,7 @@
 	struct sip_pkt *next;				/* Next packet */
 	int retrans;					/* Retransmission number */
 	int seqno;					/* Sequence number */
-	int flags;					/* non-zero if this is a response packet (e.g. 200 OK) */
+	unsigned int flags;				/* non-zero if this is a response packet (e.g. 200 OK) */
 	struct sip_pvt *owner;				/* Owner call */
 	int retransid;					/* Retransmission ID */
 	int packetlen;					/* Length of packet */
@@ -429,7 +429,7 @@
 	struct ast_codec_pref prefs; /* codec prefs */
 	unsigned int callgroup;		/* Call group */
 	unsigned int pickupgroup;	/* Pickup Group */
-	int flags;			/* SIP_ flags */	
+	unsigned int flags;		/* SIP_ flags */	
 	int amaflags;			/* AMA flags for billing */
 	int callingpres;		/* Calling id presentation */
 	int capability;			/* Codec capability */
@@ -462,7 +462,7 @@
 	struct ast_codec_pref prefs; /* codec prefs */
 	int lastmsgssent;
 	time_t	lastmsgcheck;		/* Last time we checked for MWI */
-	int flags;			/* SIP_ flags */	
+	unsigned int flags;		/* SIP_ flags */	
 	int expire;			/* Registration expiration */
 	int expiry;
 	int capability;			/* Codec capability */
@@ -718,10 +718,10 @@
 		__sip_xmit(pkt->owner, pkt->data, pkt->packetlen);
 		res = 1;
 	} else {
-		ast_log(LOG_WARNING, "Maximum retries exceeded on call %s for seqno %d (%s %s)\n", pkt->owner->callid, pkt->seqno, (pkt->flags & FLAG_FATAL) ? "Critical" : "Non-critical", (pkt->flags & FLAG_RESPONSE) ? "Response" : "Request");
-		append_history(pkt->owner, "MaxRetries", pkt->flags & FLAG_FATAL ? "(Critical)" : "(Non-critical)");
+		ast_log(LOG_WARNING, "Maximum retries exceeded on call %s for seqno %d (%s %s)\n", pkt->owner->callid, pkt->seqno, (ast_test_flag(pkt, FLAG_FATAL)) ? "Critical" : "Non-critical", (ast_test_flag(pkt, FLAG_RESPONSE)) ? "Response" : "Request");
+		append_history(pkt->owner, "MaxRetries", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)");
 		pkt->retransid = -1;
-		if (pkt->flags & FLAG_FATAL) {
+		if (ast_test_flag(pkt, FLAG_FATAL)) {
 			while(pkt->owner->owner && ast_mutex_trylock(&pkt->owner->owner->lock)) {
 				ast_mutex_unlock(&pkt->owner->lock);
 				usleep(1);
@@ -777,7 +777,7 @@
 	pkt->flags = resp;
 	pkt->data[len] = '\0';
 	if (fatal)
-		pkt->flags |= FLAG_FATAL;
+		ast_set_flag(pkt, FLAG_FATAL);
 	/* Schedule retransmission */
 	pkt->retransid = ast_sched_add(sched, DEFAULT_RETRANS, retrans_pkt, pkt);
 	pkt->next = p->packets;
@@ -842,8 +842,8 @@
 	if (!msg) msg = "___NEVER___";
 	cur = p->packets;
 	while(cur) {
-		if ((cur->seqno == seqno) && ((cur->flags & FLAG_RESPONSE) == resp) &&
-			((cur->flags & FLAG_RESPONSE) || 
+		if ((cur->seqno == seqno) && ((ast_test_flag(cur, FLAG_RESPONSE)) == resp) &&
+			((ast_test_flag(cur, FLAG_RESPONSE)) || 
 			 (!strncasecmp(msg, cur->data, strlen(msg)) && (cur->data[strlen(msg)] < 33)))) {
 			if (!resp && (seqno == p->pendinginvite)) {
 				ast_log(LOG_DEBUG, "Acked pending invite %d\n", p->pendinginvite);
@@ -872,7 +872,7 @@
 static int __sip_pretend_ack(struct sip_pvt *p)
 {
 	while(p->packets) {
-		__sip_ack(p, p->packets->seqno, (p->packets->flags & FLAG_RESPONSE), p->packets->data);
+		__sip_ack(p, p->packets->seqno, (ast_test_flag(p->packets, FLAG_RESPONSE)), p->packets->data);
 	}
 	return 0;
 }
@@ -884,8 +884,8 @@
 	int res = -1;
 	cur = p->packets;
 	while(cur) {
-		if ((cur->seqno == seqno) && ((cur->flags & FLAG_RESPONSE) == resp) &&
-			((cur->flags & FLAG_RESPONSE) || 
+		if ((cur->seqno == seqno) && ((ast_test_flag(cur, FLAG_RESPONSE)) == resp) &&
+			((ast_test_flag(cur, FLAG_RESPONSE)) || 
 			 (!strncasecmp(msg, cur->data, strlen(msg)) && (cur->data[strlen(msg)] < 33)))) {
 			/* this is our baby */
 			if (cur->retransid > -1)

Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.230
retrieving revision 1.231
diff -u -d -r1.230 -r1.231
--- chan_iax2.c	29 Dec 2004 23:02:21 -0000	1.230
+++ chan_iax2.c	5 Jan 2005 23:05:49 -0000	1.231
@@ -212,7 +212,7 @@
 	char inkeys[80];				/* Key(s) this user can use to authenticate to us */
 	char language[MAX_LANGUAGE];
 	int amaflags;
-	int flags;
+	unsigned int flags;
 	int capability;
 	char cid_num[AST_MAX_EXTENSION];
 	char cid_name[AST_MAX_EXTENSION];
@@ -235,7 +235,7 @@
 	struct sockaddr_in addr;
 	int formats;
 	struct in_addr mask;
-	int flags;
+	unsigned int flags;
 
 	/* Dynamic Registration fields */
 	struct sockaddr_in defaddr;			/* Default address if there is one */
@@ -450,7 +450,7 @@
 	/* Associated peer for poking */
 	struct iax2_peer *peerpoke;
 	/* IAX_ flags */
-	int flags;
+	unsigned int flags;
 
 	/* Transferring status */
 	int transferring;




More information about the svn-commits mailing list