1 /* $Id: isdnif.h,v 1.37.6.6 2001/09/23 22:25:05 kai Exp $
4 * Definition of the interface between the subsystem and its low-level drivers.
6 * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
7 * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg
9 * This software may be used and distributed according to the terms
10 * of the GNU General Public License, incorporated herein by reference.
19 * Values for general protocol-selection
21 #define ISDN_PTYPE_UNKNOWN 0 /* Protocol undefined */
22 #define ISDN_PTYPE_1TR6 1 /* german 1TR6-protocol */
23 #define ISDN_PTYPE_EURO 2 /* EDSS1-protocol */
24 #define ISDN_PTYPE_LEASED 3 /* for leased lines */
25 #define ISDN_PTYPE_NI1 4 /* US NI-1 protocol */
26 #define ISDN_PTYPE_MAX 7 /* Max. 8 Protocols */
29 * Values for Layer-2-protocol-selection
31 #define ISDN_PROTO_L2_X75I 0 /* X75/LAPB with I-Frames */
32 #define ISDN_PROTO_L2_X75UI 1 /* X75/LAPB with UI-Frames */
33 #define ISDN_PROTO_L2_X75BUI 2 /* X75/LAPB with UI-Frames */
34 #define ISDN_PROTO_L2_HDLC 3 /* HDLC */
35 #define ISDN_PROTO_L2_TRANS 4 /* Transparent (Voice) */
36 #define ISDN_PROTO_L2_X25DTE 5 /* X25/LAPB DTE mode */
37 #define ISDN_PROTO_L2_X25DCE 6 /* X25/LAPB DCE mode */
38 #define ISDN_PROTO_L2_V11096 7 /* V.110 bitrate adaption 9600 Baud */
39 #define ISDN_PROTO_L2_V11019 8 /* V.110 bitrate adaption 19200 Baud */
40 #define ISDN_PROTO_L2_V11038 9 /* V.110 bitrate adaption 38400 Baud */
41 #define ISDN_PROTO_L2_MODEM 10 /* Analog Modem on Board */
42 #define ISDN_PROTO_L2_FAX 11 /* Fax Group 2/3 */
43 #define ISDN_PROTO_L2_HDLC_56K 12 /* HDLC 56k */
44 #define ISDN_PROTO_L2_MAX 15 /* Max. 16 Protocols */
47 * Values for Layer-3-protocol-selection
49 #define ISDN_PROTO_L3_TRANS 0 /* Transparent */
50 #define ISDN_PROTO_L3_TRANSDSP 1 /* Transparent with DSP */
51 #define ISDN_PROTO_L3_FCLASS2 2 /* Fax Group 2/3 CLASS 2 */
52 #define ISDN_PROTO_L3_FCLASS1 3 /* Fax Group 2/3 CLASS 1 */
53 #define ISDN_PROTO_L3_MAX 7 /* Max. 8 Protocols */
57 #include <linux/config.h>
58 #include <linux/skbuff.h>
60 /***************************************************************************/
61 /* Extensions made by Werner Cornelius (werner@ikt.de) */
63 /* The proceed command holds a incoming call in a state to leave processes */
64 /* enough time to check whether ist should be accepted. */
65 /* The PROT_IO Command extends the interface to make protocol dependent */
66 /* features available (call diversion, call waiting...). */
68 /* The PROT_IO Command is executed with the desired driver id and the arg */
69 /* parameter coded as follows: */
70 /* The lower 8 bits of arg contain the desired protocol from ISDN_PTYPE */
71 /* definitions. The upper 24 bits represent the protocol specific cmd/stat.*/
72 /* Any additional data is protocol and command specific. */
73 /* This mechanism also applies to the statcallb callback STAT_PROT. */
75 /* This suggested extension permits an easy expansion of protocol specific */
76 /* handling. Extensions may be added at any time without changing the HL */
77 /* driver code and not getting conflicts without certifications. */
78 /* The well known CAPI 2.0 interface handles such extensions in a similar */
79 /* way. Perhaps a protocol specific module may be added and separately */
80 /* loaded and linked to the basic isdn module for handling. */
81 /***************************************************************************/
86 #define DSS1_CMD_INVOKE ((0x00 << 8) | ISDN_PTYPE_EURO) /* invoke a supplementary service */
87 #define DSS1_CMD_INVOKE_ABORT ((0x01 << 8) | ISDN_PTYPE_EURO) /* abort a invoke cmd */
89 /*******************************/
90 /* DSS1 Status callback values */
91 /*******************************/
92 #define DSS1_STAT_INVOKE_RES ((0x80 << 8) | ISDN_PTYPE_EURO) /* Result for invocation */
93 #define DSS1_STAT_INVOKE_ERR ((0x81 << 8) | ISDN_PTYPE_EURO) /* Error Return for invocation */
94 #define DSS1_STAT_INVOKE_BRD ((0x82 << 8) | ISDN_PTYPE_EURO) /* Deliver invoke broadcast info */
97 /*********************************************************************/
98 /* structures for DSS1 commands and callback */
100 /* An action is invoked by sending a DSS1_CMD_INVOKE. The ll_id, proc*/
101 /* timeout, datalen and data fields must be set before calling. */
103 /* The return value is a positive hl_id value also delivered in the */
104 /* hl_id field. A value of zero signals no more left hl_id capacitys.*/
105 /* A negative return value signals errors in LL. So if the return */
106 /* value is <= 0 no action in LL will be taken -> request ignored */
108 /* The timeout field must be filled with a positive value specifying */
109 /* the amount of time the INVOKED process waits for a reaction from */
111 /* If a response (either error or result) is received during this */
112 /* intervall, a reporting callback is initiated and the process will */
113 /* be deleted, the hl identifier will be freed. */
114 /* If no response is received during the specified intervall, a error*/
115 /* callback is initiated with timeout set to -1 and a datalen set */
117 /* If timeout is set to a value <= 0 during INVOCATION the process is*/
118 /* immediately deleted after sending the data. No callback occurs ! */
120 /* A currently waiting process may be aborted with INVOKE_ABORT. No */
121 /* callback will occur when a process has been aborted. */
123 /* Broadcast invoke frames from the network are reported via the */
124 /* STAT_INVOKE_BRD callback. The ll_id is set to 0, the other fields */
125 /* are supplied by the network and not by the HL. */
126 /*********************************************************************/
131 #define NI1_CMD_INVOKE ((0x00 << 8) | ISDN_PTYPE_NI1) /* invoke a supplementary service */
132 #define NI1_CMD_INVOKE_ABORT ((0x01 << 8) | ISDN_PTYPE_NI1) /* abort a invoke cmd */
134 /*******************************/
135 /* NI1 Status callback values */
136 /*******************************/
137 #define NI1_STAT_INVOKE_RES ((0x80 << 8) | ISDN_PTYPE_NI1) /* Result for invocation */
138 #define NI1_STAT_INVOKE_ERR ((0x81 << 8) | ISDN_PTYPE_NI1) /* Error Return for invocation */
139 #define NI1_STAT_INVOKE_BRD ((0x82 << 8) | ISDN_PTYPE_NI1) /* Deliver invoke broadcast info */
142 { ulong ll_id
; /* ID supplied by LL when executing */
143 /* a command and returned by HL for */
144 /* INVOKE_RES and INVOKE_ERR */
145 int hl_id
; /* ID supplied by HL when called */
146 /* for executing a cmd and delivered */
147 /* for results and errors */
148 /* must be supplied by LL when aborting*/
149 int proc
; /* invoke procedure used by CMD_INVOKE */
150 /* returned by callback and broadcast */
151 int timeout
; /* timeout for INVOKE CMD in ms */
152 /* -1 in stat callback when timed out */
153 /* error value when error callback */
154 int datalen
; /* length of cmd or stat data */
155 u_char
*data
;/* pointer to data delivered or send */
159 * Commands from linklevel to lowlevel
162 #define ISDN_CMD_IOCTL 0 /* Perform ioctl */
163 #define ISDN_CMD_DIAL 1 /* Dial out */
164 #define ISDN_CMD_ACCEPTD 2 /* Accept an incoming call on D-Chan. */
165 #define ISDN_CMD_ACCEPTB 3 /* Request B-Channel connect. */
166 #define ISDN_CMD_HANGUP 4 /* Hangup */
167 #define ISDN_CMD_CLREAZ 5 /* Clear EAZ(s) of channel */
168 #define ISDN_CMD_SETEAZ 6 /* Set EAZ(s) of channel */
169 #define ISDN_CMD_SETL2 10 /* Set B-Chan. Layer2-Parameter */
170 #define ISDN_CMD_SETL3 12 /* Set B-Chan. Layer3-Parameter */
171 #define ISDN_CMD_PROCEED 18 /* Proceed with call establishment */
172 #define ISDN_CMD_ALERT 19 /* Alert after Proceeding */
173 #define ISDN_CMD_REDIR 20 /* Redir a incoming call */
174 #define ISDN_CMD_PROT_IO 21 /* Protocol specific commands */
175 #define CAPI_PUT_MESSAGE 22 /* CAPI message send down or up */
176 #define ISDN_CMD_FAXCMD 23 /* FAX commands to HL-driver */
177 #define ISDN_CMD_AUDIO 24 /* DSP, DTMF, ... settings */
180 * Status-Values delivered from lowlevel to linklevel via
184 #define ISDN_STAT_STAVAIL 256 /* Raw status-data available */
185 #define ISDN_STAT_ICALL 257 /* Incoming call detected */
186 #define ISDN_STAT_RUN 258 /* Signal protocol-code is running */
187 #define ISDN_STAT_STOP 259 /* Signal halt of protocol-code */
188 #define ISDN_STAT_DCONN 260 /* Signal D-Channel connect */
189 #define ISDN_STAT_BCONN 261 /* Signal B-Channel connect */
190 #define ISDN_STAT_DHUP 262 /* Signal D-Channel disconnect */
191 #define ISDN_STAT_BHUP 263 /* Signal B-Channel disconnect */
192 #define ISDN_STAT_CINF 264 /* Charge-Info */
193 #define ISDN_STAT_LOAD 265 /* Signal new lowlevel-driver is loaded */
194 #define ISDN_STAT_UNLOAD 266 /* Signal unload of lowlevel-driver */
195 #define ISDN_STAT_BSENT 267 /* Signal packet sent */
196 #define ISDN_STAT_ADDCH 269 /* Add more Channels */
197 #define ISDN_STAT_CAUSE 270 /* Cause-Message */
198 #define ISDN_STAT_ICALLW 271 /* Incoming call without B-chan waiting */
199 #define ISDN_STAT_REDIR 272 /* Redir result */
200 #define ISDN_STAT_PROT 273 /* protocol IO specific callback */
201 #define ISDN_STAT_DISPLAY 274 /* deliver a received display message */
202 #define ISDN_STAT_FAXIND 276 /* FAX indications from HL-driver */
203 #define ISDN_STAT_AUDIO 277 /* DTMF, DSP indications */
204 #define ISDN_STAT_DISCH 278 /* Disable/Enable channel usage */
209 #define ISDN_AUDIO_SETDD 0 /* Set DTMF detection */
210 #define ISDN_AUDIO_DTMF 1 /* Rx/Tx DTMF */
213 * Values for feature-field of interface-struct.
216 #define ISDN_FEATURE_L2_X75I (0x0001 << ISDN_PROTO_L2_X75I)
217 #define ISDN_FEATURE_L2_X75UI (0x0001 << ISDN_PROTO_L2_X75UI)
218 #define ISDN_FEATURE_L2_X75BUI (0x0001 << ISDN_PROTO_L2_X75BUI)
219 #define ISDN_FEATURE_L2_HDLC (0x0001 << ISDN_PROTO_L2_HDLC)
220 #define ISDN_FEATURE_L2_TRANS (0x0001 << ISDN_PROTO_L2_TRANS)
221 #define ISDN_FEATURE_L2_X25DTE (0x0001 << ISDN_PROTO_L2_X25DTE)
222 #define ISDN_FEATURE_L2_X25DCE (0x0001 << ISDN_PROTO_L2_X25DCE)
223 #define ISDN_FEATURE_L2_V11096 (0x0001 << ISDN_PROTO_L2_V11096)
224 #define ISDN_FEATURE_L2_V11019 (0x0001 << ISDN_PROTO_L2_V11019)
225 #define ISDN_FEATURE_L2_V11038 (0x0001 << ISDN_PROTO_L2_V11038)
226 #define ISDN_FEATURE_L2_MODEM (0x0001 << ISDN_PROTO_L2_MODEM)
227 #define ISDN_FEATURE_L2_FAX (0x0001 << ISDN_PROTO_L2_FAX)
228 #define ISDN_FEATURE_L2_HDLC_56K (0x0001 << ISDN_PROTO_L2_HDLC_56K)
230 #define ISDN_FEATURE_L2_MASK (0x0FFFF) /* Max. 16 protocols */
231 #define ISDN_FEATURE_L2_SHIFT (0)
234 #define ISDN_FEATURE_L3_TRANS (0x10000 << ISDN_PROTO_L3_TRANS)
235 #define ISDN_FEATURE_L3_TRANSDSP (0x10000 << ISDN_PROTO_L3_TRANSDSP)
236 #define ISDN_FEATURE_L3_FCLASS2 (0x10000 << ISDN_PROTO_L3_FCLASS2)
237 #define ISDN_FEATURE_L3_FCLASS1 (0x10000 << ISDN_PROTO_L3_FCLASS1)
239 #define ISDN_FEATURE_L3_MASK (0x0FF0000) /* Max. 8 Protocols */
240 #define ISDN_FEATURE_L3_SHIFT (16)
243 #define ISDN_FEATURE_P_UNKNOWN (0x1000000 << ISDN_PTYPE_UNKNOWN)
244 #define ISDN_FEATURE_P_1TR6 (0x1000000 << ISDN_PTYPE_1TR6)
245 #define ISDN_FEATURE_P_EURO (0x1000000 << ISDN_PTYPE_EURO)
246 #define ISDN_FEATURE_P_NI1 (0x1000000 << ISDN_PTYPE_NI1)
248 #define ISDN_FEATURE_P_MASK (0x0FF000000) /* Max. 8 Protocols */
249 #define ISDN_FEATURE_P_SHIFT (24)
251 typedef struct setup_parm
{
252 unsigned char phone
[32]; /* Remote Phone-Number */
253 unsigned char eazmsn
[32]; /* Local EAZ or MSN */
254 unsigned char si1
; /* Service Indicator 1 */
255 unsigned char si2
; /* Service Indicator 2 */
256 unsigned char plan
; /* Numbering plan */
257 unsigned char screen
; /* Screening info */
265 typedef struct T30_s
{
266 /* session parameters */
267 __u8 resolution
__attribute__ ((packed
));
268 __u8 rate
__attribute__ ((packed
));
269 __u8 width
__attribute__ ((packed
));
270 __u8 length
__attribute__ ((packed
));
271 __u8 compression
__attribute__ ((packed
));
272 __u8 ecm
__attribute__ ((packed
));
273 __u8 binary
__attribute__ ((packed
));
274 __u8 scantime
__attribute__ ((packed
));
275 __u8 id
[FAXIDLEN
] __attribute__ ((packed
));
276 /* additional parameters */
277 __u8 phase
__attribute__ ((packed
));
278 __u8 direction
__attribute__ ((packed
));
279 __u8 code
__attribute__ ((packed
));
280 __u8 badlin
__attribute__ ((packed
));
281 __u8 badmul
__attribute__ ((packed
));
282 __u8 bor
__attribute__ ((packed
));
283 __u8 fet
__attribute__ ((packed
));
284 __u8 pollid
[FAXIDLEN
] __attribute__ ((packed
));
285 __u8 cq
__attribute__ ((packed
));
286 __u8 cr
__attribute__ ((packed
));
287 __u8 ctcrty
__attribute__ ((packed
));
288 __u8 minsp
__attribute__ ((packed
));
289 __u8 phcto
__attribute__ ((packed
));
290 __u8 rel
__attribute__ ((packed
));
291 __u8 nbc
__attribute__ ((packed
));
292 /* remote station parameters */
293 __u8 r_resolution
__attribute__ ((packed
));
294 __u8 r_rate
__attribute__ ((packed
));
295 __u8 r_width
__attribute__ ((packed
));
296 __u8 r_length
__attribute__ ((packed
));
297 __u8 r_compression
__attribute__ ((packed
));
298 __u8 r_ecm
__attribute__ ((packed
));
299 __u8 r_binary
__attribute__ ((packed
));
300 __u8 r_scantime
__attribute__ ((packed
));
301 __u8 r_id
[FAXIDLEN
] __attribute__ ((packed
));
302 __u8 r_code
__attribute__ ((packed
));
305 #define ISDN_TTY_FAX_CONN_IN 0
306 #define ISDN_TTY_FAX_CONN_OUT 1
308 #define ISDN_TTY_FAX_FCON 0
309 #define ISDN_TTY_FAX_DIS 1
310 #define ISDN_TTY_FAX_FTT 2
311 #define ISDN_TTY_FAX_MCF 3
312 #define ISDN_TTY_FAX_DCS 4
313 #define ISDN_TTY_FAX_TRAIN_OK 5
314 #define ISDN_TTY_FAX_EOP 6
315 #define ISDN_TTY_FAX_EOM 7
316 #define ISDN_TTY_FAX_MPS 8
317 #define ISDN_TTY_FAX_DTC 9
318 #define ISDN_TTY_FAX_RID 10
319 #define ISDN_TTY_FAX_HNG 11
320 #define ISDN_TTY_FAX_DT 12
321 #define ISDN_TTY_FAX_FCON_I 13
322 #define ISDN_TTY_FAX_DR 14
323 #define ISDN_TTY_FAX_ET 15
324 #define ISDN_TTY_FAX_CFR 16
325 #define ISDN_TTY_FAX_PTS 17
326 #define ISDN_TTY_FAX_SENT 18
328 #define ISDN_FAX_PHASE_IDLE 0
329 #define ISDN_FAX_PHASE_A 1
330 #define ISDN_FAX_PHASE_B 2
331 #define ISDN_FAX_PHASE_C 3
332 #define ISDN_FAX_PHASE_D 4
333 #define ISDN_FAX_PHASE_E 5
335 #define ISDN_FAX_CLASS1_FAE 0
336 #define ISDN_FAX_CLASS1_FTS 1
337 #define ISDN_FAX_CLASS1_FRS 2
338 #define ISDN_FAX_CLASS1_FTM 3
339 #define ISDN_FAX_CLASS1_FRM 4
340 #define ISDN_FAX_CLASS1_FTH 5
341 #define ISDN_FAX_CLASS1_FRH 6
342 #define ISDN_FAX_CLASS1_CTRL 7
344 #define ISDN_FAX_CLASS1_OK 0
345 #define ISDN_FAX_CLASS1_CONNECT 1
346 #define ISDN_FAX_CLASS1_NOCARR 2
347 #define ISDN_FAX_CLASS1_ERROR 3
348 #define ISDN_FAX_CLASS1_FCERROR 4
349 #define ISDN_FAX_CLASS1_QUERY 5
358 #define AT_EQ_VALUE 1
360 #define AT_EQ_QUERY 3
364 /* this is compatible to the old union size */
365 #define MAX_CAPI_PARA_LEN 50
381 __u8 para
[MAX_CAPI_PARA_LEN
];
385 * Structure for exchanging above infos
389 int driver
; /* Lowlevel-Driver-ID */
390 int command
; /* Command or Status (see above) */
391 ulong arg
; /* Additional Data */
393 ulong errcode
; /* Type of error with STAT_L1ERR */
394 int length
; /* Amount of bytes sent with STAT_BSENT */
395 u_char num
[50]; /* Additional Data */
396 setup_parm setup
;/* For SETUP msg */
397 capi_msg cmsg
; /* For CAPI like messages */
398 char display
[85];/* display message data */
399 isdn_cmd_stat isdn_io
; /* ISDN IO-parameter/result */
400 aux_s aux
; /* for modem commands/indications */
401 T30_s
*fax
; /* Pointer to ttys fax struct */
402 ulong userdata
; /* User Data */
406 #define dss1_io isdn_io
407 #define ni1_io isdn_io
410 * The interface-struct itself (initialized at load-time of lowlevel-driver)
412 * See Documentation/isdn/INTERFACE for a description, how the communication
413 * between the ISDN subsystem and its drivers is done.
417 struct module
*owner
;
419 /* Number of channels supported by this driver
424 * Maximum Size of transmit/receive-buffer this driver supports.
428 /* Feature-Flags for this driver.
429 * See defines ISDN_FEATURE_... for Values
431 unsigned long features
;
434 * Needed for calculating
435 * dev->hard_header_len = linklayer header + hl_hdrlen;
436 * Drivers, not supporting sk_buff's should set this to 0.
438 unsigned short hl_hdrlen
;
441 * Receive-Callback using sk_buff's
444 * int local channel-number (0 ...)
445 * struct sk_buff *skb received Data
447 void (*rcvcallb_skb
)(int, int, struct sk_buff
*);
452 * driver = Driver ID.
453 * command = One of above ISDN_STAT_... constants.
454 * arg = depending on status-type.
455 * num = depending on status-type.
457 int (*statcallb
)(isdn_ctrl
*);
462 * driver = Driver ID.
463 * command = One of above ISDN_CMD_... constants.
464 * arg = depending on command.
465 * num = depending on command.
467 int (*command
)(isdn_ctrl
*);
470 * Send data using sk_buff's
473 * int local channel-number (0...)
474 * int Flag: Need ACK for this packet.
475 * struct sk_buff *skb Data to send
477 int (*writebuf_skb
) (int, int, int, struct sk_buff
*);
479 /* Send raw D-Channel-Commands
481 * u_char pointer data
483 * int Flag: 0 = Call form Kernel-Space (use memcpy,
484 * no schedule allowed)
485 * 1 = Data is in User-Space (use memcpy_fromfs,
488 * int local channel-number (0 ...)
490 int (*writecmd
)(const u_char
*, int, int, int, int);
492 /* Read raw Status replies
493 * u_char pointer data (volatile)
494 * int length of buffer
495 * int Flag: 0 = Call form Kernel-Space (use memcpy,
496 * no schedule allowed)
497 * 1 = Data is in User-Space (use memcpy_fromfs,
500 * int local channel-number (0 ...)
502 int (*readstat
)(u_char
*, int, int, int, int);
508 * Function which must be called by lowlevel-driver at loadtime with
509 * the following fields of above struct set:
511 * channels Number of channels that will be supported.
512 * hl_hdrlen Space to preserve in sk_buff's when sending. Drivers, not
513 * supporting sk_buff's should set this to 0.
514 * command Address of Command-Handler.
515 * features Bitwise coded Features of this driver. (use ISDN_FEATURE_...)
516 * writebuf_skb Address of Skbuff-Send-Handler.
517 * writecmd " " D-Channel " which accepts raw D-Ch-Commands.
518 * readstat " " D-Channel " which delivers raw Status-Data.
520 * The linklevel-driver fills the following fields:
522 * channels Driver-ID assigned to this driver. (Must be used on all
523 * subsequent callbacks.
524 * rcvcallb_skb Address of handler for received Skbuff's.
525 * statcallb " " " for status-changes.
528 extern int register_isdn(isdn_if
*);
529 #include <asm/uaccess.h>
531 #endif /* __KERNEL__ */
533 #endif /* __ISDNIF_H__ */