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 */
82 } __attribute__((packed)) actcapi_msn;
84 typedef struct actcapi_dlpd {
85 __u8 len; /* Length of structure */
86 __u16 dlen; /* Data Length */
87 __u8 laa; /* 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 */
92 } __attribute__((packed)) actcapi_dlpd;
94 typedef struct actcapi_ncpd {
95 __u8 len; /* Length of structure */
103 } __attribute__((packed)) actcapi_ncpd;
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, ncci) { \
118 plci = fakencci & 0x1f; \
119 ncci = (fakencci >> 8) & 0xff; \
123 * Layout of PLCI field in a B3 DATA CAPI message is different from
124 * standard at act2000:
127 * Bit 5-7 = Controller
128 * Bit 8-15 = reserved (must be 0)
131 typedef struct actcapi_msg {
135 struct manufacturer_req_net {
139 } manufacturer_req_net;
140 struct manufacturer_req_v42 {
144 } manufacturer_req_v42;
145 struct manufacturer_conf_v42 {
148 } manufacturer_conf_v42;
149 struct manufacturer_req_err {
152 } manufacturer_req_err;
153 struct manufacturer_ind_err {
157 __u8 errstring; /* actually up to 160 */
158 } manufacturer_ind_err;
159 struct manufacturer_req_msn {
163 } __attribute ((packed)) manufacturer_req_msn;
164 /* TODO: TraceInit-req/conf/ind/resp and
165 * TraceDump-req/conf/ind/resp
175 } __attribute__ ((packed)) connect_req;
176 struct connect_conf {
187 } __attribute__ ((packed)) connect_ind;
188 struct connect_resp {
192 struct connect_active_ind {
195 } __attribute__ ((packed)) connect_active_ind;
196 struct connect_active_resp {
198 } connect_active_resp;
199 struct connect_b3_req {
202 } __attribute__ ((packed)) connect_b3_req;
203 struct connect_b3_conf {
208 struct connect_b3_ind {
212 } __attribute__ ((packed)) connect_b3_ind;
213 struct connect_b3_resp {
217 } __attribute__ ((packed)) connect_b3_resp;
218 struct disconnect_req {
222 struct disconnect_conf {
226 struct disconnect_ind {
230 struct disconnect_resp {
233 struct connect_b3_active_ind {
236 } __attribute__ ((packed)) connect_b3_active_ind;
237 struct connect_b3_active_resp {
239 } connect_b3_active_resp;
240 struct disconnect_b3_req {
243 } __attribute__ ((packed)) disconnect_b3_req;
244 struct disconnect_b3_conf {
247 } disconnect_b3_conf;
248 struct disconnect_b3_ind {
252 } __attribute__ ((packed)) disconnect_b3_ind;
253 struct disconnect_b3_resp {
255 } disconnect_b3_resp;
260 } __attribute__ ((packed)) info_ind;
264 struct listen_b3_req {
267 struct listen_b3_conf {
271 struct select_b2_protocol_req {
275 } __attribute__ ((packed)) select_b2_protocol_req;
276 struct select_b2_protocol_conf {
279 } select_b2_protocol_conf;
280 struct select_b3_protocol_req {
284 } __attribute__ ((packed)) select_b3_protocol_req;
285 struct select_b3_protocol_conf {
288 } select_b3_protocol_conf;
294 } __attribute__ ((packed)) listen_req;
298 } __attribute__ ((packed)) listen_conf;
305 } __attribute ((packed)) data_b3_req;
312 } __attribute__ ((packed)) data_b3_ind;
313 struct data_b3_resp {
316 } __attribute__ ((packed)) data_b3_resp;
317 struct data_b3_conf {
321 } __attribute__ ((packed)) data_b3_conf;
323 } __attribute__ ((packed)) actcapi_msg;
325 static inline unsigned short
326 actcapi_nextsmsg(act2000_card *card)
331 spin_lock_irqsave(&card->mnlock, flags);
334 card->msgnum &= 0x7fff;
335 spin_unlock_irqrestore(&card->mnlock, flags);
339 #undef DEBUG_DATA_MSG
340 #undef DEBUG_DUMP_SKB
342 extern int actcapi_chkhdr(act2000_card *, actcapi_msghdr *);
343 extern int actcapi_listen_req(act2000_card *);
344 extern int actcapi_manufacturer_req_net(act2000_card *);
345 extern int actcapi_manufacturer_req_errh(act2000_card *);
346 extern int actcapi_manufacturer_req_msn(act2000_card *);
347 extern int actcapi_connect_req(act2000_card *, act2000_chan *, char *, char, int, int);
348 extern void actcapi_select_b2_protocol_req(act2000_card *, act2000_chan *);
349 extern void actcapi_disconnect_b3_req(act2000_card *, act2000_chan *);
350 extern void actcapi_connect_resp(act2000_card *, act2000_chan *, __u8);
351 extern void actcapi_dispatch(struct work_struct *);
353 extern void actcapi_debug_msg(struct sk_buff *skb, int);
355 #define actcapi_debug_msg(skb, len)