1 $Id: INTERFACE,v 1.15.8.2 2001/03/13 16:17:07 kai Exp $
3 Description of the Interface between Linklevel and Hardwarelevel
7 The Communication between Linklevel (LL) and Hardwarelevel (HL)
8 is based on the struct isdn_if (defined in isdnif.h).
10 An HL-driver can register itself at LL by calling the function
11 register_isdn() with a pointer to that struct. Prior to that, it has
12 to preset some of the fields of isdn_if. The LL sets the rest of
13 the fields. All further communication is done via callbacks using
14 the function-pointers defined in isdn_if.
16 Changes/Version numbering:
18 During development of the ISDN subsystem, several changes have been
19 made to the interface. Before it went into kernel, the package
20 had a unique version number. The last version, distributed separately
21 was 0.7.4. When the subsystem went into kernel, every functional unit
22 got a separate version number. These numbers are shown at initialization,
25 c.c/t.t/n.n/p.p/a.a/v.v
29 c.c is the revision of the common code.
30 t.t is the revision of the tty related code.
31 n.n is the revision of the network related code.
32 p.p is the revision of the ppp related code.
33 a.a is the revision of the audio related code.
34 v.v is the revision of the V.110 related code.
36 Changes in this document are marked with '***CHANGEx' where x representing
37 the version number. If that number starts with 0, it refers to the old,
38 separately distributed package. If it starts with one of the letters
39 above, it refers to the revision of the corresponding module.
40 ***CHANGEIx refers to the revision number of the isdnif.h
42 1. Description of the fields of isdn_if:
46 This field has to be set by the HL-driver to the number of channels
47 supported prior to calling register_isdn(). Upon return of the call,
48 the LL puts an id there, which has to be used by the HL-driver when
49 invoking the other callbacks.
53 ***CHANGE0.6: New since this version.
55 Also to be preset by the HL-driver. With this value the HL-driver
56 tells the LL the maximum size of a data-packet it will accept.
58 unsigned long features;
60 To be preset by the HL-driver. Using this field, the HL-driver
61 announces the features supported. At the moment this is limited to
62 report the supported layer2 and layer3-protocols. For setting this
63 field the constants ISDN_FEATURE..., declared in isdnif.h have to be
66 ***CHANGE0.7.1: The line type (1TR6, EDSS1) has to be set.
68 unsigned short hl_hdrlen;
70 ***CHANGE0.7.4: New field.
72 To be preset by the HL-driver, if it supports sk_buff's. The driver
73 should put here the amount of additional space needed in sk_buff's for
74 its internal purposes. Drivers not supporting sk_buff's should
75 initialize this field to 0.
77 void (*rcvcallb_skb)(int, int, struct sk_buff *)
79 ***CHANGE0.7.4: New field.
81 This field will be set by LL. The HL-driver delivers received data-
82 packets by calling this function. Upon calling, the HL-driver must
83 already have its private data pulled off the head of the sk_buff.
87 int Channel-number locally to the driver. (starting with 0)
88 struct sk_buff * Pointer to sk_buff, containing received data.
90 int (*statcallb)(isdn_ctrl*);
92 This field will be set by LL. This function has to be called by the
93 HL-driver for signaling status-changes or other events to the LL.
98 The struct isdn_ctrl also defined in isdn_if. The exact meanings of its
99 fields are described together with the descriptions of the possible
100 events. Here is only a short description of the fields:
103 command = event-type. (one of the constants ISDN_STAT_...)
104 arg = depends on event-type.
105 num = depends on event-type.
108 0 on success, else -1
110 int (*command)(isdn_ctrl*);
112 This field has to be preset by the HL-driver. It points to a function,
113 to be called by LL to perform functions like dialing, B-channel
114 setup, etc. The exact meaning of the parameters is described with the
115 descriptions of the possible commands.
120 command = command to perform. (one of the constants ISDN_CMD_...)
121 arg = depends on command.
122 num = depends on command.
125 >=0 on success, else error-code (-ENODEV etc.)
127 int (*writebuf_skb)(int, int, int, struct sk_buff *)
129 ***CHANGE0.7.4: New field.
130 ***CHANGEI.1.21: New field.
132 This field has to be preset by the HL-driver. The given function will
133 be called by the LL for delivering data to be send via B-Channel.
137 int driver-Id ***CHANGE0.7.4: New parameter.
138 int channel-number locally to the HL-driver. (starts with 0)
139 int ack ***ChangeI1.21: New parameter
140 If this is !0, the driver has to signal the delivery
141 by sending an ISDN_STAT_BSENT. If this is 0, the driver
142 MUST NOT send an ISDN_STAT_BSENT.
143 struct sk_buff * Pointer to sk_buff containing data to be send via
147 Length of data accepted on success, else error-code (-EINVAL on
148 oversized packets etc.)
150 int (*writecmd)(u_char*, int, int, int, int);
152 This field has to be preset by the HL-driver. The given function will be
153 called to perform write-requests on /dev/isdnctrl (i.e. sending commands
154 to the card) The data-format is hardware-specific. This function is
155 intended for debugging only. It is not necessary for normal operation
156 and never will be called by the tty-emulation- or network-code. If
157 this function is not supported, the driver has to set NULL here.
160 u_char* pointer to data.
162 int flag: 0 = call from within kernel-space. (HL-driver must use
163 memcpy, may NOT use schedule())
164 1 = call from user-space. (HL-driver must use
165 memcpy_fromfs, use of schedule() allowed)
167 int channel-number locally to the HL-driver. (starts with 0)
169 ***CHANGEI1.14: The driver-Id and channel-number are new since this revision.
172 Length of data accepted on success, else error-code (-EINVAL etc.)
174 int (*readstat)(u_char*, int, int, int, int);
176 This field has to be preset by the HL-driver. The given function will be
177 called to perform read-requests on /dev/isdnctrl (i.e. reading replies
178 from the card) The data-format is hardware-specific. This function is
179 intended for debugging only. It is not necessary for normal operation
180 and never will be called by the tty-emulation- or network-code. If
181 this function is not supported, the driver has to set NULL here.
184 u_char* pointer to data.
186 int flag: 0 = call from within kernel-space. (HL-driver must use
187 memcpy, may NOT use schedule())
188 1 = call from user-space. (HL-driver must use
189 memcpy_fromfs, use of schedule() allowed)
191 int channel-number locally to the HL-driver. (starts with 0)
193 ***CHANGEI1.14: The driver-Id and channel-number are new since this revision.
196 Length of data on success, else error-code (-EINVAL etc.)
199 ***CHANGE0.7: New since this version.
201 This string has to be preset by the HL-driver. Its purpose is for
202 identification of the driver by the user. Eg.: it is shown in the
203 status-info of /dev/isdninfo. Furthermore it is used as Id for binding
204 net-interfaces to a specific channel. If a string of length zero is
205 given, upon return, isdn4linux will replace it by a generic name. (line0,
206 line1 etc.) It is recommended to make this string configurable during
207 module-load-time. (copy a global variable to this string.) For doing that,
208 modules 1.2.8 or newer are necessary.
210 2. Description of the commands, a HL-driver has to support:
212 All commands will be performed by calling the function command() described
213 above from within the LL. The field command of the struct-parameter will
214 contain the desired command, the field driver is always set to the
215 appropriate driver-Id.
217 Until now, the following commands are defined:
219 ***CHANGEI1.34: The parameter "num" has been replaced by a union "parm" containing
220 the old "num" and a new setup_type struct used for ISDN_CMD_DIAL
221 and ISDN_STAT_ICALL callback.
225 This command is intended for performing ioctl-calls for configuring
226 hardware or similar purposes (setting port-addresses, loading firmware
227 etc.) For this purpose, in the LL all ioctl-calls with an argument
228 >= IIOCDRVCTL (0x100) will be handed transparently to this
229 function after subtracting 0x100 and placing the result in arg.
231 If a userlevel-program calls ioctl(0x101,...) the function gets
232 called with the field command set to 1.
236 command = ISDN_CMD_IOCTL
237 arg = Original ioctl-cmd - IIOCDRVCTL
238 parm.num = first bytes filled with (unsigned long)arg
246 This command is used to tell the HL-driver it should dial a given
251 command = ISDN_CMD_DIAL
252 arg = channel-number locally to the driver. (starting with 0)
254 parm.setup.phone = An ASCII-String containing the number to dial.
255 parm.setup.eazmsn = An ASCII-Sting containing the own EAZ or MSN.
256 parm.setup.si1 = The Service-Indicator.
257 parm.setup.si2 = Additional Service-Indicator.
259 If the Line has been designed as SPV (a special german
260 feature, meaning semi-leased-line) the phone has to
262 ***CHANGE0.6: In previous versions the EAZ has been given in the
264 ***CHANGE0.7.1: New since this version: ServiceIndicator and AddInfo.
268 With this command, the HL-driver is told to accept a D-Channel-setup.
269 (Response to an incoming call)
273 command = ISDN_CMD_ACCEPTD
274 arg = channel-number locally to the driver. (starting with 0)
279 With this command, the HL-driver is told to perform a B-Channel-setup.
280 (after establishing D-Channel-Connection)
284 command = ISDN_CMD_ACCEPTB
285 arg = channel-number locally to the driver. (starting with 0)
290 With this command, the HL-driver is told to hangup (B-Channel if
291 established first, then D-Channel). This command is also used for
292 actively rejecting an incoming call.
296 command = ISDN_CMD_HANGUP
297 arg = channel-number locally to the driver. (starting with 0)
302 With this command, the HL-driver is told not to signal incoming
307 command = ISDN_CMD_CLREAZ
308 arg = channel-number locally to the driver. (starting with 0)
313 With this command, the HL-driver is told to signal incoming calls for
314 the given EAZs/MSNs to the LL.
318 command = ISDN_CMD_SETEAZ
319 arg = channel-number locally to the driver. (starting with 0)
320 parm.num = ASCII-String, containing the desired EAZ's/MSN's
321 (comma-separated). If an empty String is given, the
322 HL-driver should respond to ALL incoming calls,
323 regardless of the destination-address.
324 ***CHANGE0.6: New since this version the "empty-string"-feature.
326 ISDN_CMD_GETEAZ: (currently unused)
328 With this command, the HL-driver is told to report the current setting
329 given with ISDN_CMD_SETEAZ.
333 command = ISDN_CMD_GETEAZ
334 arg = channel-number locally to the driver. (starting with 0)
335 parm.num = ASCII-String, containing the current EAZ's/MSN's
337 ISDN_CMD_SETSIL: (currently unused)
339 With this command, the HL-driver is told to signal only incoming
340 calls with the given Service-Indicators.
344 command = ISDN_CMD_SETSIL
345 arg = channel-number locally to the driver. (starting with 0)
346 parm.num = ASCII-String, containing the desired Service-Indicators.
348 ISDN_CMD_GETSIL: (currently unused)
350 With this command, the HL-driver is told to return the current
351 Service-Indicators it will respond to.
355 command = ISDN_CMD_SETSIL
356 arg = channel-number locally to the driver. (starting with 0)
357 parm.num = ASCII-String, containing the current Service-Indicators.
361 With this command, the HL-driver is told to select the given Layer-2-
362 protocol. This command is issued by the LL prior to ISDN_CMD_DIAL or
368 command = ISDN_CMD_SETL2
369 arg = channel-number locally to the driver. (starting with 0)
370 logical or'ed with (protocol-Id << 8)
371 protocol-Id is one of the constants ISDN_PROTO_L2...
374 ISDN_CMD_GETL2: (currently unused)
376 With this command, the HL-driver is told to return the current
377 setting of the Layer-2-protocol.
381 command = ISDN_CMD_GETL2
382 arg = channel-number locally to the driver. (starting with 0)
385 current protocol-Id (one of the constants ISDN_L2_PROTO)
389 With this command, the HL-driver is told to select the given Layer-3-
390 protocol. This command is issued by the LL prior to ISDN_CMD_DIAL or
396 command = ISDN_CMD_SETL3
397 arg = channel-number locally to the driver. (starting with 0)
398 logical or'ed with (protocol-Id << 8)
399 protocol-Id is one of the constants ISDN_PROTO_L3...
400 parm.fax = Pointer to T30_s fax struct. (fax usage only)
402 ISDN_CMD_GETL2: (currently unused)
404 With this command, the HL-driver is told to return the current
405 setting of the Layer-3-protocol.
409 command = ISDN_CMD_GETL3
410 arg = channel-number locally to the driver. (starting with 0)
413 current protocol-Id (one of the constants ISDN_L3_PROTO)
417 With this command, the HL-driver is told to proceed with a incoming call.
421 command = ISDN_CMD_PROCEED
422 arg = channel-number locally to the driver. (starting with 0)
423 setup.eazmsn= empty string or string send as uus1 in DSS1 with
428 With this command, the HL-driver is told to alert a proceeding call.
432 command = ISDN_CMD_ALERT
433 arg = channel-number locally to the driver. (starting with 0)
434 setup.eazmsn= empty string or string send as uus1 in DSS1 with
439 With this command, the HL-driver is told to redirect a call in proceeding
444 command = ISDN_CMD_REDIR
445 arg = channel-number locally to the driver. (starting with 0)
446 setup.eazmsn= empty string or string send as uus1 in DSS1 protocol
447 setup.screen= screening indicator
448 setup.phone = redirected to party number
452 With this call, the LL-driver invokes protocol specific features through
454 The call is not implicitely bound to a connection.
458 command = ISDN_CMD_PROT_IO
459 arg = The lower 8 Bits define the addressed protocol as defined
460 in ISDN_PTYPE..., the upper bits are used to differentiate
461 the protocol specific CMD.
463 para = protocol and function specific. See isdnif.h for detail.
468 With this command the HL-driver receives a fax sub-command.
469 For details refer to INTERFACE.fax
473 command = ISDN_CMD_FAXCMD
474 arg = channel-number locally to the driver. (starting with 0)
478 3. Description of the events to be signaled by the HL-driver to the LL.
480 All status-changes are signaled via calling the previously described
481 function statcallb(). The field command of the struct isdn_cmd has
482 to be set by the HL-driver with the appropriate Status-Id (event-number).
483 The field arg has to be set to the channel-number (locally to the driver,
484 starting with 0) to which this event applies. (Exception: STAVAIL-event)
486 Until now, the following Status-Ids are defined:
490 With this call, the HL-driver signals the availability of new data
491 for readstat(). Used only for debugging-purposes, see description
496 command = ISDN_STAT_STAVAIL
497 arg = length of available data.
503 With this call, the HL-driver signals an incoming call to the LL.
504 If ICALLW is signalled the incoming call is a waiting call without
509 command = ISDN_STAT_ICALL
510 arg = channel-number, locally to the driver. (starting with 0)
511 para.setup.phone = Callernumber.
512 para.setup.eazmsn = CalledNumber.
513 para.setup.si1 = Service Indicator.
514 para.setup.si2 = Additional Service Indicator.
515 para.setup.plan = octet 3 from Calling party number Information Element.
516 para.setup.screen = octet 3a from Calling party number Information Element.
519 0 = No device matching this call.
520 1 = At least one device matching this call (RING on ttyI).
521 HL-driver may send ALERTING on the D-channel in this case.
522 2 = Call will be rejected.
523 3 = Incoming called party number is currently incomplete.
524 Additional digits are required.
525 Used for signalling with PtP connections.
526 4 = Call will be held in a proceeding state
527 (HL driver sends PROCEEDING)
528 Used when a user space prog needs time to interpret a call
529 para.setup.eazmsn may be filled with an uus1 message of
530 30 octets maximum. Empty string if no uus.
531 5 = Call will be actively deflected to another party
532 Only available in DSS1/EURO protocol
533 para.setup.phone must be set to destination party number
534 para.setup.eazmsn may be filled with an uus1 message of
535 30 octets maximum. Empty string if no uus.
536 -1 = An error happened. (Invalid parameters for example.)
537 The keypad support now is included in the dial command.
542 With this call, the HL-driver signals availability of the ISDN-card.
543 (after initializing, loading firmware)
547 command = ISDN_STAT_RUN
553 With this call, the HL-driver signals unavailability of the ISDN-card.
554 (before unloading, while resetting/reconfiguring the card)
558 command = ISDN_STAT_STOP
564 With this call, the HL-driver signals the successful establishment of
565 a D-Channel-connection. (Response to ISDN_CMD_ACCEPTD or ISDN_CMD_DIAL)
569 command = ISDN_STAT_DCONN
570 arg = channel-number, locally to the driver. (starting with 0)
575 With this call, the HL-driver signals the successful establishment of
576 a B-Channel-connection. (Response to ISDN_CMD_ACCEPTB or because the
577 remote-station has initiated establishment)
579 The HL driver should call this when the logical l2/l3 protocol
580 connection on top of the physical B-channel is established.
584 command = ISDN_STAT_BCONN
585 arg = channel-number, locally to the driver. (starting with 0)
586 parm.num = ASCII-String, containing type of connection (for analog
587 modem only). This will be appended to the CONNECT message
592 With this call, the HL-driver signals the shutdown of a
593 D-Channel-connection. This could be a response to a prior ISDN_CMD_HANGUP,
594 or caused by a remote-hangup or if the remote-station has actively
599 command = ISDN_STAT_DHUP
600 arg = channel-number, locally to the driver. (starting with 0)
605 With this call, the HL-driver signals the shutdown of a
606 B-Channel-connection. This could be a response to a prior ISDN_CMD_HANGUP,
607 or caused by a remote-hangup.
609 The HL driver should call this as soon as the logical l2/l3 protocol
610 connection on top of the physical B-channel is released.
614 command = ISDN_STAT_BHUP
615 arg = channel-number, locally to the driver. (starting with 0)
620 With this call, the HL-driver delivers charge-unit information to the
625 command = ISDN_STAT_CINF
626 arg = channel-number, locally to the driver. (starting with 0)
627 parm.num = ASCII string containing charge-units (digits only).
629 ISDN_STAT_LOAD: (currently unused)
633 With this call, the HL-driver signals that it will be unloaded now. This
634 tells the LL to release all corresponding data-structures.
638 command = ISDN_STAT_UNLOAD
644 With this call the HL-driver signals the delivery of a data-packet.
645 This callback is used by the network-interfaces only, tty-Emulation
646 does not need this call.
650 command = ISDN_STAT_BSENT
651 arg = channel-number, locally to the driver. (starting with 0)
652 parm.length = ***CHANGEI.1.21: New field.
653 the driver has to set this to the original length
654 of the skb at the time of receiving it from the linklevel.
658 With this call, the driver has to respond to a prior ISDN_CMD_DIAL, if
659 no D-Channel is available.
663 command = ISDN_STAT_NODCH
664 arg = channel-number, locally to the driver. (starting with 0)
669 This call is for HL-drivers, which are unable to check card-type
670 or numbers of supported channels before they have loaded any firmware
671 using ioctl. Those HL-driver simply set the channel-parameter to a
672 minimum channel-number when registering, and later if they know
673 the real amount, perform this call, allocating additional channels.
677 command = ISDN_STAT_ADDCH
678 arg = number of channels to be added.
683 With this call, the HL-driver delivers CAUSE-messages to the LL.
684 Currently the LL does not use this messages. Their contents is simply
685 logged via kernel-messages. Therefore, currently the format of the
686 messages is completely free. However they should be printable.
690 command = ISDN_STAT_NODCH
691 arg = channel-number, locally to the driver. (starting with 0)
692 parm.num = ASCII string containing CAUSE-message.
696 With this call, the HL-driver delivers DISPLAY-messages to the LL.
697 Currently the LL does not use this messages.
701 command = ISDN_STAT_DISPLAY
702 arg = channel-number, locally to the driver. (starting with 0)
703 para.display= string containing DISPLAY-message.
707 With this call, the HL-driver delivers protocol specific infos to the LL.
708 The call is not implicitely bound to a connection.
712 command = ISDN_STAT_PROT
713 arg = The lower 8 Bits define the addressed protocol as defined
714 in ISDN_PTYPE..., the upper bits are used to differentiate
715 the protocol specific STAT.
717 para = protocol and function specific. See isdnif.h for detail.
721 With this call, the HL-driver signals the LL to disable or enable the
722 use of supplied channel and driver.
723 The call may be used to reduce the available number of B-channels after
724 loading the driver. The LL has to ignore a disabled channel when searching
725 for free channels. The HL driver itself never delivers STAT callbacks for
727 The LL returns a nonzero code if the operation was not successful or the
728 selected channel is actually regarded as busy.
732 command = ISDN_STAT_DISCH
733 arg = channel-number, locally to the driver. (starting with 0)
734 parm.num[0] = 0 if channel shall be disabled, else enabled.
738 ***CHANGEI1.21 new status message.
739 A signal can be sent to the linklevel if an Layer1-error results in
740 packet-loss on receive or send. The field errcode of the cmd.parm
741 union describes the error more precisely.
745 command = ISDN_STAT_L1ERR
746 arg = channel-number, locally to the driver. (starting with 0)
747 parm.errcode= ISDN_STAT_L1ERR_SEND: Packet lost while sending.
748 ISDN_STAT_L1ERR_RECV: Packet lost while receiving.
751 With this call the HL-driver signals a fax sub-command to the LL.
752 For details refer to INTERFACE.fax
756 command = ISDN_STAT_FAXIND
757 arg = channel-number, locally to the driver. (starting with 0)