[libpri-commits] rmudgett: branch group/issue14068 r825 - in /team/group/issue14068: ./ q931.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Fri May 29 10:45:17 CDT 2009


Author: rmudgett
Date: Fri May 29 10:45:12 2009
New Revision: 825

URL: http://svn.asterisk.org/svn-view/libpri?view=rev&rev=825
Log:
Merged revisions 824 via svnmerge from 
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r824 | rmudgett | 2009-05-29 10:39:48 -0500 (Fri, 29 May 2009) | 5 lines
  
  Renamed local struct pri *pri variables to struct pri *ctrl in q931.c.
  
  The context tagging for my editor is much happier now that the struct and the
  variable do not have the same name.  (At least for this file.)
........

Modified:
    team/group/issue14068/   (props changed)
    team/group/issue14068/q931.c

Propchange: team/group/issue14068/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May 29 10:45:12 2009
@@ -1,1 +1,1 @@
-/branches/1.4:1-807
+/branches/1.4:1-824

Modified: team/group/issue14068/q931.c
URL: http://svn.asterisk.org/svn-view/libpri/team/group/issue14068/q931.c?view=diff&rev=825&r1=824&r2=825
==============================================================================
--- team/group/issue14068/q931.c (original)
+++ team/group/issue14068/q931.c Fri May 29 10:45:12 2009
@@ -91,13 +91,13 @@
 	{ Q931_SUSPEND_ACKNOWLEDGE, "SUSPEND ACKNOWLEDGE" },
 	{ Q931_SUSPEND_REJECT, "SUSPEND REJECT" },
 };
-static int post_handle_q931_message(struct pri *pri, struct q931_mh *mh, struct q931_call *c, int missingmand);
+static int post_handle_q931_message(struct pri *ctrl, struct q931_mh *mh, struct q931_call *c, int missingmand);
 
 struct msgtype maintenance_msgs[] = {
 	{ NATIONAL_SERVICE, "SERVICE", { Q931_CHANNEL_IDENT } },
 	{ NATIONAL_SERVICE_ACKNOWLEDGE, "SERVICE ACKNOWLEDGE", { Q931_CHANNEL_IDENT } },
 };
