[asterisk-commits] branch crichter/0.3.0 - r8267 /team/crichter/0.3.0/channels/misdn/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 19 11:25:04 MST 2006


Author: crichter
Date: Thu Jan 19 12:25:01 2006
New Revision: 8267

URL: http://svn.digium.com/view/asterisk?rev=8267&view=rev
Log:
added HDLC frame Acknowledging. We send only 1 frame now and wait till it is transmitted completely

Modified:
    team/crichter/0.3.0/channels/misdn/isdn_lib.c
    team/crichter/0.3.0/channels/misdn/isdn_lib.h

Modified: team/crichter/0.3.0/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.c?rev=8267&r1=8266&r2=8267&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.c (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.c Thu Jan 19 12:25:01 2006
@@ -539,6 +539,13 @@
 
 	mISDN_write_frame(stack->midev, buff, bc->addr|FLG_MSG_DOWN, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
 	
+
+	
+	if (bc->ack_hdlc) {
+		free(bc->ack_hdlc);
+		bc->ack_hdlc=NULL;
+	}
+	
 	
 	bc->b_stid = 0;
 	
@@ -845,6 +852,11 @@
 		
 	} else if ( bc->hdlc ) {
 		cb_log(2, stack->port," --> HDLC Mode\n");
+
+		bc->ack_hdlc=(sem_t*)malloc(sizeof(sem_t));
+		if ( sem_init((sem_t*)bc->ack_hdlc, 1, 0)<0 )
+			sem_init((sem_t*)bc->ack_hdlc, 0, 0);
+		
 		pid.protocol[1] = ISDN_PID_L1_B_64HDLC ;
 		pid.protocol[2] = ISDN_PID_L2_B_TRANS  ;
 		pid.protocol[3] = ISDN_PID_L3_B_USER;
@@ -2086,6 +2098,12 @@
 
 #endif
 		free_msg(msg);
+		
+		if (bc->hdlc) {
+			cb_log(4,stack->port,"Acknowledge Packet\n");
+			sem_post( (sem_t*)bc->ack_hdlc);
+		}
+		
 		return 1;
 		break;
 	case DL_DATA|RESPONSE:
@@ -3309,6 +3327,12 @@
 	
 	cb_log(9, stack->port, "Writing %d bytes 2 mISDN\n",len);
 	r=mISDN_write(stack->midev, buf, frm->len + mISDN_HEADER_LEN, TIMEOUT_INFINIT);
+
+	if (bc->hdlc && bc->ack_hdlc) {
+		cb_log(4,stack->port,"Awaiting Acknowledge [%d]\n",len);
+		sem_wait((sem_t*)bc->ack_hdlc);
+		cb_log(4,stack->port,"Acknowledged\n");
+	}
 	
 	return 0;
 }

Modified: team/crichter/0.3.0/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/isdn_lib.h?rev=8267&r1=8266&r2=8267&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/isdn_lib.h (original)
+++ team/crichter/0.3.0/channels/misdn/isdn_lib.h Thu Jan 19 12:25:01 2006
@@ -166,6 +166,8 @@
 	/* int b_addr; */
 	int layer_id;
 
+	void *ack_hdlc;
+	
 	int layer;
 	
 	



More information about the asterisk-commits mailing list