patch-2.2.3 linux/net/irda/irlpt/irlpt_srvr.c

Next file: linux/net/irda/irlpt/irlpt_srvr_fsm.c
Previous file: linux/net/irda/irlpt/irlpt_common.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.2/linux/net/irda/irlpt/irlpt_srvr.c linux/net/irda/irlpt/irlpt_srvr.c
@@ -49,31 +49,34 @@
 
 int irlpt_server_init(void);
 static void irlpt_server_cleanup(void);
-static void irlpt_server_disconnect_indication( void *instance, void *sap, 
+static void irlpt_server_disconnect_indication( void *instance, 
+						void *sap, 
 						LM_REASON reason,
 						struct sk_buff *skb);
-static void irlpt_server_connect_confirm( void *instance, void *sap, 
+static void irlpt_server_connect_confirm( void *instance, 
+					  void *sap, 
 					  struct qos_info *qos,  
 					  int max_seg_size,
 					  struct sk_buff *skb);
-static void irlpt_server_connect_indication( void *instance, void *sap, 
+static void irlpt_server_connect_indication( void *instance, 
+					     void *sap, 
 					     struct qos_info *qos, 
 					     int max_seg_size,
 					     struct sk_buff *skb);
-static void irlpt_server_data_indication( void *instance, void *sap, 
+static void irlpt_server_data_indication( void *instance, 
+					  void *sap, 
 					  struct sk_buff *skb);
 static void register_irlpt_server(void);
 static void deregister_irlpt_server(void);
 
-static struct wait_queue *irlpt_server_wait;
-
 int irlpt_server_lsap = LSAP_IRLPT;
 int irlpt_server_debug = 4;
 
 #if 0
 static char *rcsid = "$Id: irlpt_server.c,v 1.9 1998/10/22 12:02:22 dagb Exp $";
 #endif
-static char *version = "IrLPT server, $Revision: 1.9 $/$Date: 1998/10/22 12:02:22 $ (Thomas Davis)";
+
+static char *version = "IrLPT server, v2 (Thomas Davis)";
 
 struct file_operations irlpt_fops = {
 	irlpt_seek,	/* seek */
@@ -96,7 +99,7 @@
 #ifdef CONFIG_PROC_FS
 
 /*
- * Function proc_irlpt_read (buf, start, offset, len, unused)
+ * Function irlpt_server_proc_read (buf, start, offset, len, unused)
  *
  *
  *
@@ -137,21 +140,19 @@
 			break;
 		}
 
-		len += sprintf(buf+len, "servicetype: %s\n", 
-			       irlpt_service_type[index]);
-		len += sprintf(buf+len, "porttype: %s\n", 
+		len += sprintf(buf+len, "servicetype: %s, porttype: %s\n",
+			       irlpt_service_type[index],
 			       irlpt_port_type[irlpt_server->porttype]);
-		len += sprintf(buf+len, "daddr: %d\n", 
-			       irlpt_server->daddr);
-		len += sprintf(buf+len, "state: %s\n", 
-			       irlpt_server_fsm_state[irlpt_server->state]);
-		len += sprintf(buf+len, "retries: %d\n", 
-			       irlpt_server->open_retries);
-		len += sprintf(buf+len, "peersap: %d\n", 
+		len += sprintf(buf+len, "saddr: 0x%08x, daddr: 0x%08x\n", 
+			       irlpt_server->saddr, irlpt_server->daddr);
+		len += sprintf(buf+len, "slsap: 0x%08x, dlsap: 0x%08x\n", 
+			       irlpt_server->slsap_sel, 
 			       irlpt_server->dlsap_sel);
-		len += sprintf(buf+len, "count: %d\n", 
+		len += sprintf(buf+len, "retries: %d, count: %d\n", 
+			       irlpt_server->open_retries,
 			       irlpt_server->count);
-		len += sprintf(buf+len, "rx_queue: %d\n", 
+		len += sprintf(buf+len, "fsm state: %s, rx queue depth: %d\n", 
+			       irlpt_server_fsm_state[irlpt_server->state],
 			       skb_queue_len(&irlpt_server->rx_queue));
 		len += sprintf(buf+len, "\n");
 	}
@@ -258,11 +259,14 @@
  * Function irlpt_disconnect_indication (handle)
  *
  */
-static void irlpt_server_disconnect_indication( void *instance, void *sap, 
+static void irlpt_server_disconnect_indication( void *instance, 
+						void *sap, 
 						LM_REASON reason,
 						struct sk_buff *userdata)
 {
+#if 0
 	struct irlpt_info info;
+#endif
 	struct irlpt_cb *self;
 
 	DEBUG( irlpt_server_debug, "--> " __FUNCTION__ "\n");
@@ -272,17 +276,22 @@
 	ASSERT( self != NULL, return;);
 	ASSERT( self->magic == IRLPT_MAGIC, return;);
 
+#if 0
 	info.daddr = self->daddr;
+#endif
 
-	DEBUG( irlpt_server_debug, __FUNCTION__ ": reason=%d (%s), dlsap_sel=%d\n",
+	DEBUG( irlpt_server_debug, 
+	       __FUNCTION__ ": reason=%d (%s), dlsap_sel=%d\n",
 	       reason, irlpt_reasons[reason], self->dlsap_sel);
 
 	self->connected = IRLPT_DISCONNECTED;
 	self->eof = reason;
 
-        wake_up_interruptible(&irlpt_server_wait);
+        wake_up_interruptible(&self->read_wait);
+	wake_up_interruptible(&self->write_wait);
+	wake_up_interruptible(&self->ex_wait);
 
-	DEBUG( irlpt_server_debug, __FUNCTION__ ": skb_queue_len=%d\n",
+	DEBUG( irlpt_server_debug, __FUNCTION__ ": rx queue length: %d\n",
 	       skb_queue_len(&irlpt_server->rx_queue));
 
 	irlpt_server_do_event( self, LMP_DISCONNECT, NULL, NULL);
@@ -298,12 +307,12 @@
  *
  *    LSAP connection confirmed!
  */
-static void irlpt_server_connect_confirm( void *instance, void *sap, 
+static void irlpt_server_connect_confirm( void *instance, 
+					  void *sap, 
 					  struct qos_info *qos,
 					  int max_seg_size,
 					  struct sk_buff *skb)
 {
-	struct irlpt_info info;
 	struct irlpt_cb *self;
 
 	DEBUG( irlpt_server_debug, "--> " __FUNCTION__ "\n");
@@ -312,21 +321,6 @@
 	ASSERT( self != NULL, return;);
 	ASSERT( self->magic == IRLPT_MAGIC, return;);
 
-	info.daddr = self->daddr;
-
-	/*
-	 *  Check if we have got some QoS parameters back! This should be the
-	 *  negotiated QoS for the link.
-	 */
-	if ( qos) {
-		DEBUG( irlpt_server_debug, __FUNCTION__ 
-		       ": IrLPT Negotiated BAUD_RATE: %02x\n", 
-		       qos->baud_rate.bits);			
-		DEBUG( irlpt_server_debug, __FUNCTION__ 
-		       ": IrLPT Negotiated BAUD_RATE: %d bps.\n", 
-		       qos->baud_rate.value);
-	}
-
 	self->connected = TRUE;
 
 	irlpt_server_do_event( self, LMP_CONNECT, NULL, NULL);
@@ -338,19 +332,20 @@
  * Function irlpt_connect_indication (handle)
  *
  */
-static void irlpt_server_connect_indication( void *instance, void *sap, 
+static void irlpt_server_connect_indication( void *instance, 
+					     void *sap, 
 					     struct qos_info *qos, 
 					     int max_seg_size,
 					     struct sk_buff *skb)
 {
 	struct irlpt_cb *self;
 	struct irlpt_info info;
-	struct lsap_cb *lsap;
 
 	DEBUG( irlpt_server_debug, "--> " __FUNCTION__ "\n");
 
 	self = ( struct irlpt_cb *) instance;
-	lsap = (struct lsap_cb *) sap;
+
+	info.lsap  = (struct lsap_cb *) sap;
 	
 	ASSERT( self != NULL, return;);
 	ASSERT( self->magic == IRLPT_MAGIC, return;);
@@ -358,8 +353,6 @@
 	self->connected = IRLPT_CONNECTED;
 	self->eof = FALSE;
 
-	info.lsap = lsap;
-
 	irlpt_server_do_event( self, LMP_CONNECT, NULL, &info);
 
 	if (skb) {
@@ -370,12 +363,13 @@
 }
 
 /*
- * Function irlpt_data_indication (handle, skb)
+ * Function irlpt_server_data_indication (handle, skb)
  *
  *    This function gets the data that is received on the data channel
  *
  */
-static void irlpt_server_data_indication( void *instance, void *sap, 
+static void irlpt_server_data_indication( void *instance, 
+					  void *sap, 
 					  struct sk_buff *skb) 
 {
 
@@ -397,7 +391,7 @@
 #endif
 	
 	skb_queue_tail(&self->rx_queue, skb);
-        wake_up_interruptible(&irlpt_server_wait);
+        wake_up_interruptible(&self->read_wait);
 
 	DEBUG( irlpt_server_debug, __FUNCTION__ " -->\n");
 }
@@ -419,9 +413,8 @@
 	/*
 	 *  First register control TSAP
 	 */
-
 	if ( !irlpt_server || irlpt_server->magic != IRLPT_MAGIC) {
-		DEBUG( 0, "irlpt_register_server:, unable to obtain handle!\n");
+		DEBUG( 0, __FUNCTION__ ": unable to obtain handle!\n");
 		return;
 	}
 
@@ -432,12 +425,13 @@
 	notify.disconnect_indication = irlpt_server_disconnect_indication;
 	notify.data_indication = irlpt_server_data_indication;
 	notify.instance = irlpt_server;
-	strcpy(notify.name, "IrLPT");
+	strcpy(notify.name, "IrLPT server");
 
 	irlpt_server->lsap = irlmp_open_lsap( irlpt_server_lsap, &notify);
 
 	irlpt_server->connected = IRLPT_WAITING;
 	irlpt_server->service_LSAP = irlpt_server_lsap;
+	irlpt_server->slsap_sel = irlpt_server_lsap;
 
 	/* 
 	 *  Register with LM-IAS
@@ -461,35 +455,9 @@
  */
 static void deregister_irlpt_server(void)
 {
-#if 0
-	struct notify_t notify;
-#endif
 	DEBUG( irlpt_server_debug, "--> " __FUNCTION__ "\n");
 
-#if 0
-	/*
-	 *  First register control TSAP
-	 */
-
-	if ( !irlpt_server || irlpt_server->magic != IRLPT_MAGIC) {
-		DEBUG( 0, "irlpt_register_server:, unable to obtain handle!\n");
-		return;
-	}
-
-	irda_notify_init(&notify);
-
-	notify.connect_confirm = irlpt_server_connect_confirm;
-	notify.connect_indication = irlpt_server_connect_indication;
-	notify.disconnect_indication = irlpt_server_disconnect_indication;
-	notify.data_indication = irlpt_server_data_indication;
-	notify.instance = irlpt_server;
-	strcpy(notify.name, "IrLPT");
-
-	irlpt_server->lsap = irlmp_open_lsap( irlpt_server_lsap, &notify);
-
-	irlpt_server->connected = IRLPT_WAITING;
-	irlpt_server->service_LSAP = irlpt_server_lsap;
-#endif
+	irlpt_server->connected = IRLPT_DISCONNECTED;
 
 	/* 
 	 *  de-Register with LM-IAS
@@ -504,7 +472,9 @@
 #ifdef MODULE
 
 MODULE_AUTHOR("Thomas Davis <ratbert@radiks.net>");
-MODULE_DESCRIPTION("The Linux IrDA/IrLPT protocol");
+MODULE_DESCRIPTION("The Linux IrDA/IrLPT server protocol");
+MODULE_PARM(irlpt_server_debug,"1i");
+MODULE_PARM(irlpt_server_fsm_debug, "1i");
 
 /*
  * Function init_module (void)
@@ -515,11 +485,11 @@
 int init_module(void)
 {
 
-        DEBUG( irlpt_server_debug, "--> irlpt server: init_module\n");
+        DEBUG( irlpt_server_debug, "--> IrLPT server: init_module\n");
 
         irlpt_server_init();
 
-        DEBUG( irlpt_server_debug, "irlpt server: init_module -->\n");
+        DEBUG( irlpt_server_debug, "IrLPT server: init_module -->\n");
 
         return 0;
 }
@@ -532,14 +502,14 @@
  */
 void cleanup_module(void)
 {
-	DEBUG( irlpt_server_debug, "--> " __FUNCTION__ "\n");
-        DEBUG( 3, "--> irlpt server: cleanup_module\n");
+        DEBUG( irlpt_server_debug, "--> IrLPT server: cleanup_module\n");
+
         /* No need to check MOD_IN_USE, as sys_delete_module() checks. */
 
         /* Free some memory */
         irlpt_server_cleanup();
 
-        DEBUG( irlpt_server_debug, "irlpt server: cleanup_module -->\n");
+        DEBUG( irlpt_server_debug, "IrLPT server: cleanup_module -->\n");
 }
 
 #endif /* MODULE */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)