-static int post_handle_maintenance_message(struct pri *pri, struct q931_mh *mh, struct q931_call *c);
+static int post_handle_maintenance_message(struct pri *ctrl, struct q931_mh *mh, struct q931_call *c);
 
 static struct msgtype causes[] = {
 	{ PRI_CAUSE_UNALLOCATED, "Unallocated (unassigned) number" },
@@ -227,15 +227,15 @@
 
 #if 1
 /* Update call state with transition trace. */
-#define UPDATE_OURCALLSTATE(pri,c,newstate) do {\
-	if (pri->debug & (PRI_DEBUG_Q931_STATE) && c->ourcallstate != newstate) \
-		pri_message(pri, DBGHEAD "call %d on channel %d enters state %d (%s)\n", DBGINFO, \
+#define UPDATE_OURCALLSTATE(ctrl,c,newstate) do {\
+	if (ctrl->debug & (PRI_DEBUG_Q931_STATE) && c->ourcallstate != newstate) \
+		pri_message(ctrl, DBGHEAD "call %d on channel %d enters state %d (%s)\n", DBGINFO, \
 		            c->cr, c->channelno, newstate, callstate2str(newstate)); \
 	c->ourcallstate = newstate; \
 	} while (0)
 #else
 /* Update call state with no trace. */
-#define UPDATE_OURCALLSTATE(pri,c,newstate) c->ourcallstate = newstate
+#define UPDATE_OURCALLSTATE(ctrl,c,newstate) c->ourcallstate = newstate
 #endif
 
 struct ie {
@@ -418,18 +418,18 @@
 	return res;
 }
 
-static int receive_channel_id(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+static int receive_channel_id(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {	
 	int x;
 	int pos=0;
 #ifdef NO_BRI_SUPPORT
  	if (!ie->data[0] & 0x20) {
-		pri_error(pri, "!! Not PRI type!?\n");
+		pri_error(ctrl, "!! Not PRI type!?\n");
  		return -1;
  	}
 #endif
 #ifndef NOAUTO_CHANNEL_SELECTION_SUPPORT
-	if (pri->bri) {
+	if (ctrl->bri) {
 		if (!(ie->data[0] & 3))
 			call->justsignalling = 1;
 		else
@@ -442,7 +442,7 @@
 			case 1:
 				break;
 			default:
-				pri_error(pri, "!! Unexpected Channel selection %d\n", ie->data[0] & 3);
+				pri_error(ctrl, "!! Unexpected Channel selection %d\n", ie->data[0] & 3);
 				return -1;
 		}
 	}
@@ -463,11 +463,11 @@
 	if (pos+2 < len) {
 		/* More coming */
 		if ((ie->data[pos] & 0x0f) != 3) {
-			pri_error(pri, "!! Unexpected Channel Type %d\n", ie->data[1] & 0x0f);
+			pri_error(ctrl, "!! Unexpected Channel Type %d\n", ie->data[1] & 0x0f);
 			return -1;
 		}
 		if ((ie->data[pos] & 0x60) != 0) {
-			pri_error(pri, "!! Invalid CCITT coding %d\n", (ie->data[1] & 0x60) >> 5);
+			pri_error(ctrl, "!! Invalid CCITT coding %d\n", (ie->data[1] & 0x60) >> 5);
 			return -1;
 		}
 		if (ie->data[pos] & 0x10) {
@@ -483,7 +483,7 @@
 			pos++;
 			/* Only expect a particular channel */
 			call->channelno = ie->data[pos] & 0x7f;
-			if (pri->chan_mapping_logical && call->channelno > 15)
+			if (ctrl->chan_mapping_logical && call->channelno > 15)
 				call->channelno++;
 			return 0;
 		}
@@ -492,7 +492,7 @@
 	return -1;
 }
 
-static int transmit_channel_id(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_channel_id(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	int pos=0;
 
@@ -508,9 +508,9 @@
 	}
 		
 	/* Start with standard stuff */
-	if (pri->switchtype == PRI_SWITCH_GR303_TMC)
+	if (ctrl->switchtype == PRI_SWITCH_GR303_TMC)
 		ie->data[pos] = 0x69;
-	else if (pri->bri) {
+	else if (ctrl->bri) {
 		ie->data[pos] = 0x80;
 		if (call->channelno > -1)
 			ie->data[pos] |= (call->channelno & 0x3);
@@ -524,7 +524,7 @@
 		return 0;
 	}
 
-	if (((pri->switchtype != PRI_SWITCH_QSIG) && (call->ds1no > 0)) || call->ds1explicit) {
+	if (((ctrl->switchtype != PRI_SWITCH_QSIG) && (call->ds1no > 0)) || call->ds1explicit) {
 		/* Note that we are specifying the identifier */
 		ie->data[pos++] |= 0x40;
 		/* We need to use the Channel Identifier Present thingy.  Just specify it and we're done */
@@ -532,7 +532,7 @@
 	} else
 		pos++;
 
-	if (pri->bri)
+	if (ctrl->bri)
 		return pos + 2;
 
 	if ((call->channelno > -1) || (call->slotmap != -1)) {
@@ -540,7 +540,7 @@
 		ie->data[pos++] = 0x83;
 		if (call->channelno > -1) {
 			/* Channel number specified */
-			if (pri->chan_mapping_logical && call->channelno > 16)
+			if (ctrl->chan_mapping_logical && call->channelno > 16)
 				ie->data[pos++] = 0x80 | (call->channelno - 1);
 			else
 				ie->data[pos++] = 0x80 | call->channelno;
@@ -559,11 +559,11 @@
 		/* We're done */
 		return pos + 2;
 	}
-	pri_error(pri, "!! No channel map, no channel, and no ds1?  What am I supposed to identify?\n");
+	pri_error(ctrl, "!! No channel map, no channel, and no ds1?  What am I supposed to identify?\n");
 	return -1;
 }
 
-static void dump_channel_id(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_channel_id(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	int pos=0;
 	int x;
@@ -573,31 +573,31 @@
 		"No channel selected", "As indicated in following octets", "Reserved","Any channel selected"
 	};
 
-	pri_message(pri, "%c Channel ID (len=%2d) [ Ext: %d  IntID: %s  %s  Spare: %d  %s  Dchan: %d\n",
+	pri_message(ctrl, "%c Channel ID (len=%2d) [ Ext: %d  IntID: %s  %s  Spare: %d  %s  Dchan: %d\n",
 		prefix, len, (ie->data[0] & 0x80) ? 1 : 0, (ie->data[0] & 0x40) ? "Explicit" : "Implicit",
 		(ie->data[0] & 0x20) ? "PRI" : "Other", (ie->data[0] & 0x10) ? 1 : 0,
 		(ie->data[0] & 0x08) ? "Exclusive" : "Preferred",  (ie->data[0] & 0x04) ? 1 : 0);
-	pri_message(pri, "%c                        ChanSel: %s\n",
+	pri_message(ctrl, "%c                        ChanSel: %s\n",
 		prefix, msg_chan_sel[(ie->data[0] & 0x3) + ((ie->data[0]>>3) & 0x4)]);
 	pos++;
 	len--;
 	if (ie->data[0] &  0x40) {
 		/* Explicitly defined DS1 */
-		pri_message(pri, "%c                       Ext: %d  DS1 Identifier: %d  \n", prefix, (ie->data[pos] & 0x80) >> 7, ie->data[pos] & 0x7f);
+		pri_message(ctrl, "%c                       Ext: %d  DS1 Identifier: %d  \n", prefix, (ie->data[pos] & 0x80) >> 7, ie->data[pos] & 0x7f);
 		pos++;
 	} else {
 		/* Implicitly defined DS1 */
 	}
 	if (pos+2 < len) {
 		/* Still more information here */
-		pri_message(pri, "%c                       Ext: %d  Coding: %d  %s Specified  Channel Type: %d\n",
+		pri_message(ctrl, "%c                       Ext: %d  Coding: %d  %s Specified  Channel Type: %d\n",
 				prefix, (ie->data[pos] & 0x80) >> 7, (ie->data[pos] & 60) >> 5, 
 				(ie->data[pos] & 0x10) ? "Slot Map" : "Number", ie->data[pos] & 0x0f);
 		if (!(ie->data[pos] & 0x10)) {
 			/* Number specified */
 			pos++;
-			pri_message(pri, "%c                       Ext: %d  Channel: %d Type: %s]\n", prefix, (ie->data[pos] & 0x80) >> 7, 
-				(ie->data[pos]) & 0x7f, pritype(pri->localtype));
+			pri_message(ctrl, "%c                       Ext: %d  Channel: %d Type: %s]\n", prefix, (ie->data[pos] & 0x80) >> 7, 
+				(ie->data[pos]) & 0x7f, pritype(ctrl->localtype));
 		} else {
 			pos++;
 			/* Map specified */
@@ -605,9 +605,9 @@
 				res <<= 8;
 				res |= ie->data[pos++];
 			}
-			pri_message(pri, "%c                       Map: %s ]\n", prefix, binary(res, 24));
-		}
-	} else pri_message(pri, "                         ]\n");				
+			pri_message(ctrl, "%c                       Map: %s ]\n", prefix, binary(res, 24));
+		}
+	} else pri_message(ctrl, "                         ]\n");				
 }
 
 static char *ri2str(int ri)
@@ -620,20 +620,20 @@
 	return code2str(ri, ris, sizeof(ris) / sizeof(ris[0]));
 }
 
-static void dump_restart_indicator(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
-{
-	pri_message(pri, "%c Restart Indentifier (len=%2d) [ Ext: %d  Spare: %d  Resetting %s (%d) ]\n", 
+static void dump_restart_indicator(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
+{
+	pri_message(ctrl, "%c Restart Indentifier (len=%2d) [ Ext: %d  Spare: %d  Resetting %s (%d) ]\n", 
 		prefix, len, (ie->data[0] & 0x80) >> 7, (ie->data[0] & 0x78) >> 3, ri2str(ie->data[0] & 0x7), ie->data[0] & 0x7);
 }
 
-static int receive_restart_indicator(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+static int receive_restart_indicator(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	/* Pretty simple */
 	call->ri = ie->data[0] & 0x7;
 	return 0;
 }
 
-static int transmit_restart_indicator(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_restart_indicator(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	/* Pretty simple */
 	switch(call->ri) {
@@ -647,7 +647,7 @@
 		ie->data[0] = 0xA0 | (call->ri & 0x7);
 		break;
 	default:
-		pri_error(pri, "!! Invalid restart indicator value %d\n", call->ri);
+		pri_error(ctrl, "!! Invalid restart indicator value %d\n", call->ri);
 		return-1;
 	}
 	return 3;
@@ -745,16 +745,16 @@
     return code2str(proto, protos, sizeof(protos) / sizeof(protos[0]));
 }
 
-static void dump_bearer_capability(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_bearer_capability(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	int pos=2;
-	pri_message(pri, "%c Bearer Capability (len=%2d) [ Ext: %d  Q.931 Std: %d  Info transfer capability: %s (%d)\n",
+	pri_message(ctrl, "%c Bearer Capability (len=%2d) [ Ext: %d  Q.931 Std: %d  Info transfer capability: %s (%d)\n",
 		prefix, len, (ie->data[0] & 0x80 ) >> 7, (ie->data[0] & 0x60) >> 5, cap2str(ie->data[0] & 0x1f), (ie->data[0] & 0x1f));
-	pri_message(pri, "%c                              Ext: %d  Trans mode/rate: %s (%d)\n", prefix, (ie->data[1] & 0x80) >> 7, mode2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f);
+	pri_message(ctrl, "%c                              Ext: %d  Trans mode/rate: %s (%d)\n", prefix, (ie->data[1] & 0x80) >> 7, mode2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f);
 
 	/* octet 4.1 exists iff mode/rate is multirate */
 	if ((ie->data[1] & 0x7f) == 0x18) {
-	    pri_message(pri, "%c                              Ext: %d  Transfer rate multiplier: %d x 64\n", prefix, (ie->data[2] & 0x80) >> 7, ie->data[2] & 0x7f);
+	    pri_message(ctrl, "%c                              Ext: %d  Transfer rate multiplier: %d x 64\n", prefix, (ie->data[2] & 0x80) >> 7, ie->data[2] & 0x7f);
 		pos++;
 	}
 
@@ -770,7 +770,7 @@
 		   too, so we have to do the same for binary compatability */
 		u_int8_t layer1 = ie->data[pos] & 0x7f;
 
-		pri_message(pri, "%c                                User information layer 1: %s (%d)\n",
+		pri_message(ctrl, "%c                                User information layer 1: %s (%d)\n",
 		            prefix, l12str(layer1), layer1);
 		pos++;
 		
@@ -778,7 +778,7 @@
 		if (pos < len && !(ie->data[pos-1] & 0x80)) {
 			int ra = ie->data[pos] & 0x7f;
 
-			pri_message(pri, "%c                                Async: %d, Negotiation: %d, "
+			pri_message(ctrl, "%c                                Async: %d, Negotiation: %d, "
 				"User rate: %s (%#x)\n", 
 				prefix,
 				ra & PRI_RATE_ADAPT_ASYNC ? 1 : 0,
@@ -792,7 +792,7 @@
 		if (pos < len && !(ie->data[pos-1] & 0x80)) {
 			u_int8_t data = ie->data[pos];
 			if (layer1 == PRI_LAYER_1_ITU_RATE_ADAPT) {
-				pri_message(pri, "%c                                Intermediate rate: %s (%d), "
+				pri_message(ctrl, "%c                                Intermediate rate: %s (%d), "
 					"NIC on Tx: %d, NIC on Rx: %d, "
 					"Flow control on Tx: %d, "
 					"Flow control on Rx: %d\n",
@@ -803,7 +803,7 @@
 					(data & 0x04)?1:0,
 					(data & 0x02)?1:0);
 			} else if (layer1 == PRI_LAYER_1_V120_RATE_ADAPT) {
-				pri_message(pri, "%c                                Hdr: %d, Multiframe: %d, Mode: %d, "
+				pri_message(ctrl, "%c                                Hdr: %d, Multiframe: %d, Mode: %d, "
 					"LLI negot: %d, Assignor: %d, "
 					"In-band neg: %d\n", prefix,
 					(data & 0x40)?1:0,
@@ -813,7 +813,7 @@
 					(data & 0x04)?1:0,
 					(data & 0x02)?1:0);
 			} else {
-				pri_message(pri, "%c                                Unknown octet 5b: 0x%x\n", data );
+				pri_message(ctrl, "%c                                Unknown octet 5b: 0x%x\n", data );
 			}
 			pos++;
 		}
@@ -826,7 +826,7 @@
 			const char *parity[] = {"Odd","?","Even","None",
 				       "zero","one","?","?"};
 	
-			pri_message(pri, "%c                                Stop bits: %s, data bits: %s, "
+			pri_message(ctrl, "%c                                Stop bits: %s, data bits: %s, "
 			    "parity: %s\n", prefix,
 			    stop_bits[(data & 0x60) >> 5],
 			    data_bits[(data & 0x18) >> 3],
@@ -838,7 +838,7 @@
 			/* octet 5d? */
 		if (pos < len && !(ie->data[pos-1] & 0x80)) {
 			u_int8_t data = ie->data[pos];
-			pri_message(pri, "%c                                Duplex mode: %d, modem type: %d\n",
+			pri_message(ctrl, "%c                                Duplex mode: %d, modem type: %d\n",
 				prefix, (data & 0x40) ? 1 : 0,data & 0x3F);
  			pos++;
 		}
@@ -848,7 +848,7 @@
 	/* Look for octet 6; this is identified by bits 5,6 == 10 */
 	if (pos < len && 
 		(ie->data[pos] & 0x60) == 0x40) {
-		pri_message(pri, "%c                                User information layer 2: %s (%d)\n",
+		pri_message(ctrl, "%c                                User information layer 2: %s (%d)\n",
 			prefix, l22str(ie->data[pos] & 0x1f),
 			ie->data[pos] & 0x1f);
 		pos++;
@@ -856,7 +856,7 @@
 
 	/* Look for octet 7; this is identified by bits 5,6 == 11 */
 	if (pos < len && (ie->data[pos] & 0x60) == 0x60) {
-		pri_message(pri, "%c                                User information layer 3: %s (%d)\n",
+		pri_message(ctrl, "%c                                User information layer 3: %s (%d)\n",
 			prefix, l32str(ie->data[pos] & 0x1f),
 			ie->data[pos] & 0x1f);
 		pos++;
@@ -868,18 +868,18 @@
 			proto = ((ie->data[pos] & 0xF) << 4 ) | 
 			         (ie->data[pos+1] & 0xF);
 
-			pri_message(pri, "%c                                Network layer: 0x%x\n", prefix,
+			pri_message(ctrl, "%c                                Network layer: 0x%x\n", prefix,
 			            proto );
 			pos += 2;
 		}
 	}
 }
 
-static int receive_bearer_capability(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+static int receive_bearer_capability(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	int pos=2;
 	if (ie->data[0] & 0x60) {
-		pri_error(pri, "!! non-standard Q.931 standard field\n");
+		pri_error(ctrl, "!! non-standard Q.931 standard field\n");
 		return -1;
 	}
 	call->transcapability = ie->data[0] & 0x1f;
@@ -926,7 +926,7 @@
 	return 0;
 }
 
-static int transmit_bearer_capability(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_bearer_capability(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	int tc;
 	int pos;
@@ -936,7 +936,7 @@
 		return 0;
 
 	tc = call->transcapability;
-	if (pri->subchannel && !pri->bri) {
+	if (ctrl->subchannel && !ctrl->bri) {
 		/* Bearer capability is *hard coded* in GR-303 */
 		ie->data[0] = 0x88;
 		ie->data[1] = 0x90;
@@ -958,7 +958,7 @@
  		ie->data[pos++] = call->transmultiple | 0x80;
 	}
 
-	if ((tc & PRI_TRANS_CAP_DIGITAL) && (pri->switchtype == PRI_SWITCH_EUROISDN_E1) &&
+	if ((tc & PRI_TRANS_CAP_DIGITAL) && (ctrl->switchtype == PRI_SWITCH_EUROISDN_E1) &&
 		(call->transmoderate == TRANS_MODE_PACKET)) {
 		/* Apparently EuroISDN switches don't seem to like user layer 2/3 */
 		return 4;
@@ -971,7 +971,7 @@
 
 	if (call->transmoderate != TRANS_MODE_PACKET) {
 		/* If you have an AT&T 4ESS, you don't send any more info */
-		if ((pri->switchtype != PRI_SWITCH_ATT4ESS) && (call->userl1 > -1)) {
+		if ((ctrl->switchtype != PRI_SWITCH_ATT4ESS) && (call->userl1 > -1)) {
 			ie->data[pos++] = call->userl1 | 0x80; /* XXX Ext bit? XXX */
 			if (call->userl1 == PRI_LAYER_1_ITU_RATE_ADAPT) {
 				ie->data[pos++] = call->rateadaption | 0x80;
@@ -1072,50 +1072,50 @@
 	num[len] = 0;
 }
 
-static void dump_called_party_number(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_called_party_number(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	unsigned char cnum[256];
 
 	q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
-	pri_message(pri, "%c Called Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)  '%s' ]\n",
+	pri_message(ctrl, "%c Called Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)  '%s' ]\n",
 		prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f, cnum);
 }
 
-static void dump_called_party_subaddr(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_called_party_subaddr(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	unsigned char cnum[256];
 	q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
-	pri_message(pri, "%c Called Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d)  O: %d  '%s' ]\n",
+	pri_message(ctrl, "%c Called Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d)  O: %d  '%s' ]\n",
 		prefix, len, ie->data[0] >> 7,
 		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
 		(ie->data[0] & 0x08) >> 3, cnum);
 }
 
-static void dump_calling_party_number(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_calling_party_number(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	unsigned char cnum[256];
 	if (ie->data[0] & 0x80)
 		q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
 	else
 		q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
-	pri_message(pri, "%c Calling Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
+	pri_message(ctrl, "%c Calling Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
 	if (ie->data[0] & 0x80)
-		pri_message(pri, "%c                           Presentation: %s (%d)  '%s' ]\n", prefix, pri_pres2str(0), 0, cnum);
+		pri_message(ctrl, "%c                           Presentation: %s (%d)  '%s' ]\n", prefix, pri_pres2str(0), 0, cnum);
 	else
-		pri_message(pri, "%c                           Presentation: %s (%d)  '%s' ]\n", prefix, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f, cnum);
-}
-
-static void dump_calling_party_subaddr(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+		pri_message(ctrl, "%c                           Presentation: %s (%d)  '%s' ]\n", prefix, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f, cnum);
+}
+
+static void dump_calling_party_subaddr(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	unsigned char cnum[256];
 	q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
-	pri_message(pri, "%c Calling Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d)  O: %d  '%s' ]\n",
+	pri_message(ctrl, "%c Calling Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d)  O: %d  '%s' ]\n",
 		prefix, len, ie->data[0] >> 7,
 		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
 		(ie->data[0] & 0x08) >> 3, cnum);
 }
 
-static void dump_redirecting_number(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_redirecting_number(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	unsigned char cnum[256];
 	int i = 0;
@@ -1124,24 +1124,24 @@
 	do {
 		switch(i) {
 		case 0:	/* Octet 3 */
-			pri_message(pri, "%c Redirecting Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)",
+			pri_message(ctrl, "%c Redirecting Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)",
 				prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
 			break;
 		case 1: /* Octet 3a */
-			pri_message(pri, "\n%c                               Ext: %d  Presentation: %s (%d)",
+			pri_message(ctrl, "\n%c                               Ext: %d  Presentation: %s (%d)",
 				prefix, ie->data[1] >> 7, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f);
 			break;
 		case 2: /* Octet 3b */
-			pri_message(pri, "\n%c                               Ext: %d  Reason: %s (%d)",
+			pri_message(ctrl, "\n%c                               Ext: %d  Reason: %s (%d)",
 				prefix, ie->data[2] >> 7, redirection_reason2str(ie->data[2] & 0x7f), ie->data[2] & 0x7f);
 			break;
 		}
 	} while(!(ie->data[i++]& 0x80));
 	q931_get_number(cnum, sizeof(cnum), ie->data + i, ie->len - i);
-	pri_message(pri, "  '%s' ]\n", cnum);
-}
-
-static int receive_connected_number(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+	pri_message(ctrl, "  '%s' ]\n", cnum);
+}
+
+static int receive_connected_number(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	int i = 0;
 
@@ -1167,7 +1167,7 @@
 	return 0;
 }
 
-static int transmit_connected_number(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_connected_number(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	size_t datalen;
 
@@ -1183,7 +1183,7 @@
 	return datalen + (2 + 2);
 }
 
-static void dump_connected_number(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_connected_number(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	unsigned char cnum[256];
 	int i = 0;
@@ -1192,21 +1192,21 @@
 	do {
 		switch(i) {
 		case 0:	/* Octet 3 */
-			pri_message(pri, "%c Connected Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)",
+			pri_message(ctrl, "%c Connected Number (len=%2d) [ Ext: %d  TON: %s (%d)  NPI: %s (%d)",
 				prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f);
 			break;
 		case 1: /* Octet 3a */
-			pri_message(pri, "\n%c                             Ext: %d  Presentation: %s (%d)",
+			pri_message(ctrl, "\n%c                             Ext: %d  Presentation: %s (%d)",
 				prefix, ie->data[1] >> 7, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f);
 			break;
 		}
 	} while(!(ie->data[i++]& 0x80));
 	q931_get_number(cnum, sizeof(cnum), ie->data + i, ie->len - i);
-	pri_message(pri, "  '%s' ]\n", cnum);
-}
-
-
-static int receive_redirecting_number(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+	pri_message(ctrl, "  '%s' ]\n", cnum);
+}
+
+
+static int receive_redirecting_number(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	int i = 0;
 
@@ -1235,7 +1235,7 @@
 	return 0;
 }
 
-static int transmit_redirecting_number(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_redirecting_number(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	size_t datalen;
 
@@ -1254,24 +1254,24 @@
 	return datalen + (3 + 2);
 }
 
-static void dump_redirecting_subaddr(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_redirecting_subaddr(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	unsigned char cnum[256];
 	q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
-	pri_message(pri, "%c Redirecting Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d)  O: %d  '%s' ]\n",
+	pri_message(ctrl, "%c Redirecting Sub-Address (len=%2d) [ Ext: %d  Type: %s (%d)  O: %d  '%s' ]\n",
 		prefix, len, ie->data[0] >> 7,
 		subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
 		(ie->data[0] & 0x08) >> 3, cnum);
 }
 
-static int receive_calling_party_subaddr(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+static int receive_calling_party_subaddr(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	/* copy digits to call->callingsubaddr */
  	q931_get_number((unsigned char *) call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 1, len - 3);
 	return 0;
 }
 
-static int receive_called_party_number(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+static int receive_called_party_number(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	size_t called_len;
 	size_t max_len;
@@ -1307,7 +1307,7 @@
 	return 0;
 }
 
-static int transmit_called_party_number(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_called_party_number(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	size_t datalen;
 
@@ -1322,7 +1322,7 @@
 	return datalen + (1 + 2);
 }
 
-static int receive_calling_party_number(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+static int receive_calling_party_number(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	int i = 0;
 
@@ -1349,7 +1349,7 @@
 	return 0;
 }
 
-static int transmit_calling_party_number(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_calling_party_number(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	size_t datalen;
 
@@ -1365,17 +1365,17 @@
 	return datalen + (2 + 2);
 }
 
-static void dump_user_user(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_user_user(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	int x;
-	pri_message(pri, "%c User-User Information (len=%2d) [", prefix, len);
+	pri_message(ctrl, "%c User-User Information (len=%2d) [", prefix, len);
 	for (x=0;x<ie->len;x++)
-		pri_message(pri, " %02x", ie->data[x] & 0x7f);
-	pri_message(pri, " ]\n");
-}
-
-
-static int receive_user_user(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+		pri_message(ctrl, " %02x", ie->data[x] & 0x7f);
+	pri_message(ctrl, " ]\n");
+}
+
+
+static int receive_user_user(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {        
         call->useruserprotocoldisc = ie->data[0] & 0xff;
         if (call->useruserprotocoldisc == 4) /* IA5 */
@@ -1383,7 +1383,7 @@
 	return 0;
 }
 
-static int transmit_user_user(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_user_user(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {        
 	int datalen = strlen(call->useruserinfo);
 	if (datalen > 0) {
@@ -1404,24 +1404,24 @@
 	return 0;
 }
 
-static void dump_change_status(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_change_status(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	int x;
 	
-	pri_message(pri, "%c Change Status Information (len=%2d) [", prefix, len);
+	pri_message(ctrl, "%c Change Status Information (len=%2d) [", prefix, len);
 	for (x=0; x<ie->len; x++) {
-		pri_message(pri, " %02x", ie->data[x] & 0x7f);
-	}
-	pri_message(pri, " ]\n");
-}
-
-static int receive_change_status(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+		pri_message(ctrl, " %02x", ie->data[x] & 0x7f);
+	}
+	pri_message(ctrl, " ]\n");
+}
+
+static int receive_change_status(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	call->changestatus = ie->data[0] & 0x0f;
 	return 0;
 }
 
-static int transmit_change_status(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_change_status(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	ie->data[0] = 0xc0 | call->changestatus;
 	return 3;
@@ -1469,16 +1469,16 @@
 	return code2str(loc, locs, sizeof(locs) / sizeof(locs[0]));
 }
 
-static void dump_progress_indicator(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
-{
-	pri_message(pri, "%c Progress Indicator (len=%2d) [ Ext: %d  Coding: %s (%d)  0: %d  Location: %s (%d)\n",
+static void dump_progress_indicator(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
+{
+	pri_message(ctrl, "%c Progress Indicator (len=%2d) [ Ext: %d  Coding: %s (%d)  0: %d  Location: %s (%d)\n",
 		prefix, len, ie->data[0] >> 7, coding2str((ie->data[0] & 0x60) >> 5), (ie->data[0] & 0x60) >> 5,
 		(ie->data[0] & 0x10) >> 4, loc2str(ie->data[0] & 0xf), ie->data[0] & 0xf);
-	pri_message(pri, "%c                               Ext: %d  Progress Description: %s (%d) ]\n",
+	pri_message(ctrl, "%c                               Ext: %d  Progress Description: %s (%d) ]\n",
 		prefix, ie->data[1] >> 7, prog2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f);
 }
 
-static int receive_display(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+static int receive_display(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	unsigned char *data;
 
@@ -1534,7 +1534,7 @@
 	return 2 + i + datalen;
 }
 
-static int receive_progress_indicator(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+static int receive_progress_indicator(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	call->progloc = ie->data[0] & 0xf;
 	call->progcode = (ie->data[0] & 0x60) >> 5;
@@ -1570,13 +1570,13 @@
 		call->progressmask |= PRI_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER;
 		break;
 	default:
-		pri_error(pri, "XXX Invalid Progress indicator value received: %02x\n",(ie->data[1] & 0x7f));
+		pri_error(ctrl, "XXX Invalid Progress indicator value received: %02x\n",(ie->data[1] & 0x7f));
 		break;
 	}
 	return 0;
 }
 
-static int transmit_facility(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_facility(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	struct apdu_event *tmp;
 	int i = 0;
@@ -1588,13 +1588,13 @@
 	if (!tmp)	/* No APDU found */
 		return 0;
 
-	if (pri->debug & PRI_DEBUG_APDU) {
-		pri_message(pri, "Adding facility ie contents to send message:\n");
-		facility_decode_dump(pri, tmp->apdu, tmp->apdu_len);
+	if (ctrl->debug & PRI_DEBUG_APDU) {
+		pri_message(ctrl, "Adding facility ie contents to send message:\n");
+		facility_decode_dump(ctrl, tmp->apdu, tmp->apdu_len);
 	}
 
 	if (tmp->apdu_len > 235) { /* TODO: find out how much space we can use */
-		pri_message(pri, "Requested APDU (%d bytes) is too long\n", tmp->apdu_len);
+		pri_message(ctrl, "Requested APDU (%d bytes) is too long\n", tmp->apdu_len);
 		return 0;
 	}
 
@@ -1679,11 +1679,11 @@
 	return 0;
 }
 
-static int transmit_progress_indicator(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_progress_indicator(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	int code, mask;
 	/* Can't send progress indicator on GR-303 -- EVER! */
-	if (pri->subchannel && !pri->bri)
+	if (ctrl->subchannel && !ctrl->bri)
 		return 0;
 	if (call->progressmask > 0) {
 		if (call->progressmask & (mask = PRI_PROG_CALL_NOT_E2E_ISDN))
@@ -1706,7 +1706,7 @@
 			code = Q931_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER;
 		else {
 			code = 0;
-			pri_error(pri, "XXX Undefined progress bit: %x\n", call->progressmask);
+			pri_error(ctrl, "XXX Undefined progress bit: %x\n", call->progressmask);
 		}
 		if (code) {
 			ie->data[0] = 0x80 | (call->progcode << 5)  | (call->progloc);
@@ -1718,7 +1718,7 @@
 	/* Leave off */
 	return 0;
 }
-static int transmit_call_state(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_call_state(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	if (call->ourcallstate > -1 ) {
 		ie->data[0] = call->ourcallstate;
@@ -1727,7 +1727,7 @@
 	return 0;
 }
 
-static int receive_call_state(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+static int receive_call_state(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	call->sugcallstate = ie->data[0] & 0x3f;
 	return 0;
@@ -1759,41 +1759,41 @@
 	return code2str(callstate, callstates, sizeof(callstates) / sizeof(callstates[0]));
 }
 
-static void dump_call_state(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
-{
-	pri_message(pri, "%c Call State (len=%2d) [ Ext: %d  Coding: %s (%d)  Call state: %s (%d)\n",
+static void dump_call_state(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
+{
+	pri_message(ctrl, "%c Call State (len=%2d) [ Ext: %d  Coding: %s (%d)  Call state: %s (%d)\n",
 		prefix, len, ie->data[0] >> 7, coding2str((ie->data[0] & 0xC0) >> 6), (ie->data[0] & 0xC0) >> 6,
 		callstate2str(ie->data[0] & 0x3f), ie->data[0] & 0x3f);
 }
 
-static void dump_call_identity(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_call_identity(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	int x;
-	pri_message(pri, "%c Call Identity (len=%2d) [ ", prefix, len);
+	pri_message(ctrl, "%c Call Identity (len=%2d) [ ", prefix, len);
 	for (x=0;x<ie->len;x++) 
-		pri_message(pri, "0x%02X ", ie->data[x]);
-	pri_message(pri, " ]\n");
-}
-
-static void dump_time_date(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
-{
-	pri_message(pri, "%c Time Date (len=%2d) [ ", prefix, len);
+		pri_message(ctrl, "0x%02X ", ie->data[x]);
+	pri_message(ctrl, " ]\n");
+}
+
+static void dump_time_date(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
+{
+	pri_message(ctrl, "%c Time Date (len=%2d) [ ", prefix, len);
 	if (ie->len > 0)
-		pri_message(pri, "%02d", ie->data[0]);
+		pri_message(ctrl, "%02d", ie->data[0]);
 	if (ie->len > 1)
-		pri_message(pri, "-%02d", ie->data[1]);
+		pri_message(ctrl, "-%02d", ie->data[1]);
 	if (ie->len > 2)
-		pri_message(pri, "-%02d", ie->data[2]);
+		pri_message(ctrl, "-%02d", ie->data[2]);
 	if (ie->len > 3)
-		pri_message(pri, " %02d", ie->data[3]);
+		pri_message(ctrl, " %02d", ie->data[3]);
 	if (ie->len > 4)
-		pri_message(pri, ":%02d", ie->data[4]);
+		pri_message(ctrl, ":%02d", ie->data[4]);
 	if (ie->len > 5)
-		pri_message(pri, ":%02d", ie->data[5]);
-	pri_message(pri, " ]\n");
-}
-
-static void dump_keypad_facility(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+		pri_message(ctrl, ":%02d", ie->data[5]);
+	pri_message(ctrl, " ]\n");
+}
+
+static void dump_keypad_facility(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	char tmp[64];
 	
@@ -1802,10 +1802,10 @@
 	
 	memcpy(tmp, ie->data, ie->len);
 	tmp[ie->len] = '\0';
-	pri_message(pri, "%c Keypad Facility (len=%2d) [ %s ]\n", prefix, ie->len, tmp );
-}
-
-static int receive_keypad_facility(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
+	pri_message(ctrl, "%c Keypad Facility (len=%2d) [ %s ]\n", prefix, ie->len, tmp );
+}
+
+static int receive_keypad_facility(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)
 {
 	int mylen;
 
@@ -1823,7 +1823,7 @@
 	return 0;
 }
 
-static int transmit_keypad_facility(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
+static int transmit_keypad_facility(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
 	int sublen;
 
@@ -1835,7 +1835,7 @@
 		return 0;
 }
 
-static void dump_display(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+static void dump_display(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	int x, y;
 	char *buf = malloc(len + 1);
@@ -1849,7 +1849,7 @@
 		for (y=x; x<ie->len; x++) 
 			buf[x] = ie->data[x] & 0x7f;
 		buf[x] = '\0';
-		pri_message(pri, "%c Display (len=%2d) %s[ %s ]\n", prefix, ie->len, tmp, &buf[y]);
+		pri_message(ctrl, "%c Display (len=%2d) %s[ %s ]\n", prefix, ie->len, tmp, &buf[y]);
 		free(buf);
 	}
 }
@@ -1857,10 +1857,10 @@
 #define CHECK_OVERFLOW(limit) \
 	if (tmpptr - tmp + limit >= sizeof(tmp)) { \
 		*tmpptr = '\0'; \
-		pri_message(pri, "%s", tmpptr = tmp); \
-	}
-
-static void dump_ie_data(struct pri *pri, unsigned char *c, int len)
+		pri_message(ctrl, "%s", tmpptr = tmp); \
+	}
+
+static void dump_ie_data(struct pri *ctrl, unsigned char *c, int len)
 {
 	static char hexs[16] = "0123456789ABCDEF";
 	char tmp[1024], *tmpptr;
@@ -1896,48 +1896,48 @@
 	if (lastascii)
 		*tmpptr++ = '\'';
 	*tmpptr = '\0';
-	pri_message(pri, "%s", tmp);
-}
-
-static void dump_facility(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
+	pri_message(ctrl, "%s", tmp);
+}
+
+static void dump_facility(int full_ie, struct pri *ctrl, q931_ie *ie, int len, char prefix)
 {
 	int dataat = (ie->data[0] & 0x80) ? 1 : 2;
 
-	pri_message(pri, "%c Facility (len=%2d, codeset=%d) [ ", prefix, len, Q931_IE_CODESET(full_ie));
-	dump_ie_data(pri, ie->data, ie->len);
+	pri_message(ctrl, "%c Facility (len=%2d, codeset=%d) [ ", prefix, len, Q931_IE_CODESET(full_ie));
+	dump_ie_data(ctrl, ie->data, ie->len);
 	pri_message(NULL, " ]\n");
 	if (ie->len > 1) {
-		pri_message(pri, "PROTOCOL %02X\n", ie->data[0] & Q932_PROTOCOL_MASK);
-		asn1_dump(pri, ie->data + dataat, ie->data + ie->len);
-	}
-
-}
-
-static void dump_network_spec_fac(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix)
-{
-	pri_message(pri, "%c Network-Specific Facilities (len=%2d) [ ", prefix, ie->len);
+		pri_message(ctrl, "PROTOCOL %02X\n", ie->data[0] & Q932_PROTOCOL_MASK);
+		asn1_dump(ctrl, ie->data + dataat, ie->data + ie->len);
+	}
+
+}
+

[... 2477 lines stripped ...]



More information about the libpri-commits mailing list