1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#ifndef IRLAN_H
27#define IRLAN_H
28
29#include <asm/param.h>
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
40
41
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
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
63#define MEDIA_802_3 1
64#define MEDIA_802_5 2
65
66
67#define DATA_CHAN 1
68#define FILTER_TYPE 2
69#define FILTER_MODE 3
70
71
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
81#define ALL 1
82#define FILTER 2
83#define NONE 3
84
85
86#define GET 1
87#define CLEAR 2
88#define ADD 3
89#define REMOVE 4
90#define DYNAMIC 5
91
92
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
102#define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER)
103
104#define IRLAN_CMD_HEADER 2
105
106#define IRLAN_STRING_PARAMETER_LEN(name, value) (1 + strlen((name)) + 2 \
107 + strlen ((value)))
108#define IRLAN_BYTE_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 1)
109#define IRLAN_SHORT_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 2)
110
111
112
113
114struct irlan_client_cb {
115 int state;
116
117 int open_retries;
118
119 struct tsap_cb *tsap_ctrl;
120 __u32 max_sdu_size;
121 __u8 max_header_size;
122
123 int access_type;
124 __u8 reconnect_key[255];
125 __u8 key_len;
126
127 __u16 recv_arb_val;
128 __u16 max_frame;
129 int filter_type;
130
131 int unicast_open;
132 int broadcast_open;
133
134 int tx_busy;
135 struct sk_buff_head txq;
136
137 struct iriap_cb *iriap;
138
139 struct timer_list kick_timer;
140};
141
142
143
144
145struct irlan_provider_cb {
146 int state;
147
148 struct tsap_cb *tsap_ctrl;
149 __u32 max_sdu_size;
150 __u8 max_header_size;
151
152
153
154
155
156 int data_chan;
157 int filter_type;
158 int filter_mode;
159 int filter_operation;
160 int filter_entry;
161 int access_type;
162 __u16 send_arb_val;
163
164 __u8 mac_address[6];
165};
166
167
168
169
170struct irlan_cb {
171 int magic;
172 struct list_head dev_list;
173 struct net_device *dev;
174
175 __u32 saddr;
176 __u32 daddr;
177 int disconnect_reason;
178
179 int media;
180 __u8 version[2];
181
182 struct tsap_cb *tsap_data;
183
184 int use_udata;
185
186 __u8 stsap_sel_data;
187 __u8 dtsap_sel_data;
188 __u8 dtsap_sel_ctrl;
189
190 struct irlan_client_cb client;
191 struct irlan_provider_cb provider;
192
193 __u32 max_sdu_size;
194 __u8 max_header_size;
195
196 wait_queue_head_t open_wait;
197 struct timer_list watchdog_timer;
198};
199
200void irlan_close(struct irlan_cb *self);
201void irlan_close_tsaps(struct irlan_cb *self);
202
203int irlan_register_netdev(struct irlan_cb *self);
204void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel);
205void irlan_start_watchdog_timer(struct irlan_cb *self, int timeout);
206
207void irlan_open_data_tsap(struct irlan_cb *self);
208
209int irlan_run_ctrl_tx_queue(struct irlan_cb *self);
210
211struct irlan_cb *irlan_get_any(void);
212void irlan_get_provider_info(struct irlan_cb *self);
213void irlan_get_media_char(struct irlan_cb *self);
214void irlan_open_data_channel(struct irlan_cb *self);
215void irlan_close_data_channel(struct irlan_cb *self);
216void irlan_set_multicast_filter(struct irlan_cb *self, int status);
217void irlan_set_broadcast_filter(struct irlan_cb *self, int status);
218
219int irlan_insert_byte_param(struct sk_buff *skb, char *param, __u8 value);
220int irlan_insert_short_param(struct sk_buff *skb, char *param, __u16 value);
221int irlan_insert_string_param(struct sk_buff *skb, char *param, char *value);
222int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *value,
223 __u16 value_len);
224
225int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len);
226
227#endif
228
229
230