1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef CAPI_H
16#define CAPI_H
17
18
19typedef struct actcapi_msgcmd {
20 __u8 cmd;
21 __u8 subcmd;
22} actcapi_msgcmd;
23
24
25typedef struct actcapi_msghdr {
26 __u16 len;
27 __u16 applicationID;
28 actcapi_msgcmd cmd;
29 __u16 msgnum;
30} actcapi_msghdr;
31
32
33typedef struct actcapi_msgdsc {
34 actcapi_msgcmd cmd;
35 char *description;
36} actcapi_msgdsc;
37
38
39typedef struct actcapi_addr {
40 __u8 len;
41 __u8 tnp;
42 __u8 num[20];
43} actcapi_addr;
44
45
46typedef union actcapi_infonr {
47 __u16 mask;
48 struct bmask {
49 unsigned codes:3;
50 unsigned rsvd:5;
51 unsigned svind:1;
52 unsigned wtype:7;
53 } bmask;
54} actcapi_infonr;
55
56
57typedef union actcapi_infoel {
58 __u8 len;
59 __u8 display[40];
60 __u8 uuinfo[40];
61 struct cause {
62 unsigned ext2:1;
63 unsigned cod:2;
64 unsigned spare:1;
65 unsigned loc:4;
66 unsigned ext1:1;
67 unsigned cval:7;
68 } cause;
69 struct charge {
70 __u8 toc;
71 __u8 unit[10];
72 } charge;
73 __u8 date[20];
74 __u8 stat;
75} actcapi_infoel;
76
77
78typedef struct actcapi_msn {
79 __u8 eaz;
80 __u8 len;
81 __u8 msn[15];
82} __attribute__((packed)) actcapi_msn;
83
84typedef struct actcapi_dlpd {
85 __u8 len;
86 __u16 dlen;
87 __u8 laa;
88 __u8 lab;
89 __u8 modulo;
90 __u8 win;
91 __u8 xid[100];
92} __attribute__((packed)) actcapi_dlpd;
93
94typedef struct actcapi_ncpd {
95 __u8 len;
96 __u16 lic;
97 __u16 hic;
98 __u16 ltc;
99 __u16 htc;
100 __u16 loc;
101 __u16 hoc;
102 __u8 modulo;
103} __attribute__((packed)) actcapi_ncpd;
104#define actcapi_ncpi actcapi_ncpd
105
106
107
108
109
110
111
112
113
114#define MAKE_NCCI(plci, contr, ncci) \
115 ((plci & 0x1f) | ((contr & 0x7) << 5) | ((ncci & 0xff) << 8))
116
117#define EVAL_NCCI(fakencci, plci, ncci) { \
118 plci = fakencci & 0x1f; \
119 ncci = (fakencci >> 8) & 0xff; \
120 }
121
122
123
124
125
126
127
128
129
130
131typedef struct actcapi_msg {
132 actcapi_msghdr hdr;
133 union {
134 __u16 manuf_msg;
135 struct manufacturer_req_net {
136 __u16 manuf_msg;
137 __u16 controller;
138 __u8 nettype;
139 } manufacturer_req_net;
140 struct manufacturer_req_v42 {
141 __u16 manuf_msg;
142 __u16 controller;
143 __u32 v42control;
144 } manufacturer_req_v42;
145 struct manufacturer_conf_v42 {
146 __u16 manuf_msg;
147 __u16 controller;
148 } manufacturer_conf_v42;
149 struct manufacturer_req_err {
150 __u16 manuf_msg;
151 __u16 controller;
152 } manufacturer_req_err;
153 struct manufacturer_ind_err {
154 __u16 manuf_msg;
155 __u16 controller;
156 __u32 errcode;
157 __u8 errstring;
158 } manufacturer_ind_err;
159 struct manufacturer_req_msn {
160 __u16 manuf_msg;
161 __u16 controller;
162 actcapi_msn msnmap;
163 } __attribute ((packed)) manufacturer_req_msn;
164
165
166
167 struct connect_req {
168 __u8 controller;
169 __u8 bchan;
170 __u32 infomask;
171 __u8 si1;
172 __u8 si2;
173 __u8 eaz;
174 actcapi_addr addr;
175 } __attribute__ ((packed)) connect_req;
176 struct connect_conf {
177 __u16 plci;
178 __u16 info;
179 } connect_conf;
180 struct connect_ind {
181 __u16 plci;
182 __u8 controller;
183 __u8 si1;
184 __u8 si2;
185 __u8 eaz;
186 actcapi_addr addr;
187 } __attribute__ ((packed)) connect_ind;
188 struct connect_resp {
189 __u16 plci;
190 __u8 rejectcause;
191 } connect_resp;
192 struct connect_active_ind {
193 __u16 plci;
194 actcapi_addr addr;
195 } __attribute__ ((packed)) connect_active_ind;
196 struct connect_active_resp {
197 __u16 plci;
198 } connect_active_resp;
199 struct connect_b3_req {
200 __u16 plci;
201 actcapi_ncpi ncpi;
202 } __attribute__ ((packed)) connect_b3_req;
203 struct connect_b3_conf {
204 __u16 plci;
205 __u16 ncci;
206 __u16 info;
207 } connect_b3_conf;
208 struct connect_b3_ind {
209 __u16 ncci;
210 __u16 plci;
211 actcapi_ncpi ncpi;
212 } __attribute__ ((packed)) connect_b3_ind;
213 struct connect_b3_resp {
214 __u16 ncci;
215 __u8 rejectcause;
216 actcapi_ncpi ncpi;
217 } __attribute__ ((packed)) connect_b3_resp;
218 struct disconnect_req {
219 __u16 plci;
220 __u8 cause;
221 } disconnect_req;
222 struct disconnect_conf {
223 __u16 plci;
224 __u16 info;
225 } disconnect_conf;
226 struct disconnect_ind {
227 __u16 plci;
228 __u16 info;
229 } disconnect_ind;
230 struct disconnect_resp {
231 __u16 plci;
232 } disconnect_resp;
233 struct connect_b3_active_ind {
234 __u16 ncci;
235 actcapi_ncpi ncpi;
236 } __attribute__ ((packed)) connect_b3_active_ind;
237 struct connect_b3_active_resp {
238 __u16 ncci;
239 } connect_b3_active_resp;
240 struct disconnect_b3_req {
241 __u16 ncci;
242 actcapi_ncpi ncpi;
243 } __attribute__ ((packed)) disconnect_b3_req;
244 struct disconnect_b3_conf {
245 __u16 ncci;
246 __u16 info;
247 } disconnect_b3_conf;
248 struct disconnect_b3_ind {
249 __u16 ncci;
250 __u16 info;
251 actcapi_ncpi ncpi;
252 } __attribute__ ((packed)) disconnect_b3_ind;
253 struct disconnect_b3_resp {
254 __u16 ncci;
255 } disconnect_b3_resp;
256 struct info_ind {
257 __u16 plci;
258 actcapi_infonr nr;
259 actcapi_infoel el;
260 } __attribute__ ((packed)) info_ind;
261 struct info_resp {
262 __u16 plci;
263 } info_resp;
264 struct listen_b3_req {
265 __u16 plci;
266 } listen_b3_req;
267 struct listen_b3_conf {
268 __u16 plci;
269 __u16 info;
270 } listen_b3_conf;
271 struct select_b2_protocol_req {
272 __u16 plci;
273 __u8 protocol;
274 actcapi_dlpd dlpd;
275 } __attribute__ ((packed)) select_b2_protocol_req;
276 struct select_b2_protocol_conf {
277 __u16 plci;
278 __u16 info;
279 } select_b2_protocol_conf;
280 struct select_b3_protocol_req {
281 __u16 plci;
282 __u8 protocol;
283 actcapi_ncpd ncpd;
284 } __attribute__ ((packed)) select_b3_protocol_req;
285 struct select_b3_protocol_conf {
286 __u16 plci;
287 __u16 info;
288 } select_b3_protocol_conf;
289 struct listen_req {
290 __u8 controller;
291 __u32 infomask;
292 __u16 eazmask;
293 __u16 simask;
294 } __attribute__ ((packed)) listen_req;
295 struct listen_conf {
296 __u8 controller;
297 __u16 info;
298 } __attribute__ ((packed)) listen_conf;
299 struct data_b3_req {
300 __u16 fakencci;
301 __u16 datalen;
302 __u32 unused;
303 __u8 blocknr;
304 __u16 flags;
305 } __attribute ((packed)) data_b3_req;
306 struct data_b3_ind {
307 __u16 fakencci;
308 __u16 datalen;
309 __u32 unused;
310 __u8 blocknr;
311 __u16 flags;
312 } __attribute__ ((packed)) data_b3_ind;
313 struct data_b3_resp {
314 __u16 ncci;
315 __u8 blocknr;
316 } __attribute__ ((packed)) data_b3_resp;
317 struct data_b3_conf {
318 __u16 ncci;
319 __u8 blocknr;
320 __u16 info;
321 } __attribute__ ((packed)) data_b3_conf;
322 } msg;
323} __attribute__ ((packed)) actcapi_msg;
324
325static inline unsigned short
326actcapi_nextsmsg(act2000_card *card)
327{
328 unsigned long flags;
329 unsigned short n;
330
331 spin_lock_irqsave(&card->mnlock, flags);
332 n = card->msgnum;
333 card->msgnum++;
334 card->msgnum &= 0x7fff;
335 spin_unlock_irqrestore(&card->mnlock, flags);
336 return n;
337}
338#define DEBUG_MSG
339#undef DEBUG_DATA_MSG
340#undef DEBUG_DUMP_SKB
341
342extern int actcapi_chkhdr(act2000_card *, actcapi_msghdr *);
343extern int actcapi_listen_req(act2000_card *);
344extern int actcapi_manufacturer_req_net(act2000_card *);
345extern int actcapi_manufacturer_req_errh(act2000_card *);
346extern int actcapi_manufacturer_req_msn(act2000_card *);
347extern int actcapi_connect_req(act2000_card *, act2000_chan *, char *, char, int, int);
348extern void actcapi_select_b2_protocol_req(act2000_card *, act2000_chan *);
349extern void actcapi_disconnect_b3_req(act2000_card *, act2000_chan *);
350extern void actcapi_connect_resp(act2000_card *, act2000_chan *, __u8);
351extern void actcapi_dispatch(struct work_struct *);
352#ifdef DEBUG_MSG
353extern void actcapi_debug_msg(struct sk_buff *skb, int);
354#else
355#define actcapi_debug_msg(skb, len)
356#endif
357#endif
358