1 /* $Id: capi.h,v 1.6.6.2 2001/09/23 22:24:32 kai Exp $
3 * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
6 * Copyright by Fritz Elfert <fritz@isdn4linux.de>
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
11 * Thanks to Friedemann Baitinger and IBM Germany
18 /* Command-part of a CAPI message */
19 typedef struct actcapi_msgcmd
{
24 /* CAPI message header */
25 typedef struct actcapi_msghdr
{
32 /* CAPI message description (for debugging) */
33 typedef struct actcapi_msgdsc
{
39 typedef struct actcapi_addr
{
40 __u8 len
; /* Length of element */
41 __u8 tnp
; /* Type/Numbering Plan */
42 __u8 num
[20]; /* Caller ID */
45 /* CAPI INFO element mask */
46 typedef union actcapi_infonr
{ /* info number */
47 __u16 mask
; /* info-mask field */
48 struct bmask
{ /* bit definitions */
49 unsigned codes
: 3; /* code set */
50 unsigned rsvd
: 5; /* reserved */
51 unsigned svind
: 1; /* single, variable length ind. */
52 unsigned wtype
: 7; /* W-element type */
56 /* CAPI INFO element */
57 typedef union actcapi_infoel
{ /* info element */
58 __u8 len
; /* length of info element */
59 __u8 display
[40]; /* display contents */
60 __u8 uuinfo
[40]; /* User-user info field */
61 struct cause
{ /* Cause information */
62 unsigned ext2
: 1; /* extension */
63 unsigned cod
: 2; /* coding standard */
64 unsigned spare
: 1; /* spare */
65 unsigned loc
: 4; /* location */
66 unsigned ext1
: 1; /* extension */
67 unsigned cval
: 7; /* Cause value */
69 struct charge
{ /* Charging information */
70 __u8 toc
; /* type of charging info */
71 __u8 unit
[10]; /* charging units */
73 __u8 date
[20]; /* date fields */
74 __u8 stat
; /* state of remote party */
77 /* Message for EAZ<->MSN Mapping */
78 typedef struct actcapi_msn
{
80 __u8 len
; /* Length of MSN */
81 __u8 msn
[15] __attribute__ ((packed
));
84 typedef struct actcapi_dlpd
{
85 __u8 len
; /* Length of structure */
86 __u16 dlen
__attribute__ ((packed
)); /* Data Length */
87 __u8 laa
__attribute__ ((packed
)); /* Link Address A */
88 __u8 lab
; /* Link Address B */
89 __u8 modulo
; /* Modulo Mode */
90 __u8 win
; /* Window size */
91 __u8 xid
[100]; /* XID Information */
94 typedef struct actcapi_ncpd
{
95 __u8 len
; /* Length of structure */
96 __u16 lic
__attribute__ ((packed
));
97 __u16 hic
__attribute__ ((packed
));
98 __u16 ltc
__attribute__ ((packed
));
99 __u16 htc
__attribute__ ((packed
));
100 __u16 loc
__attribute__ ((packed
));
101 __u16 hoc
__attribute__ ((packed
));
102 __u8 modulo
__attribute__ ((packed
));
104 #define actcapi_ncpi actcapi_ncpd
107 * Layout of NCCI field in a B3 DATA CAPI message is different from
108 * standard at act2000:
111 * Bit 5-7 = Controller
114 #define MAKE_NCCI(plci,contr,ncci) \
115 ((plci & 0x1f) | ((contr & 0x7) << 5) | ((ncci & 0xff) << 8))
117 #define EVAL_NCCI(fakencci,plci,contr,ncci) { \
118 plci = fakencci & 0x1f; \
119 contr = (fakencci >> 5) & 0x7; \
120 ncci = (fakencci >> 8) & 0xff; \
124 * Layout of PLCI field in a B3 DATA CAPI message is different from
125 * standard at act2000:
128 * Bit 5-7 = Controller
129 * Bit 8-15 = reserved (must be 0)
131 #define MAKE_PLCI(plci,contr) \
132 ((plci & 0x1f) | ((contr & 0x7) << 5))
134 #define EVAL_PLCI(fakeplci,plci,contr) { \
135 plci = fakeplci & 0x1f; \
136 contr = (fakeplci >> 5) & 0x7; \
139 typedef struct actcapi_msg
{
143 struct manufacturer_req_net
{
147 } manufacturer_req_net
;
148 struct manufacturer_req_v42
{
152 } manufacturer_req_v42
;
153 struct manufacturer_conf_v42
{
156 } manufacturer_conf_v42
;
157 struct manufacturer_req_err
{
160 } manufacturer_req_err
;
161 struct manufacturer_ind_err
{
165 __u8 errstring
; /* actually up to 160 */
166 } manufacturer_ind_err
;
167 struct manufacturer_req_msn
{
171 } manufacturer_req_msn
;
172 /* TODO: TraceInit-req/conf/ind/resp and
173 * TraceDump-req/conf/ind/resp
178 __u32 infomask
__attribute__ ((packed
));
184 struct connect_conf
{
196 struct connect_resp
{
200 struct connect_active_ind
{
203 } connect_active_ind
;
204 struct connect_active_resp
{
206 } connect_active_resp
;
207 struct connect_b3_req
{
211 struct connect_b3_conf
{
216 struct connect_b3_ind
{
221 struct connect_b3_resp
{
224 actcapi_ncpi ncpi
__attribute__ ((packed
));
226 struct disconnect_req
{
230 struct disconnect_conf
{
234 struct disconnect_ind
{
238 struct disconnect_resp
{
241 struct connect_b3_active_ind
{
244 } connect_b3_active_ind
;
245 struct connect_b3_active_resp
{
247 } connect_b3_active_resp
;
248 struct disconnect_b3_req
{
252 struct disconnect_b3_conf
{
255 } disconnect_b3_conf
;
256 struct disconnect_b3_ind
{
261 struct disconnect_b3_resp
{
263 } disconnect_b3_resp
;
272 struct listen_b3_req
{
275 struct listen_b3_conf
{
279 struct select_b2_protocol_req
{
282 actcapi_dlpd dlpd
__attribute__ ((packed
));
283 } select_b2_protocol_req
;
284 struct select_b2_protocol_conf
{
287 } select_b2_protocol_conf
;
288 struct select_b3_protocol_req
{
291 actcapi_ncpd ncpd
__attribute__ ((packed
));
292 } select_b3_protocol_req
;
293 struct select_b3_protocol_conf
{
296 } select_b3_protocol_conf
;
299 __u32 infomask
__attribute__ ((packed
));
300 __u16 eazmask
__attribute__ ((packed
));
301 __u16 simask
__attribute__ ((packed
));
305 __u16 info
__attribute__ ((packed
));
312 __u16 flags
__attribute__ ((packed
));
319 __u16 flags
__attribute__ ((packed
));
321 struct data_b3_resp
{
325 struct data_b3_conf
{
328 __u16 info
__attribute__ ((packed
));
333 extern __inline__
unsigned short
334 actcapi_nextsmsg(act2000_card
*card
)
339 spin_lock_irqsave(&card
->mnlock
, flags
);
342 card
->msgnum
&= 0x7fff;
343 spin_unlock_irqrestore(&card
->mnlock
, flags
);
347 #undef DEBUG_DATA_MSG
348 #undef DEBUG_DUMP_SKB
350 extern int actcapi_chkhdr(act2000_card
*, actcapi_msghdr
*);
351 extern int actcapi_listen_req(act2000_card
*);
352 extern int actcapi_manufacturer_req_net(act2000_card
*);
353 extern int actcapi_manufacturer_req_v42(act2000_card
*, ulong
);
354 extern int actcapi_manufacturer_req_errh(act2000_card
*);
355 extern int actcapi_manufacturer_req_msn(act2000_card
*);
356 extern int actcapi_connect_req(act2000_card
*, act2000_chan
*, char *, char, int, int);
357 extern void actcapi_select_b2_protocol_req(act2000_card
*, act2000_chan
*);
358 extern void actcapi_disconnect_b3_req(act2000_card
*, act2000_chan
*);
359 extern void actcapi_connect_resp(act2000_card
*, act2000_chan
*, __u8
);
360 extern void actcapi_dispatch(act2000_card
*);
362 extern void actcapi_debug_msg(struct sk_buff
*skb
, int);
364 #define actcapi_debug_msg(skb, len)