[asterisk-commits] wedhorn: trunk r318018 - /trunk/channels/chan_skinny.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 6 17:32:48 CDT 2011


Author: wedhorn
Date: Fri May  6 17:32:45 2011
New Revision: 318018

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=318018
Log:
Rename sub->parent to sub->line.

Improve readability of code, eg, (sub->parent == d->activeline) becomes
(sub->line == d->activeline).

Modified:
    trunk/channels/chan_skinny.c

Modified: trunk/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=318018&r1=318017&r2=318018
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Fri May  6 17:32:45 2011
@@ -1217,7 +1217,7 @@
 
 	AST_LIST_ENTRY(skinny_subchannel) list;
 	struct skinny_subchannel *related;
-	struct skinny_line *parent;
+	struct skinny_line *line;
 };
 
 #define SKINNY_LINE_OPTIONS				\
@@ -2270,7 +2270,7 @@
 	char *toname;
 	char *tonum;
 
-	if (!sub || !(l=sub->parent) || !(d=sub->parent->device) || !(ast=sub->owner)) {
+	if (!sub || !(l=sub->line) || !(d=l->device) || !(ast=sub->owner)) {
 		return;
 	}
 
@@ -2309,7 +2309,7 @@
 static void transmit_connect(struct skinny_device *d, struct skinny_subchannel *sub)
 {
 	struct skinny_req *req;
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct ast_format_list fmt;
 	struct ast_format tmpfmt;
 
@@ -2839,7 +2839,7 @@
 static void update_connectedline(struct skinny_subchannel *sub, const void *data, size_t datalen)
 {
 	struct ast_channel *c = sub->owner;
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 
 	if (!c->caller.id.number.valid
@@ -2947,7 +2947,7 @@
 	ao2_ref(sub->rtp, +1);
 	*instance = sub->rtp;
 
-	l = sub->parent;
+	l = sub->line;
 
 	if (!l->directmedia || l->nat){
 		res = AST_RTP_GLUE_RESULT_LOCAL;
@@ -2981,7 +2981,7 @@
 		return -1;
 	}
 
-	l = sub->parent;
+	l = sub->line;
 	d = l->device;
 
 	if (rtp){
@@ -3863,7 +3863,7 @@
 
 static void start_rtp(struct skinny_subchannel *sub)
 {
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 	int hasvideo = 0;
 	struct ast_sockaddr bindaddr_tmp;
@@ -3911,7 +3911,7 @@
 {
 	struct ast_channel *c = data;
 	struct skinny_subchannel *sub = c->tech_pvt;
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 	int res = 0;
 
@@ -3944,7 +3944,7 @@
 {
 	struct ast_channel *c = data;
 	struct skinny_subchannel *sub = c->tech_pvt;
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 	int len = 0;
 	int timeout = firstdigittimeout;
@@ -4048,7 +4048,7 @@
 {
 	int res = 0;
 	struct skinny_subchannel *sub = ast->tech_pvt;
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 
 	if (!d->registered) {
@@ -4089,7 +4089,7 @@
 		return 0;
 	}
 
-	l = sub->parent;
+	l = sub->line;
 	d = l->device;
 
 	if (skinnydebug)
@@ -4147,7 +4147,7 @@
 			transmit_activatecallplane(d, l);
 			l->activesub = NULL;
 			transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_OFF);
-			if (sub->parent == d->activeline) {
+			if (sub->line == d->activeline) {
 				transmit_activatecallplane(d, l);
 				transmit_closereceivechannel(d, sub);
 				transmit_stopmediatransmission(d, sub);
@@ -4177,7 +4177,7 @@
 {
 	int res = 0;
 	struct skinny_subchannel *sub = ast->tech_pvt;
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 
 	if (sub->blindxfer) {
@@ -4310,7 +4310,7 @@
 {
 #if 0
 	struct skinny_subchannel *sub = ast->tech_pvt;
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 	int tmp;
 	/* not right */
@@ -4482,7 +4482,7 @@
 static int skinny_indicate(struct ast_channel *ast, int ind, const void *data, size_t datalen)
 {
 	struct skinny_subchannel *sub = ast->tech_pvt;
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 	struct skinnysession *s = d->session;
 
@@ -4570,7 +4570,7 @@
 			d->lastcallreference = sub->callid;
 			sub->cxmode = SKINNY_CX_INACTIVE;
 			sub->nat = l->nat;
-			sub->parent = l;
+			sub->line = l;
 			sub->blindxfer = 0;
 			sub->xferor = 0;
 			sub->related = NULL;
@@ -4690,7 +4690,7 @@
 
 static void setsubstate_offhook(struct skinny_subchannel *sub)
 {
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 	pthread_t t;
 
@@ -4715,7 +4715,7 @@
 
 static void setsubstate_dialing(struct skinny_subchannel *sub, char exten[AST_MAX_EXTENSION])
 {
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 	struct ast_channel *c = sub->owner;
 	pthread_t t;
@@ -4749,7 +4749,7 @@
 
 static void setsubstate_ringout(struct skinny_subchannel *sub)
 {
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 
 	if (!(sub->substate == SUBSTATE_DIALING || sub->substate == SUBSTATE_PROGRESS)) {
@@ -4760,7 +4760,7 @@
 	if (!d->earlyrtp) {
 		transmit_start_tone(d, SKINNY_ALERT, l->instance, sub->callid);
 	}
-	transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_RINGOUT);
+	transmit_callstate(d, l->instance, sub->callid, SKINNY_RINGOUT);
 	transmit_dialednumber(d, l->lastnumberdialed, l->instance, sub->callid);
 	transmit_displaypromptstatus(d, "Ring Out", 0, l->instance, sub->callid);
 	transmit_callinfo(sub);
@@ -4769,11 +4769,11 @@
 
 static void setsubstate_ringin(struct skinny_subchannel *sub)
 {
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 	struct ast_channel *c = sub->owner;
 
-	transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_RINGIN);
+	transmit_callstate(d, l->instance, sub->callid, SKINNY_RINGIN);
 	transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_RINGIN);
 	transmit_displaypromptstatus(d, "Ring-In", 0, l->instance, sub->callid);
 	transmit_callinfo(sub);
@@ -4791,7 +4791,7 @@
 
 static void setsubstate_connected(struct skinny_subchannel *sub)
 {
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 	
 	if (sub->substate == SUBSTATE_HOLD) {
@@ -4801,7 +4801,7 @@
 	transmit_activatecallplane(d, l);
 	transmit_stop_tone(d, l->instance, sub->callid);
 	transmit_callinfo(sub);
-	transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_CONNECTED);
+	transmit_callstate(d, l->instance, sub->callid, SKINNY_CONNECTED);
 	transmit_displaypromptstatus(d, "Connected", 0, l->instance, sub->callid);
 	transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_CONNECTED);
 	if (!sub->rtp) {
@@ -4822,7 +4822,7 @@
 
 static void setsubstate_busy(struct skinny_subchannel *sub)
 {
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 
 	if (!(sub->substate == SUBSTATE_DIALING || sub->substate == SUBSTATE_PROGRESS || sub->substate == SUBSTATE_RINGOUT)) {
@@ -4834,14 +4834,14 @@
 		transmit_start_tone(d, SKINNY_BUSYTONE, l->instance, sub->callid);
 	}
 	transmit_callinfo(sub);
-	transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_BUSY);
+	transmit_callstate(d, l->instance, sub->callid, SKINNY_BUSY);
 	transmit_displaypromptstatus(d, "Busy", 0, l->instance, sub->callid);
 	sub->substate = SUBSTATE_BUSY;
 }
 
 static void setsubstate_congestion(struct skinny_subchannel *sub)
 {
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 
 	if (!(sub->substate == SUBSTATE_DIALING || sub->substate == SUBSTATE_PROGRESS || sub->substate == SUBSTATE_RINGOUT)) {
@@ -4853,14 +4853,14 @@
 		transmit_start_tone(d, SKINNY_REORDER, l->instance, sub->callid);
 	}
 	transmit_callinfo(sub);
-	transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_CONGESTION);
+	transmit_callstate(d, l->instance, sub->callid, SKINNY_CONGESTION);
 	transmit_displaypromptstatus(d, "Congestion", 0, l->instance, sub->callid);
 	sub->substate = SUBSTATE_CONGESTION;
 }
 
 static void setsubstate_progress(struct skinny_subchannel *sub)
 {
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 
 	if (sub->substate != SUBSTATE_DIALING) {
@@ -4872,14 +4872,14 @@
 		transmit_start_tone(d, SKINNY_ALERT, l->instance, sub->callid);
 	}
 	transmit_callinfo(sub);
-	transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_PROGRESS);
+	transmit_callstate(d, l->instance, sub->callid, SKINNY_PROGRESS);
 	transmit_displaypromptstatus(d, "Call Progress", 0, l->instance, sub->callid);
 	sub->substate = SUBSTATE_PROGRESS;
 }
 
 static void setsubstate_hold(struct skinny_subchannel *sub)
 {
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 
 	if (sub->substate != SUBSTATE_CONNECTED) {
@@ -4895,9 +4895,9 @@
 	transmit_closereceivechannel(d, sub);
 	transmit_stopmediatransmission(d, sub);
 
-	transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_HOLD);
+	transmit_callstate(d, l->instance, sub->callid, SKINNY_HOLD);
 	transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_WINK);
-	transmit_selectsoftkeys(sub->parent->device, sub->parent->instance, sub->callid, KEYDEF_ONHOLD);
+	transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_ONHOLD);
 	sub->substate = SUBSTATE_HOLD;
 }
 
@@ -4930,7 +4930,7 @@
 		return -1;
 	}
 
-	l = sub->parent;
+	l = sub->line;
 	d = l->device;
 
 	if (!sub->related) {
@@ -4973,7 +4973,7 @@
 
 static int handle_callforward_button(struct skinny_subchannel *sub, int cfwdtype)
 {
-	struct skinny_line *l = sub->parent;
+	struct skinny_line *l = sub->line;
 	struct skinny_device *d = l->device;
 	struct ast_channel *c = sub->owner;
 
@@ -5060,7 +5060,7 @@
 	if (!sub)
 		return 0;
 
-	l = sub->parent;
+	l = sub->line;
 	if (sub->owner) {
 		if (sub->owner->_state == 0) {
 			f.frametype = AST_FRAME_DTMF_BEGIN;
@@ -5113,7 +5113,7 @@
 		}
 		sub = l->activesub;
 	} else {
-		l = sub->parent;
+		l = sub->line;
 	}
 
 	switch(event) {
@@ -5131,7 +5131,7 @@
 			ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n", l->name, d->name);
 		} else {
 			sub = c->tech_pvt;
-			l = sub->parent;
+			l = sub->line;
 			l->activesub = sub;
 			setsubstate_dialing(sub, l->lastnumberdialed);
 		}
@@ -5155,7 +5155,7 @@
 			ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n", l->name, d->name);
 		} else {
 			sub = c->tech_pvt;
-			l = sub->parent;
+			l = sub->line;
 			l->activesub = sub;
 			
 			setsubstate_dialing(sub, sd->exten);
@@ -5193,7 +5193,7 @@
 			ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n", l->name, d->name);
 		} else {
 			sub = c->tech_pvt;
-			l = sub->parent;
+			l = sub->line;
 			l->activesub = sub;
 			
 			setsubstate_dialing(sub,l->vmexten);
@@ -5373,7 +5373,7 @@
 				return 0;
 			}
 		} else {
-			l = sub->parent;
+			l = sub->line;
 		}
 	} else {
 		l = d->activeline;
@@ -5428,7 +5428,7 @@
 		if (!sub) {
 			return 0;
 		}
-		l = sub->parent;
+		l = sub->line;
 	} else {
 		l = d->activeline;
 		sub = l->activesub;
@@ -5726,7 +5726,7 @@
 	if (!sub)
 		return 0;
 
-	l = sub->parent;
+	l = sub->line;
 
 	if (sub->rtp) {
 		ast_sockaddr_from_sin(&sin_tmp, &sin);
@@ -5772,7 +5772,7 @@
 			return 0;
 		}
 	} else {
-		l = sub->parent;
+		l = sub->line;
 	}
 
 	c = skinny_new(l, AST_STATE_DOWN, NULL, SKINNY_OUTGOING);
@@ -7153,7 +7153,7 @@
 						ast_mutex_lock(&l->lock);
 						l->sub = ltemp->sub;
 						AST_LIST_TRAVERSE(&l->sub, sub, list) {
-							sub->parent = l;
+							sub->line = l;
 						}
 						ast_mutex_unlock(&l->lock);
 					}




More information about the asterisk-commits mailing list