aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/irlan/irlan_provider.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda/irlan/irlan_provider.c')
-rw-r--r--net/irda/irlan/irlan_provider.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c
index 58efde91966..aac66434e47 100644
--- a/net/irda/irlan/irlan_provider.c
+++ b/net/irda/irlan/irlan_provider.c
@@ -1,5 +1,5 @@
1/********************************************************************* 1/*********************************************************************
2 * 2 *
3 * Filename: irlan_provider.c 3 * Filename: irlan_provider.c
4 * Version: 0.9 4 * Version: 0.9
5 * Description: IrDA LAN Access Protocol Implementation 5 * Description: IrDA LAN Access Protocol Implementation
@@ -11,17 +11,17 @@
11 * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> 11 * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov>
12 * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> 12 * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk>
13 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 13 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
14 * 14 *
15 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, 15 * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
16 * All Rights Reserved. 16 * All Rights Reserved.
17 * 17 *
18 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as 19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * Neither Dag Brattli nor University of Tromsų admit liability nor 23 * Neither Dag Brattli nor University of Tromsų admit liability nor
24 * provide warranty for any of this software. This material is 24 * provide warranty for any of this software. This material is
25 * provided "AS-IS" and at no charge. 25 * provided "AS-IS" and at no charge.
26 * 26 *
27 ********************************************************************/ 27 ********************************************************************/
@@ -52,8 +52,8 @@
52#include <net/irda/irlan_filter.h> 52#include <net/irda/irlan_filter.h>
53#include <net/irda/irlan_client.h> 53#include <net/irda/irlan_client.h>
54 54
55static void irlan_provider_connect_indication(void *instance, void *sap, 55static void irlan_provider_connect_indication(void *instance, void *sap,
56 struct qos_info *qos, 56 struct qos_info *qos,
57 __u32 max_sdu_size, 57 __u32 max_sdu_size,
58 __u8 max_header_size, 58 __u8 max_header_size,
59 struct sk_buff *skb); 59 struct sk_buff *skb);
@@ -64,14 +64,14 @@ static void irlan_provider_connect_indication(void *instance, void *sap,
64 * This function gets the data that is received on the control channel 64 * This function gets the data that is received on the control channel
65 * 65 *
66 */ 66 */
67static int irlan_provider_data_indication(void *instance, void *sap, 67static int irlan_provider_data_indication(void *instance, void *sap,
68 struct sk_buff *skb) 68 struct sk_buff *skb)
69{ 69{
70 struct irlan_cb *self; 70 struct irlan_cb *self;
71 __u8 code; 71 __u8 code;
72 72
73 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 73 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
74 74
75 self = (struct irlan_cb *) instance; 75 self = (struct irlan_cb *) instance;
76 76
77 IRDA_ASSERT(self != NULL, return -1;); 77 IRDA_ASSERT(self != NULL, return -1;);
@@ -83,16 +83,16 @@ static int irlan_provider_data_indication(void *instance, void *sap,
83 switch(code) { 83 switch(code) {
84 case CMD_GET_PROVIDER_INFO: 84 case CMD_GET_PROVIDER_INFO:
85 IRDA_DEBUG(4, "Got GET_PROVIDER_INFO command!\n"); 85 IRDA_DEBUG(4, "Got GET_PROVIDER_INFO command!\n");
86 irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb); 86 irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb);
87 break; 87 break;
88 88
89 case CMD_GET_MEDIA_CHAR: 89 case CMD_GET_MEDIA_CHAR:
90 IRDA_DEBUG(4, "Got GET_MEDIA_CHAR command!\n"); 90 IRDA_DEBUG(4, "Got GET_MEDIA_CHAR command!\n");
91 irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb); 91 irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb);
92 break; 92 break;
93 case CMD_OPEN_DATA_CHANNEL: 93 case CMD_OPEN_DATA_CHANNEL:
94 IRDA_DEBUG(4, "Got OPEN_DATA_CHANNEL command!\n"); 94 IRDA_DEBUG(4, "Got OPEN_DATA_CHANNEL command!\n");
95 irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb); 95 irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb);
96 break; 96 break;
97 case CMD_FILTER_OPERATION: 97 case CMD_FILTER_OPERATION:
98 IRDA_DEBUG(4, "Got FILTER_OPERATION command!\n"); 98 IRDA_DEBUG(4, "Got FILTER_OPERATION command!\n");
@@ -119,9 +119,9 @@ static int irlan_provider_data_indication(void *instance, void *sap,
119 * Got connection from peer IrLAN client 119 * Got connection from peer IrLAN client
120 * 120 *
121 */ 121 */
122static void irlan_provider_connect_indication(void *instance, void *sap, 122static void irlan_provider_connect_indication(void *instance, void *sap,
123 struct qos_info *qos, 123 struct qos_info *qos,
124 __u32 max_sdu_size, 124 __u32 max_sdu_size,
125 __u8 max_header_size, 125 __u8 max_header_size,
126 struct sk_buff *skb) 126 struct sk_buff *skb)
127{ 127{
@@ -130,13 +130,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap,
130 __u32 saddr, daddr; 130 __u32 saddr, daddr;
131 131
132 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); 132 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );
133 133
134 self = (struct irlan_cb *) instance; 134 self = (struct irlan_cb *) instance;
135 tsap = (struct tsap_cb *) sap; 135 tsap = (struct tsap_cb *) sap;
136 136
137 IRDA_ASSERT(self != NULL, return;); 137 IRDA_ASSERT(self != NULL, return;);
138 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 138 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
139 139
140 IRDA_ASSERT(tsap == self->provider.tsap_ctrl,return;); 140 IRDA_ASSERT(tsap == self->provider.tsap_ctrl,return;);
141 IRDA_ASSERT(self->provider.state == IRLAN_IDLE, return;); 141 IRDA_ASSERT(self->provider.state == IRLAN_IDLE, return;);
142 142
@@ -147,13 +147,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap,
147 147
148 irlan_do_provider_event(self, IRLAN_CONNECT_INDICATION, NULL); 148 irlan_do_provider_event(self, IRLAN_CONNECT_INDICATION, NULL);
149 149
150 /* 150 /*
151 * If we are in peer mode, the client may not have got the discovery 151 * If we are in peer mode, the client may not have got the discovery
152 * indication it needs to make progress. If the client is still in 152 * indication it needs to make progress. If the client is still in
153 * IDLE state, we must kick it. 153 * IDLE state, we must kick it.
154 */ 154 */
155 if ((self->provider.access_type == ACCESS_PEER) && 155 if ((self->provider.access_type == ACCESS_PEER) &&
156 (self->client.state == IRLAN_IDLE)) 156 (self->client.state == IRLAN_IDLE))
157 { 157 {
158 irlan_client_wakeup(self, self->saddr, self->daddr); 158 irlan_client_wakeup(self, self->saddr, self->daddr);
159 } 159 }
@@ -175,38 +175,38 @@ void irlan_provider_connect_response(struct irlan_cb *self,
175 irttp_connect_response(tsap, IRLAN_MTU, NULL); 175 irttp_connect_response(tsap, IRLAN_MTU, NULL);
176} 176}
177 177
178static void irlan_provider_disconnect_indication(void *instance, void *sap, 178static void irlan_provider_disconnect_indication(void *instance, void *sap,
179 LM_REASON reason, 179 LM_REASON reason,
180 struct sk_buff *userdata) 180 struct sk_buff *userdata)
181{ 181{
182 struct irlan_cb *self; 182 struct irlan_cb *self;
183 struct tsap_cb *tsap; 183 struct tsap_cb *tsap;
184 184
185 IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); 185 IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason);
186 186
187 self = (struct irlan_cb *) instance; 187 self = (struct irlan_cb *) instance;
188 tsap = (struct tsap_cb *) sap; 188 tsap = (struct tsap_cb *) sap;
189 189
190 IRDA_ASSERT(self != NULL, return;); 190 IRDA_ASSERT(self != NULL, return;);
191 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 191 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
192 IRDA_ASSERT(tsap != NULL, return;); 192 IRDA_ASSERT(tsap != NULL, return;);
193 IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); 193 IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;);
194 194
195 IRDA_ASSERT(tsap == self->provider.tsap_ctrl, return;); 195 IRDA_ASSERT(tsap == self->provider.tsap_ctrl, return;);
196 196
197 irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); 197 irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL);
198} 198}
199 199
200/* 200/*
201 * Function irlan_parse_open_data_cmd (self, skb) 201 * Function irlan_parse_open_data_cmd (self, skb)
202 * 202 *
203 * 203 *
204 * 204 *
205 */ 205 */
206int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb) 206int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb)
207{ 207{
208 int ret; 208 int ret;
209 209
210 ret = irlan_provider_parse_command(self, CMD_OPEN_DATA_CHANNEL, skb); 210 ret = irlan_provider_parse_command(self, CMD_OPEN_DATA_CHANNEL, skb);
211 211
212 /* Open data channel */ 212 /* Open data channel */
@@ -218,12 +218,12 @@ int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb)
218/* 218/*
219 * Function parse_command (skb) 219 * Function parse_command (skb)
220 * 220 *
221 * Extract all parameters from received buffer, then feed them to 221 * Extract all parameters from received buffer, then feed them to
222 * check_params for parsing 222 * check_params for parsing
223 * 223 *
224 */ 224 */
225int irlan_provider_parse_command(struct irlan_cb *self, int cmd, 225int irlan_provider_parse_command(struct irlan_cb *self, int cmd,
226 struct sk_buff *skb) 226 struct sk_buff *skb)
227{ 227{
228 __u8 *frame; 228 __u8 *frame;
229 __u8 *ptr; 229 __u8 *ptr;
@@ -231,16 +231,16 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd,
231 __u16 val_len; 231 __u16 val_len;
232 int i; 232 int i;
233 char *name; 233 char *name;
234 char *value; 234 char *value;
235 int ret = RSP_SUCCESS; 235 int ret = RSP_SUCCESS;
236 236
237 IRDA_ASSERT(skb != NULL, return -RSP_PROTOCOL_ERROR;); 237 IRDA_ASSERT(skb != NULL, return -RSP_PROTOCOL_ERROR;);
238 238
239 IRDA_DEBUG(4, "%s(), skb->len=%d\n", __FUNCTION__ , (int)skb->len); 239 IRDA_DEBUG(4, "%s(), skb->len=%d\n", __FUNCTION__ , (int)skb->len);
240 240
241 IRDA_ASSERT(self != NULL, return -RSP_PROTOCOL_ERROR;); 241 IRDA_ASSERT(self != NULL, return -RSP_PROTOCOL_ERROR;);
242 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -RSP_PROTOCOL_ERROR;); 242 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -RSP_PROTOCOL_ERROR;);
243 243
244 if (!skb) 244 if (!skb)
245 return -RSP_PROTOCOL_ERROR; 245 return -RSP_PROTOCOL_ERROR;
246 246
@@ -259,11 +259,11 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd,
259 count = frame[1]; 259 count = frame[1];
260 260
261 IRDA_DEBUG(4, "Got %d parameters\n", count); 261 IRDA_DEBUG(4, "Got %d parameters\n", count);
262 262
263 ptr = frame+2; 263 ptr = frame+2;
264 264
265 /* For all parameters */ 265 /* For all parameters */
266 for (i=0; i<count;i++) { 266 for (i=0; i<count;i++) {
267 ret = irlan_extract_param(ptr, name, value, &val_len); 267 ret = irlan_extract_param(ptr, name, value, &val_len);
268 if (ret < 0) { 268 if (ret < 0) {
269 IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); 269 IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ );
@@ -286,7 +286,7 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd,
286 * Send reply to query to peer IrLAN layer 286 * Send reply to query to peer IrLAN layer
287 * 287 *
288 */ 288 */
289void irlan_provider_send_reply(struct irlan_cb *self, int command, 289void irlan_provider_send_reply(struct irlan_cb *self, int command,
290 int ret_code) 290 int ret_code)
291{ 291{
292 struct sk_buff *skb; 292 struct sk_buff *skb;
@@ -310,7 +310,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command,
310 /* Reserve space for TTP, LMP, and LAP header */ 310 /* Reserve space for TTP, LMP, and LAP header */
311 skb_reserve(skb, self->provider.max_header_size); 311 skb_reserve(skb, self->provider.max_header_size);
312 skb_put(skb, 2); 312 skb_put(skb, 2);
313 313
314 switch (command) { 314 switch (command) {
315 case CMD_GET_PROVIDER_INFO: 315 case CMD_GET_PROVIDER_INFO:
316 skb->data[0] = 0x00; /* Success */ 316 skb->data[0] = 0x00; /* Success */
@@ -356,7 +356,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command,
356 skb->data[0] = 0x00; /* Success */ 356 skb->data[0] = 0x00; /* Success */
357 if (self->provider.send_arb_val) { 357 if (self->provider.send_arb_val) {
358 skb->data[1] = 0x03; /* 3 parameters */ 358 skb->data[1] = 0x03; /* 3 parameters */
359 irlan_insert_short_param(skb, "CON_ARB", 359 irlan_insert_short_param(skb, "CON_ARB",
360 self->provider.send_arb_val); 360 self->provider.send_arb_val);
361 } else 361 } else
362 skb->data[1] = 0x02; /* 2 parameters */ 362 skb->data[1] = 0x02; /* 2 parameters */
@@ -378,13 +378,13 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command,
378 * Function irlan_provider_register(void) 378 * Function irlan_provider_register(void)
379 * 379 *
380 * Register provider support so we can accept incoming connections. 380 * Register provider support so we can accept incoming connections.
381 * 381 *
382 */ 382 */
383int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) 383int irlan_provider_open_ctrl_tsap(struct irlan_cb *self)
384{ 384{
385 struct tsap_cb *tsap; 385 struct tsap_cb *tsap;
386 notify_t notify; 386 notify_t notify;
387 387
388 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 388 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
389 389
390 IRDA_ASSERT(self != NULL, return -1;); 390 IRDA_ASSERT(self != NULL, return -1;);
@@ -393,7 +393,7 @@ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self)
393 /* Check if already open */ 393 /* Check if already open */
394 if (self->provider.tsap_ctrl) 394 if (self->provider.tsap_ctrl)
395 return -1; 395 return -1;
396 396
397 /* 397 /*
398 * First register well known control TSAP 398 * First register well known control TSAP
399 */ 399 */