diff options
Diffstat (limited to 'include/net/irda/irlan_common.h')
-rw-r--r-- | include/net/irda/irlan_common.h | 222 |
1 files changed, 222 insertions, 0 deletions
diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h new file mode 100644 index 000000000000..1c73bdbc3eb3 --- /dev/null +++ b/include/net/irda/irlan_common.h | |||
@@ -0,0 +1,222 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * Filename: irlan_common.h | ||
4 | * Version: 0.8 | ||
5 | * Description: IrDA LAN access layer | ||
6 | * Status: Experimental. | ||
7 | * Author: Dag Brattli <dagb@cs.uit.no> | ||
8 | * Created at: Sun Aug 31 20:14:37 1997 | ||
9 | * Modified at: Sun Oct 31 19:41:24 1999 | ||
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | ||
11 | * | ||
12 | * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, | ||
13 | * All Rights Reserved. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License as | ||
17 | * published by the Free Software Foundation; either version 2 of | ||
18 | * the License, or (at your option) any later version. | ||
19 | * | ||
20 | * Neither Dag Brattli nor University of Tromsų admit liability nor | ||
21 | * provide warranty for any of this software. This material is | ||
22 | * provided "AS-IS" and at no charge. | ||
23 | * | ||
24 | ********************************************************************/ | ||
25 | |||
26 | #ifndef IRLAN_H | ||
27 | #define IRLAN_H | ||
28 | |||
29 | #include <asm/param.h> /* for HZ */ | ||
30 | |||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/types.h> | ||
33 | #include <linux/skbuff.h> | ||
34 | #include <linux/netdevice.h> | ||
35 | |||
36 | #include <net/irda/irttp.h> | ||
37 | |||
38 | #define IRLAN_MTU 1518 | ||
39 | #define IRLAN_TIMEOUT 10*HZ /* 10 seconds */ | ||
40 | |||
41 | /* Command packet types */ | ||
42 | #define CMD_GET_PROVIDER_INFO 0 | ||
43 | #define CMD_GET_MEDIA_CHAR 1 | ||
44 | #define CMD_OPEN_DATA_CHANNEL 2 | ||
45 | #define CMD_CLOSE_DATA_CHAN 3 | ||
46 | #define CMD_RECONNECT_DATA_CHAN 4 | ||
47 | #define CMD_FILTER_OPERATION 5 | ||
48 | |||
49 | /* Some responses */ | ||
50 | #define RSP_SUCCESS 0 | ||
51 | #define RSP_INSUFFICIENT_RESOURCES 1 | ||
52 | #define RSP_INVALID_COMMAND_FORMAT 2 | ||
53 | #define RSP_COMMAND_NOT_SUPPORTED 3 | ||
54 | #define RSP_PARAM_NOT_SUPPORTED 4 | ||
55 | #define RSP_VALUE_NOT_SUPPORTED 5 | ||
56 | #define RSP_NOT_OPEN 6 | ||
57 | #define RSP_AUTHENTICATION_REQUIRED 7 | ||
58 | #define RSP_INVALID_PASSWORD 8 | ||
59 | #define RSP_PROTOCOL_ERROR 9 | ||
60 | #define RSP_ASYNCHRONOUS_ERROR 255 | ||
61 | |||
62 | /* Media types */ | ||
63 | #define MEDIA_802_3 1 | ||
64 | #define MEDIA_802_5 2 | ||
65 | |||
66 | /* Filter parameters */ | ||
67 | #define DATA_CHAN 1 | ||
68 | #define FILTER_TYPE 2 | ||
69 | #define FILTER_MODE 3 | ||
70 | |||
71 | /* Filter types */ | ||
72 | #define IRLAN_DIRECTED 0x01 | ||
73 | #define IRLAN_FUNCTIONAL 0x02 | ||
74 | #define IRLAN_GROUP 0x04 | ||
75 | #define IRLAN_MAC_FRAME 0x08 | ||
76 | #define IRLAN_MULTICAST 0x10 | ||
77 | #define IRLAN_BROADCAST 0x20 | ||
78 | #define IRLAN_IPX_SOCKET 0x40 | ||
79 | |||
80 | /* Filter modes */ | ||
81 | #define ALL 1 | ||
82 | #define FILTER 2 | ||
83 | #define NONE 3 | ||
84 | |||
85 | /* Filter operations */ | ||
86 | #define GET 1 | ||
87 | #define CLEAR 2 | ||
88 | #define ADD 3 | ||
89 | #define REMOVE 4 | ||
90 | #define DYNAMIC 5 | ||
91 | |||
92 | /* Access types */ | ||
93 | #define ACCESS_DIRECT 1 | ||
94 | #define ACCESS_PEER 2 | ||
95 | #define ACCESS_HOSTED 3 | ||
96 | |||
97 | #define IRLAN_BYTE 0 | ||
98 | #define IRLAN_SHORT 1 | ||
99 | #define IRLAN_ARRAY 2 | ||
100 | |||
101 | #define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_MAX_HEADER) | ||
102 | |||
103 | /* | ||
104 | * IrLAN client | ||
105 | */ | ||
106 | struct irlan_client_cb { | ||
107 | int state; | ||
108 | |||
109 | int open_retries; | ||
110 | |||
111 | struct tsap_cb *tsap_ctrl; | ||
112 | __u32 max_sdu_size; | ||
113 | __u8 max_header_size; | ||
114 | |||
115 | int access_type; /* Access type of provider */ | ||
116 | __u8 reconnect_key[255]; | ||
117 | __u8 key_len; | ||
118 | |||
119 | __u16 recv_arb_val; | ||
120 | __u16 max_frame; | ||
121 | int filter_type; | ||
122 | |||
123 | int unicast_open; | ||
124 | int broadcast_open; | ||
125 | |||
126 | int tx_busy; | ||
127 | struct sk_buff_head txq; /* Transmit control queue */ | ||
128 | |||
129 | struct iriap_cb *iriap; | ||
130 | |||
131 | struct timer_list kick_timer; | ||
132 | }; | ||
133 | |||
134 | /* | ||
135 | * IrLAN provider | ||
136 | */ | ||
137 | struct irlan_provider_cb { | ||
138 | int state; | ||
139 | |||
140 | struct tsap_cb *tsap_ctrl; | ||
141 | __u32 max_sdu_size; | ||
142 | __u8 max_header_size; | ||
143 | |||
144 | /* | ||
145 | * Store some values here which are used by the provider to parse | ||
146 | * the filter operations | ||
147 | */ | ||
148 | int data_chan; | ||
149 | int filter_type; | ||
150 | int filter_mode; | ||
151 | int filter_operation; | ||
152 | int filter_entry; | ||
153 | int access_type; /* Access type */ | ||
154 | __u16 send_arb_val; | ||
155 | |||
156 | __u8 mac_address[6]; /* Generated MAC address for peer device */ | ||
157 | }; | ||
158 | |||
159 | /* | ||
160 | * IrLAN control block | ||
161 | */ | ||
162 | struct irlan_cb { | ||
163 | int magic; | ||
164 | struct list_head dev_list; | ||
165 | struct net_device *dev; /* Ethernet device structure*/ | ||
166 | struct net_device_stats stats; | ||
167 | |||
168 | __u32 saddr; /* Source device address */ | ||
169 | __u32 daddr; /* Destination device address */ | ||
170 | int disconnect_reason; /* Why we got disconnected */ | ||
171 | |||
172 | int media; /* Media type */ | ||
173 | __u8 version[2]; /* IrLAN version */ | ||
174 | |||
175 | struct tsap_cb *tsap_data; /* Data TSAP */ | ||
176 | |||
177 | int use_udata; /* Use Unit Data transfers */ | ||
178 | |||
179 | __u8 stsap_sel_data; /* Source data TSAP selector */ | ||
180 | __u8 dtsap_sel_data; /* Destination data TSAP selector */ | ||
181 | __u8 dtsap_sel_ctrl; /* Destination ctrl TSAP selector */ | ||
182 | |||
183 | struct irlan_client_cb client; /* Client specific fields */ | ||
184 | struct irlan_provider_cb provider; /* Provider specific fields */ | ||
185 | |||
186 | __u32 max_sdu_size; | ||
187 | __u8 max_header_size; | ||
188 | |||
189 | wait_queue_head_t open_wait; | ||
190 | struct timer_list watchdog_timer; | ||
191 | }; | ||
192 | |||
193 | void irlan_close(struct irlan_cb *self); | ||
194 | void irlan_close_tsaps(struct irlan_cb *self); | ||
195 | |||
196 | int irlan_register_netdev(struct irlan_cb *self); | ||
197 | void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel); | ||
198 | void irlan_start_watchdog_timer(struct irlan_cb *self, int timeout); | ||
199 | |||
200 | void irlan_open_data_tsap(struct irlan_cb *self); | ||
201 | |||
202 | int irlan_run_ctrl_tx_queue(struct irlan_cb *self); | ||
203 | |||
204 | struct irlan_cb *irlan_get_any(void); | ||
205 | void irlan_get_provider_info(struct irlan_cb *self); | ||
206 | void irlan_get_media_char(struct irlan_cb *self); | ||
207 | void irlan_open_data_channel(struct irlan_cb *self); | ||
208 | void irlan_close_data_channel(struct irlan_cb *self); | ||
209 | void irlan_set_multicast_filter(struct irlan_cb *self, int status); | ||
210 | void irlan_set_broadcast_filter(struct irlan_cb *self, int status); | ||
211 | |||
212 | int irlan_insert_byte_param(struct sk_buff *skb, char *param, __u8 value); | ||
213 | int irlan_insert_short_param(struct sk_buff *skb, char *param, __u16 value); | ||
214 | int irlan_insert_string_param(struct sk_buff *skb, char *param, char *value); | ||
215 | int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *value, | ||
216 | __u16 value_len); | ||
217 | |||
218 | int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len); | ||
219 | |||
220 | #endif | ||
221 | |||
222 | |||