1isdnio(7I)                      Ioctl Requests                      isdnio(7I)
2
3
4

NAME

6       isdnio - ISDN interfaces
7

SYNOPSIS

9       #include <sun/audioio.h>
10       #include <sun/isdnio.h>
11
12       int ioctl(int fd, int command, /* arg */ ...);
13
14

DESCRIPTION

16       ISDN  ioctl  commands are a subset of  ioctl(2) commands that perform a
17       variety of control functions on  Integrated  Services  Digital  Network
18       (ISDN) STREAMS devices. The arguments command and arg are passed to the
19       file designated by fd and are interpreted by the ISDN device driver.
20
21
22       fd is an open file descriptor that refers to a stream.  command  deter‐
23       mines  the  control function to be performed as described in the IOCTLS
24       section of this document. arg represents additional information that is
25       needed by command. The type of arg depends upon the command, but gener‐
26       ally it is an integer or a pointer to a  command-specific  data  struc‐
27       ture.
28
29
30       Since  these ISDN commands are a subset of ioctl and streamio(7I), they
31       are subject to errors as described in those interface descriptions.
32
33
34       This set of generic ISDN ioctl commands is  meant  to  control  various
35       types  of  ISDN  STREAMS  device drivers. The following paragraphs give
36       some background on various types of ISDN hardware interfaces  and  data
37       formats, and other device characteristics.
38
39   Controllers, Interfaces, and Channels
40       This  manual  page  discusses operations on, and facilities provided by
41       ISDN controllers, interfaces and channels. A controller  is  usually  a
42       hardware  peripheral  device  that provides one or more ISDN interfaces
43       and zero or more auxiliary interfaces. In this context, the term inter‐
44       face is synonymous with the term "port". Each interface can provide one
45       or more channels.
46
47   Time Division Multiplexed Serial Interfaces
48       ISDN BRI-TE, BRI-NT, and PRI interfaces are all examples of Time  Divi‐
49       sion  Multiplexed  Serial  Interfaces. As an example, a Basic Rate ISDN
50       (BRI) Terminal Equipment (TE) interface provides one D-channel and  two
51       B-channels on the same set of signal wires. The BRI interface, at the S
52       reference point, operates at a bit rate of 192,000 bits per second. The
53       bits  are  encoded  using  a pseudoternary coding system that encodes a
54       logic one as zero volts, and a logic zero as  a  positive  or  negative
55       voltage. Encoding rules state that adjacent logic zeros must be encoded
56       with opposite voltages. Violations of this rule are  used  to  indicate
57       framing  information  such  that there are 4000 frames per second, each
58       containing 48 bits. These  48  bits  are  divided  into  channels.  Not
59       including framing and synchronization bits, the frame is divided into 8
60       bits for the B1-channel, 1 bit for the D-channel, 8 bits for B2, 1  bit
61       for D, 8 bits for B1, 1 bit for D, and 8 bits for B2. This results in a
62       64,000 bps B1-channel, a 64,000 bps B2-channel, and  a  16,000  bps  D-
63       channel, all on the same serial interface.
64
65   Basic Rate ISDN
66       A  Basic  Rate  ISDN (BRI) interface consists of a 16000 bit per second
67       Delta Channel (D-channel) for signaling and X.25  packet  transmission,
68       and two 64000 bit per second Bearer Channels (B-channels) for transmis‐
69       sion of voice or data.
70
71
72       The CCITT recommendations on ISDN Basic Rate interfaces,  I.430,  iden‐
73       tify    several    "reference   points"   for   standardization.   From
74       (Stallings89): Reference point T (terminal) corresponds  to  a  minimal
75       ISDN  network  termination at the customer's premises. It separates the
76       network provider's equipment from the user's equipment. Reference point
77       S  (system)  corresponds to the interface of individual ISDN terminals.
78       It separates user terminal equipment  from  network-related  communica‐
79       tions functions. Reference point R (rate) provides a non-ISDN interface
80       between user equipment that is not ISDN-compatible and  adaptor  equip‐
81       ment.  ...  The  final reference point ... is reference point U (user).
82       This interface describes the full-duplex data signal on the  subscriber
83       line.
84
85
86       Some  older  technology  components  of some ISDN networks occasionally
87       steal the low order bit of an ISDN B-channel octet in order to transmit
88       in-band  signaling  information between switches or other components of
89       the network. Even when out-of-band signaling has  been  implemented  in
90       these networks, and the in-band signaling is no longer needed, the bit-
91       robbing mechanism may still be present. This bit robbing behavior  does
92       not appreciably affect a voice call, but it will limit the usable band‐
93       width of a data call to 56000 bits per second instead of 64000 bits per
94       second. These older network components only seem to exist in the United
95       States of America, Canada and Japan. ISDN  B-channel  data  calls  that
96       have one end point in the United States, Canada or Japan may be limited
97       to 56000 bps usable bandwidth instead of the normal  64000  bps.  Some‐
98       times  the  ISDN service provider may be able to supply 56kbps for some
99       calls and 64kbps for other calls. On an international call,  the  local
100       ISDN service provider may advertise the call as 64kbps even though only
101       56kbps are reliably delivered because of  bit-robbing  in  the  foreign
102       ISDN that is not reported to the local switch.
103
104
105       A  Basic  Rate  Interface  implements  either a Terminal Equipment (TE)
106       interface or a Network Termination (NT) interface.  TE's  can  be  ISDN
107       telephones,  a Group 4 fax, or other ISDN terminal equipment. A TE con‐
108       nects to an NT in order to gain access to a public or private ISDN net‐
109       work.  A  private  ISDN  network,  such as provided by a Private Branch
110       Exchange (PBX), usually provides access to the public network.
111
112
113       If multi-point configurations are allowed by an NT, it may be  possible
114       to  connect  up to eight TE's to a single NT interface. All of the TE's
115       in a multipoint configuration share the same  D  and  B-channels.  Con‐
116       tention  for  B-Channels by multiple TEs is resolved by the ISDN switch
117       (NT) through signaling protocols on the D-channel.
118
119
120       Contention for access to the D-channel is managed by a collision detec‐
121       tion  and  priority  mechanism.  D-channel  call  control messages have
122       higher priority than other packets. This media access function is  man‐
123       aged at the physical layer.
124
125
126       A BRI-TE interface may implement a "Q-channel", the Q-channel is a slow
127       speed, 800 bps, data path from a TE to an NT. Although the structure of
128       the  Q-channel is defined in the I.430 specification, the use of the Q-
129       channel is for further study.
130
131
132       A BRI-NT interface may implement an "S-channel",  the  S-channel  is  a
133       slow  speed,  4000 bps, data path from a NT to an TE. The use of the S-
134       channel is for further study.
135
136   Primary Rate ISDN
137       Primary Rate ISDN (PRI) interfaces are either 1.544Mbps  (T1  rate)  or
138       2.048Mbps  (E1  rate)  and are typically organized as 23 B-channels and
139       one D-Channel (23B+D) for T1 rates, and 30 B-Channels and one D-Channel
140       (30B+D)  for  E1  rates.  The  D-channels on a PRI interface operate at
141       64000 bits per second. T1 rate PRI interface is  the  standard  in  the
142       United  States,  Canada  and  Japan  while E1 rate PRI interface is the
143       standard in European countries. Some E1 rate PRI interface  implementa‐
144       tions allow access to channel zero which is used for framing.
145
146   Channel Types
147       ISDN  channels  fall  into several categories; D-channels, bearer chan‐
148       nels, and management pseudo channels. Each channel has a  corresponding
149       device  name  somewhere under the directory /dev/isdn/ as documented in
150       the appropriate hardware specific manual page.
151
152       D-channels                    There is at most one D-channel  per  ISDN
153                                     interface.  The D-channel carries signal‐
154                                     ing information  for  the  management  of
155                                     ISDN calls and can also carry X.25 packet
156                                     data. In the case  of  a  PRI  interface,
157                                     there  may  actually  be  no D-channel if
158                                     Non-Facility  Associated   Signaling   is
159                                     used.  D-channels carry data packets that
160                                     are framed and checked  for  transmission
161                                     errors  according  to the LAP-D protocol.
162                                     LAP-D uses  framing  and  error  checking
163                                     identical  to  the  High  Speed Data Link
164                                     (HDLC) protocol.
165
166
167       B-channels                    BRI interfaces have  two  B-channels,  B1
168                                     and  B2.  On  a  BRI  interface, the only
169                                     other type of  channel  is  an  H-channel
170                                     which is a concatenation of the B1 and B2
171                                     channels. An  H-channel  is  accessed  by
172                                     opening  the  "base"  channel, B1 in this
173                                     case, and using the ISDN_SET_FORMAT ioctl
174                                     to  change  the  configuration  of the B-
175                                     channel from  8-bit,  8  kHz  to  16-bit,
176                                     8kHz.
177
178                                     On  a  primary rate interface, B channels
179                                     are numbered from 0 to 31 in Europe and 1
180                                     to  23  in  the United States, Canada and
181                                     Japan.
182
183
184       H-Channels                    A BRI or PRI interface can offer multiple
185                                     B-channels  concatenated  into  a single,
186                                     higher bandwidth channel. These  concate‐
187                                     nated  B-channels  are  referred to as an
188                                     "H-channels" on a BRI interface. The  PRI
189                                     interface  version  of  an  H-channel  is
190                                     referred to as an Hn-channels where n  is
191                                     a  number  indicating  how the B-channels
192                                     have been aggregated into a single  chan‐
193                                     nel.
194
195                                         o      A  PRI interface H0 channel is
196                                                384 kbps allowing 3H0+D  on  a
197                                                T1   rate  PRI  interface  and
198                                                4H0+D channels on an  E1  rate
199                                                PRI interface.
200
201                                         o      A T1 PRI interface H11 channel
202                                                is  1536  kbps  (24~64000bps).
203                                                This  will consume the channel
204                                                normally reserved for  the  D-
205                                                channel,  so signaling must be
206                                                done with Non-Facility Associ‐
207                                                ated   Signaling  (NFAS)  from
208                                                another PRI interface.
209
210                                         o      An E1 PRI interface H12  chan‐
211                                                nel      is      1920     kbps
212                                                (30~64000bps). An  H12-channel
213                                                leaves  room  for the framing-
214                                                channel as well as the D-chan‐
215                                                nel.
216
217
218       Auxiliary channels            Auxiliary  channels are non-ISDN hardware
219                                     interfaces that are closely tied  to  the
220                                     ISDN  interfaces.  An  example would be a
221                                     video or audio coder/decoder (codec). The
222                                     existence of an auxiliary channel usually
223                                     implies that one or more  B-channels  can
224                                     be  "connected" to an auxiliary interface
225                                     in hardware.
226
227
228       Management pseudo-channels    A management pseudo-channel is  used  for
229                                     the  management  of  a controller, inter‐
230                                     face,  or  hardware  channel.  Management
231                                     channels allow for out-of-band control of
232                                     hardware interfaces and  for  out-of-band
233                                     notification  of status changes. There is
234                                     at least one management device per  hard‐
235                                     ware interface.
236
237                                     There  are  three different types of man‐
238                                     agement  channels  implemented  by   ISDN
239                                     hardware drivers:
240
241                                         o      A controller management device
242                                                handles all ioctls that simul‐
243                                                taneously    affect   hardware
244                                                channels on  different  inter‐
245                                                faces. Examples include reset‐
246                                                ting a controller, mu-code (as
247                                                in  the Greek letter mu) down‐
248                                                loading of  a  controller,  or
249                                                the  connection  of an ISDN B-
250                                                channel to an auxiliary  chan‐
251                                                nel  that  represents an audio
252                                                coder/decoder   (codec).   The
253                                                latter  case  would  be accom‐
254                                                plished       using        the
255                                                ISDN_SET_CHANNEL ioctl.
256
257                                         o      An interface management device
258                                                handles all ioctls that affect
259                                                multiple  channels on the same
260                                                interface. Messages associated
261                                                with  the activation and deac‐
262                                                tivation   of   an   interface
263                                                arrive   on   the   management
264                                                device associated with  the  D
265                                                channel of an ISDN interface.
266
267                                         o      Auxiliary  interfaces may also
268                                                have management  devices.  See
269                                                the   hardware   specific  man
270                                                pages for operations on auxil‐
271                                                iary devices.
272
273
274       Trace pseudo-channels         A device driver may choose to implement a
275                                     trace device for  a  data  or  management
276                                     channel. Trace channels receive a special
277                                     M_PROTO header with  the  original  chan‐
278                                     nel's  original M_PROTO or M_DATA message
279                                     appended  to  the  special  header.   The
280                                     header is described by:
281
282                                       typedef  struct {
283                                         uint_t   seq;     /* Sequence number */
284                                         int      type;    /* device dependent */
285                                         struct   timeval  timestamp;
286                                         char     _f[8];   /* filler */
287                                       } audtrace_hdr_t;
288
289
290
291   ISDN Channel types
292       The  isdn_chan_t  type enumerates the channels available on ISDN inter‐
293       faces. If a particular controller  implements  any  auxiliary  channels
294       then  those  auxiliary  channels will be described in a controller spe‐
295       cific  manual  page.  The  defined  channels  are  described   by   the
296       isdn_chan_t type as shown below:
297
298         /* ISDN channels */
299         typedef enum {
300              ISDN_CHAN_NONE = 0x0,  /* No channel given */
301              ISDN_CHAN_SELF,        /* The channel performing the ioctl */
302              ISDN_CHAN_HOST,        /* Unix STREAMS*/
303              ISDN_CHAN_CTRL_MGT,    /* Controller management */
304
305              /* TE channel defines */
306
307              ISDN_CHAN_TE_MGT,      /* Receives activation/deactivation */
308              ISDN_CHAN_TE_D_TRACE,  /* Trace device for protocol analysis apps */
309              ISDN_CHAN_TE_D,
310              ISDN_CHAN_TE_B1,
311              ISDN_CHAN_TE_B2,
312
313              /* NT channel defines */
314
315              ISDN_CHAN_NT_MGT,      /* Receives activation/deactivation */
316              ISDN_CHAN_NT_D_TRACE,  /* Trace device for protocol analysis apps */
317              ISDN_CHAN_NT_D,
318              ISDN_CHAN_NT_B1,
319              ISDN_CHAN_NT_B2,
320
321              /* Primary rate ISDN */
322
323              ISDN_CHAN_PRI_MGT,
324              ISDN_CHAN_PRI_D,
325              ISDN_CHAN_PRI_B0,  ISDN_CHAN_PRI_B1,
326              ISDN_CHAN_PRI_B2,  ISDN_CHAN_PRI_B3,
327              ISDN_CHAN_PRI_B4,  ISDN_CHAN_PRI_B5,
328              ISDN_CHAN_PRI_B6,  ISDN_CHAN_PRI_B7,
329              ISDN_CHAN_PRI_B8,  ISDN_CHAN_PRI_B9,
330              ISDN_CHAN_PRI_B10, ISDN_CHAN_PRI_B11,
331              ISDN_CHAN_PRI_B12, ISDN_CHAN_PRI_B13,
332              ISDN_CHAN_PRI_B14, ISDN_CHAN_PRI_B15,
333              ISDN_CHAN_PRI_B16, ISDN_CHAN_PRI_B17,
334              ISDN_CHAN_PRI_B18, ISDN_CHAN_PRI_B19,
335              ISDN_CHAN_PRI_B20, ISDN_CHAN_PRI_B21,
336              ISDN_CHAN_PRI_B22, ISDN_CHAN_PRI_B23,
337              ISDN_CHAN_PRI_B24, ISDN_CHAN_PRI_B25,
338              ISDN_CHAN_PRI_B26, ISDN_CHAN_PRI_B27,
339              ISDN_CHAN_PRI_B28, ISDN_CHAN_PRI_B29,
340              ISDN_CHAN_PRI_B30, ISDN_CHAN_PRI_B31,
341
342              /* Auxiliary channel defines */
343
344              ISDN_CHAN_AUX0, ISDN_CHAN_AUX1, ISDN_CHAN_AUX2, ISDN_CHAN_AUX3,
345              ISDN_CHAN_AUX4, ISDN_CHAN_AUX5, ISDN_CHAN_AUX6, ISDN_CHAN_AUX7
346         } isdn_chan_t;
347
348
349   ISDN Interface types
350       The  isdn_interface_t  type enumerates the interfaces available on ISDN
351       controllers. The defined interfaces are described  by  the  isdn_inter‐
352       face_t type as shown below:
353
354         /* ISDN interfaces */
355         typedef enum {
356           ISDN_TYPE_UNKNOWN = -1,  /* Not known or applicable */
357           ISDN_TYPE_SELF = 0,      /*
358                    * For queries, application may
359                    * put this value into "type" to
360                    * query the state of the file
361                    * descriptor used in an ioctl.
362                    */
363           ISDN_TYPE_OTHER,         /* Not an ISDN interface */
364           ISDN_TYPE_TE,
365           ISDN_TYPE_NT,
366           ISDN_TYPE_PRI,
367         } isdn_interface_t;
368
369
370   Activation and Deactivation of ISDN Interfaces
371       The  management  device  associated  with  an ISDN D-channel is used to
372       request activation, deactivation  and  receive  information  about  the
373       activation  state  of  the  interface.  See  the  descriptions  of  the
374       ISDN_PH_ACTIVATE_REQ and ISDN_MPH_DEACTIVATE_REQ ioctls. Changes in the
375       activation  state  of  an  interface  are communicated to the D-channel
376       application through M_PROTO messages sent up-stream on  the  management
377       device  associated  with the D-channel. If the D-channel protocol stack
378       is implemented as a user process, the user  process  can  retrieve  the
379       M_PROTO messages using the getmsg(2) system call.
380
381
382       These M_PROTO messages have the following format:
383
384         typedef struct isdn_message {
385              unsigned int magic;           /* set to ISDN_PROTO_MAGIC */
386              isdn_interface_t type;        /* Interface type */
387              isdn_message_type_t message;  /* CCITT or vendor Primitive */
388              unsigned int vendor[5];       /* Vendor specific content */
389         } isdn_message_t;
390         typedef  enum  isdn_message_type  {
391           ISDN_VPH_VENDOR = 0,  /* Vendor specific messages */
392           ISDN_PH_AI,           /* Physical: Activation Ind */
393           ISDN_PH_DI,           /* Physical: Deactivation Ind */
394           ISDN_MPH_AI,          /* Management: Activation Ind */
395           ISDN_MPH_DI,          /* Management: Deactivation Ind */
396           ISDN_MPH_EI1,         /* Management: Error 1 Indication */
397           ISDN_MPH_EI2,         /* Management: Error 2 Indication */
398           ISDN_MPH_II_C,        /* Management: Info Ind, connection */
399           ISDN_MPH_II_D         /* Management: Info Ind, disconn. */
400         } isdn_message_type_t;
401
402

IOCTLS

404   STREAMS IOCTLS
405       All  of the streamio(7I) ioctl commands may be issued for a device con‐
406       forming to the the isdnio interface.
407
408
409       ISDN interfaces that allow access to audio data should implement a rea‐
410       sonable subset of the audio(7I) interface.
411
412   ISDN ioctls
413       ISDN_PH_ACTIVATE_REQ       Request ISDN physical layer activation. This
414                                  command is valid for both TE and  NT  inter‐
415                                  faces.  fd must be a D-channel file descrip‐
416                                  tor. arg is ignored.
417
418                                  TE activation will occur without use of  the
419                                  ISDN_PH_ACTIVATE_REQ  ioctl  if  the  device
420                                  corresponding to the TE D-channel  is  open,
421                                  "on",  and  the  ISDN  switch  is requesting
422                                  activation.
423
424
425       ISDN_MPH_DEACTIVATE_REQ    fd must be an NT D-channel file  descriptor.
426                                  arg is ignored.
427
428                                  This  command  requests  ISDN physical layer
429                                  de-activation. This  is  not  valid  for  TE
430                                  interfaces.  A TE interace may be turned off
431                                  by use of the ISDN_PARAM_POWER command or by
432                                  close(2) on the associated fd.
433
434
435       ISDN_ACTIVATION_STATUS     fd  is  the file descriptor for a D-channel,
436                                  the management  device  associated  with  an
437                                  ISDN  interface,  or  the  management device
438                                  associated with the  controller.  arg  is  a
439                                  pointer   to   an   isdn_activation_status_t
440                                  structure.  Although  it  is  possible   for
441                                  applications  to determine the current acti‐
442                                  vation state with this  ioctl,  a  D-channel
443                                  protocol  stack  should instead process mes‐
444                                  sages from  the  management  pseudo  channel
445                                  associated with the D-channel.
446
447                                    typedef struct isdn_activation_status {
448                                         isdn_interface_t type;
449                                         enum isdn_activation_state activation;
450                                    } isdn_activation_status_t;
451                                    typedef enum isdn_activation_state {
452                                         ISDN_OFF = 0,          /* Interface is powered down */
453                                         ISDN_UNPLUGGED,        /* Power but no-physical connection */
454                                         ISDN_DEACTIVATED_REQ,  /* Pending Deactivation, NT Only */
455                                         ISDN_DEACTIVATED,      /* Activation is permitted */
456                                         ISDN_ACTIVATE_REQ,     /* Attempting to activate */
457                                         ISDN_ACTIVATED,        /* Interface is activated */
458                                    } isdn_activation_state_t;
459
460                                  The    type   field   should   be   set   to
461                                  ISDN_TYPE_SELF. The device  specific  inter‐
462                                  face  type  will  be  returned  in  the type
463                                  field.
464
465                                  The isdn_activation_status_t structure  con‐
466                                  tains  the  interface  type  and the current
467                                  activation state. type is the interface type
468                                  and   should   be   set  by  the  caller  to
469                                  ISDN_TYPE_SELF.
470
471
472       ISDN_INTERFACE_STATUS      The  ISDN_INTERFACE_STATUS  ioctl  retrieves
473                                  the  status and statistics of an ISDN inter‐
474                                  face.  The requesting channel must  own  the
475                                  interface whose status is being requested or
476                                  the ioctl will fail. fd is the file descrip‐
477                                  tor for an ISDN interface management device.
478                                  arg is a pointer  to  a  struct  isdn_inter‐
479                                  face_info.  If the interface field is set to
480                                  ISDN_TYPE_SELF, it will be  changed  in  the
481                                  returned  structure  to  reflect  the proper
482                                  device-specific interface of the  requesting
483                                  fd.
484
485                                    typedef struct isdn_interface_info {
486                                      isdn_interface_t interface;
487                                      enum isdn_activation_state  activation;
488                                      unsigned int ph_ai;     /* Physical: Activation Ind */
489                                      unsigned int ph_di;     /* Physical: Deactivation Ind */
490                                      unsigned int mph_ai;    /* Management: Activation Ind */
491                                      unsigned int mph_di;    /* Management: Deactivation Ind */
492                                      unsigned int mph_ei1;   /* Management: Error 1 Indication */
493                                      unsigned int mph_ei2;   /* Management: Error 2 Indication */
494                                      unsigned int mph_ii_c;  /* Management: Info Ind, connection */
495                                      unsigned int mph_ii_d;  /* Management: Info Ind, disconn. */
496                                    } isdn_interface_info_t;
497
498
499
500       ISDN_CHANNEL_STATUS        The  ISDN_CHANNEL_STATUS ioctl retrieves the
501                                  status and statistics of  an  ISDN  channel.
502                                  The  requesting channel must own the channel
503                                  whose status is being requested or the ioctl
504                                  will fail. fd is any file descriptor. arg is
505                                  a pointer to a struct isdn_channel_info.  If
506                                  the    interface    field    is    set    to
507                                  ISDN_CHAN_SELF, it will be  changed  in  the
508                                  returned  structure  to  reflect  the proper
509                                  device-specific channel  of  the  requesting
510                                  fd.
511
512                                    typedef struct isdn_channel_info {
513                                         isdn_chan_t    channel;
514                                         enum isdn_iostate   iostate;
515                                         struct   isdn_io_stats {
516                                         ulong_t  packets;   /* packets transmitted or received */
517                                         ulong_t  octets;    /* octets transmitted or received */
518                                         ulong_t  errors;    /* errors packets transmitted or received */
519                                         } transmit, receive;
520                                    } isdn_channel_info_t;
521
522
523
524       ISDN_PARAM_SET             fd  is  the file descriptor for a management
525                                  device.  arg  is  a  pointer  to  a   struct
526                                  isdn_param.  This command allows the setting
527                                  of various ISDN  physical  layer  parameters
528                                  such  as  timers. This command uses the same
529                                  arguments as the ISDN_PARAM_GET command.
530
531
532       ISDN_PARAM_GET             fd is the file descriptor for  a  management
533                                  device.   arg  is  a  pointer  to  a  struct
534                                  isdn_param This command provides for  query‐
535                                  ing  the value of a particular ISDN physical
536                                  layer parameter.
537
538                                    typedef enum {
539                                      ISDN_PARAM_NONE = 0,
540                                      ISDN_PARAM_NT_T101,    /* NT Timer, 5-30 s, in milliseconds */
541                                      ISDN_PARAM_NT_T102,    /* NT Timer, 25-100 ms, in milliseconds */
542                                      ISDN_PARAM_TE_T103,    /* TE Timer, 5-30 s, in milliseconds */
543                                      ISDN_PARAM_TE_T104,    /* TE Timer, 500-1000 ms, in milliseconds */
544                                      ISDN_PARAM_MAINT,      /* Manage the TE Maintenance Channel */
545                                      ISDN_PARAM_ASMB,       /* Modify Activation State Machine Behavior */
546                                      ISDN_PARAM_POWER,      /* Take the interface online or offline */
547                                      ISDN_PARAM_PAUSE,      /* Paused if == 1, else not paused == 0 */
548                                    } isdn_param_tag_t;
549                                    enum isdn_param_asmb {
550                                         ISDN_PARAM_TE_ASMB_CCITT88, /* 1988 bluebook */
551                                         ISDN_PARAM_TE_ASMB_CTS2,    /* Conformance Test Suite 2 */
552                                    };
553                                    typedef struct isdn_param {
554                                         isdn_param_tag_t    tag;
555                                         union {
556                                       unsigned int us;          /* micro seconds */
557                                       unsigned int ms;          /* Timer value in ms */
558                                       unsigned int flag;        /* Boolean */
559                                       enum isdn_param_asmb  asmb;
560                                       enum isdn_param_maint maint;
561                                       struct {
562                                          isdn_chan_t channel;   /* Channel to Pause */
563                                          int paused;            /* TRUE or FALSE */
564                                              } pause;
565                                       unsigned int reserved[2]; /* reserved, set to zero */
566                                         } value;
567                                    } isdn_param_t;
568
569
570
571       ISDN_PARAM_POWER           If an implementation provides power  on  and
572                                  off  functions,  then  power should be on by
573                                  default.  If  flag  is  ISDN_PARAM_POWER_OFF
574                                  then a TE interface is forced into state F0,
575                                  NT interfaces are forced into state  G0.  If
576                                  flag is ISDN_PARAM_POWER_ON then a TE inter‐
577                                  face will immediately transition to state F3
578                                  when  the TE D-channel is opened. If flag is
579                                  one, an  NT  interface  will  transition  to
580                                  state G1 when the NT D-channel is opened.
581
582                                  Implementations    that   do   not   provide
583                                  ISDN_POWER return failure with errno set  to
584                                  ENXIO.ISDN_POWER     is    different    from
585                                  ISDN_PH_ACTIVATE_REQ since CCITT  specifica‐
586                                  tion  requires  that  if  a BRI-TE interface
587                                  device has power, then  it  permits  activa‐
588                                  tion.
589
590
591       ISDN_PARAM_NT_T101         This  parameter  accesses the NT timer value
592                                  T1. The CCITT recommendations  specify  that
593                                  timer  T1  has a value from 5 to 30 seconds.
594                                  Other standards may differ.
595
596
597       ISDN_PARAM_NT_T102         This parameter accesses the NT  timer  value
598                                  T2.  The  CCITT recommendations specify that
599                                  timer T2 has a value from  25  to  100  mil‐
600                                  liseconds. Other standards may differ.
601
602
603       ISDN_PARAM_TE_T103         This  parameter  accesses the TE timer value
604                                  T3. The CCITT recommendations  specify  that
605                                  timer  T3  has a value from 5 to 30 seconds.
606                                  Other standards may differ.
607
608
609       ISDN_PARAM_TE_T104         This parameter accesses the TE  timer  value
610                                  T4.  The  CTS2  specifies  that  timer T4 is
611                                  either not used or has a value from  500  to
612                                  1000  milliseconds. Other standards may dif‐
613                                  fer. CTS2 requires that timer T309 be imple‐
614                                  mented if T4 is not available.
615
616
617       ISDN_PARAM_MAINT           This  parameter  sets the multi-framing mode
618                                  of a BRI-TE interface. For normal  operation
619                                  this    parameter    should    be   set   to
620                                  ISDN_PARAM_MAINT_ECHO. Other  uses  of  this
621                                  parameter  are  dependent  on the definition
622                                  and use of the BRI interface S and  Q  chan‐
623                                  nels.
624
625
626       ISDN_PARAM_ASMB            There  are  a  few differences in the BRI-TE
627                                  interface  activation  state  machine  stan‐
628                                  dards.  This  parameter allows the selection
629                                  of the appropriate standard.  At this  time,
630                                  only      ISDN_PARAM_TE_ASMB_CCITT88     and
631                                  ISDN_PARAM_TE_ASMB_CTS2 are available.
632
633
634       ISDN_PARAM_PAUSE           This parameter allows a management device to
635                                  pause  the  IO on a B-channel. pause.channel
636                                  is set to indicate which channel  is  to  be
637                                  paused  or un-paused. pause.paused is set to
638                                  zero to un-pause and one  to  pause.  fd  is
639                                  associated with an ISDN interface management
640                                  device.  arg  is  a  pointer  to  a   struct
641                                  isdn_param.
642
643
644       ISDN_SET_LOOPBACK          fd is the file descriptor for an ISDN inter‐
645                                  face's management device. arg is  a  pointer
646                                  to an isdn_loopback_request_t structure.
647
648                                    typedef enum {
649                                          ISDN_LOOPBACK_LOCAL,
650                                          ISDN_LOOPBACK_REMOTE,
651                                    } isdn_loopback_type_t;
652                                    typedef enum {
653                                      ISDN_LOOPBACK_B1 =     0x1,
654                                      ISDN_LOOPBACK_B2 =     0x2,
655                                          ISDN_LOOPBACK_D  = 0x4,
656                                          ISDN_LOOPBACK_E_ZERO = 0x8,
657                                          ISDN_LOOPBACK_S  = 0x10,
658                                          ISDN_LOOPBACK_Q  = 0x20,
659                                    } isdn_loopback_chan_t;
660                                    typedef struct isdn_loopback_request {
661                                         isdn_loopback_type_t  type;
662                                         int                   channels;
663                                    } isdn_loopback_request_t;
664
665                                  An  application  can  receive D-channel data
666                                  during D-Channel loopback but cannot  trans‐
667                                  mit  data.  The field type is the bitwise OR
668                                  of at least one of the following values:
669
670                                      ISDN_LOOPBACK_B1     (0x1)   /* loopback on B1-channel */
671                                      ISDN_LOOPBACK_B2      (0x2)   /* loopback on B2-channel */
672                                      ISDN_LOOPBACK_D       (0x4)   /* loopback on D-channel */
673                                      ISDN_LOOPBACK_E_ZERO  (0x8)   /* force E-channel to Zero if */
674                                                                    /* fd is for NT interface */
675                                      ISDN_LOOPBACK_S       (0x10)  /* loopback on S-channel */
676                                      ISDN_LOOPBACK_Q       (0x20)  /* loopback on Q-channel */
677
678
679
680       ISDN_RESET_LOOPBACK        arg  is   a   pointer   to   an   isdn_loop‐
681                                  back_request_t  structure.  ISDN_RESET_LOOP‐
682                                  BACK turns off the selected loopback modes.
683
684
685   ISDN Data Format
686       The isdn_format_t type is meant to be a  complete  description  of  the
687       various  data  modes  and rates available on an ISDN interface. Several
688       macros are available for setting the format fields.  The  isdn_format_t
689       structure is shown below:
690
691         /* ISDN channel data format */
692         typedef enum {
693           ISDN_MODE_NOTSPEC,     /* Not specified */
694           ISDN_MODE_HDLC,        /* HDLC framing and error checking */
695           ISDN_MODE_TRANSPARENT  /* Transparent mode */
696         } isdn_mode_t;
697
698         /* Audio encoding types (from audioio.h) */
699
700         #define AUDIO_ENCODING_NONE   (0)  /* no encoding*/
701         #define AUDIO_ENCODING_ULAW   (1)  /* mu-law */
702         #define AUDIO_ENCODING_ALAW   (2)  /* A-law */
703         #define AUDIO_ENCODING_LINEAR (3)  /* Linear PCM */
704         typedef struct isdn_format {
705           isdn_mode_t  mode;
706           unsigned int sample_rate;  /* sample frames/sec*/
707           unsigned int channels;     /* # interleaved chans */
708           unsigned int precision;    /* bits per sample */
709           unsigned int encoding;     /* data encoding */
710         } isdn_format_t;
711         /*
712          * These macros set the fields pointed
713          * to by the macro argument (isdn_format_t*)fp in preparation
714          * for the ISDN_SET_FORMAT ioctl.
715          */
716         ISDN_SET_FORMAT_BRI_D(fp)      /* BRI D-channel */
717         ISDN_SET_FORMAT_PRI_D(fp)      /* PRI D-channel */
718         ISDN_SET_FORMAT_HDLC_B64(fp)   /* BRI B-ch @ 56kbps */
719         ISDN_SET_FORMAT_HDLC_B56(fp)   /* BRI B-ch @ 64kbps */
720         ISDN_SET_FORMAT_VOICE_ULAW(fp) /* BRI B-ch voice */
721         ISDN_SET_FORMAT_VOICE_ALAW(fp) /* BRI B-ch voice */
722         ISDN_SET_FORMAT_BRI_H(fp)      /* BRI H-channel */
723
724
725   ISDN Datapath Types
726       Every  STREAMS  stream  that  carries  data  to or from the ISDN serial
727       interfaces is classified as a channel-stream datapath. A possible  ISDN
728       channel-stream    datapath    device   name   for   a   TE   could   be
729       /dev/isdn/0/te/b1.
730
731
732       On some hardware implementations, it is possible to route the data from
733       hardware channel to hardware channel completely within the chip or con‐
734       troller. This is classified as a channel-channel datapath.  There  does
735       not need to be any open file descriptor for either channel in this con‐
736       figuration. Only when data enters  the  host  and  utilizes  a  STREAMS
737       stream is this classified as an ISDN channel-stream datapath.
738
739   ISDN Management Stream
740       A  management stream is a STREAMS stream that exists solely for control
741       purposes and is not intended to carry data to or from the  ISDN  serial
742       interfaces.  A  possible  management  device  name  for  a  TE could be
743       /dev/isdn/0/te/mgt.
744

CHANNEL MANAGEMENT IOCTLS

746       The following ioctls describe operations on individual channels and the
747       connection of multiple channels.
748
749       ISDN_SET_FORMAT     fd is a data channel, the management pseudo-channel
750                           associated with the data channel, or the management
751                           channel  associated  with the data channel's inter‐
752                           face or controller. arg is a pointer  to  a  struct
753                           isdn_format_req. The ISDN_SET_FORMAT ioctl sets the
754                           format of an ISDN channel-stream datapath.  It  may
755                           be issued on both an open ISDN channel-stream data‐
756                           path Stream or an ISDN Management Stream. Note that
757                           an  open(2) call for a channel-stream datapath will
758                           fail if an ISDN_SET_FORMAT has  never  been  issued
759                           after  a  reset, as the mode for all channel-stream
760                           datapaths is initially biased to ISDN_MODE_NOTSPEC.
761                           arg  is a pointer to an ISDN format type (isdn_for‐
762                           mat_req_t*).
763
764                             typedef struct isdn_format_req {
765                               isdn_chan_t  channel;
766                               isdn_format_t format;   /* data format */
767                               int reserved[4];        /* future use - must be 0 */
768                             } isdn_format_req_t;
769
770                           If there is not an open channel-stream datapath for
771                           a  requested  channel,  the  default format of that
772                           channel will be set for a subsequent open(2).
773
774                           To modify the format of an open stream, the  driver
775                           will  disconnect  the  hardware  channel, flush the
776                           internal hardware queues, set the new default  con‐
777                           figuration,  and  finally  reconnect  the data path
778                           using  the  newly  specified  format.  Upon  taking
779                           effect, all state information will be reset to ini‐
780                           tial conditions, as if a channel was  just  opened.
781                           It  is  suggested that the user flush the interface
782                           as well as consult the hardware specific documenta‐
783                           tion to insure data integrity.
784
785                           If  a user desires to connect more than one B chan‐
786                           nel, such as an H-channel, the B-channel  with  the
787                           smallest  offset should be specified, then the pre‐
788                           cision should be specified multiples of 8.  For  an
789                           H-channel the precision value would be 16. The user
790                           should subsequently open the base B-channel. If any
791                           of the sequential B-channels are busy the open will
792                           fail, otherwise all of the B-channels that  are  to
793                           be used in conjunction will be marked as busy.
794
795                           The  returned  failure codes and their descriptions
796                           are listed below:
797
798                             EPERM   /* No permission for intented operation */
799                             EINVAL   /* Invalid format request */
800                             EIO      /* Set format attempt failed. */
801
802
803
804       ISDN_SET_CHANNEL    The ISDN_SET_CHANNEL ioctl sets up a  data  connec‐
805                           tion  within an ISDN controller. The ISDN_SET_CHAN‐
806                           NEL ioctl can only be issued from an  ISDN  manage‐
807                           ment  stream to establish or modify channel-channel
808                           datapaths. The ioctl parameter arg is a pointer  to
809                           an ISDN connection request (isdn_conn_req_t*). Once
810                           a data path is established, data flow is started as
811                           soon as the path endpoints become active. Upon tak‐
812                           ing effect, all state information is reset to  ini‐
813                           tial conditions, as if a channel was just opened.
814
815                           The  isdn_conn_req_t  structure is shown below. The
816                           five fields include the receive and  transmit  ISDN
817                           channels,  the  number  of  directions  of the data
818                           path, as well as  the  data  format.  The  reserved
819                           field must always be set to zero.
820
821                             /* Number of directions for data flow */
822                             typedef enum {
823                               ISDN_PATH_NOCHANGE = 0, /* Invalid value */
824                               ISDN_PATH_DISCONNECT,   /* Disconnect data path */
825                               ISDN_PATH_ONEWAY,       /* One way data path */
826                               ISDN_PATH_TWOWAY,       /* Bi-directional data path */
827                             } isdn_path_t;
828                             typedef struct isdn_conn_req {
829                               isdn_chan_t  from;
830                               isdn_chan_t  to;
831                               isdn_path_t  dir;      /* uni/bi-directional or disconnect */
832                               isdn_format_t format;  /* data format */
833                               int  reserved[4];      /* future use - must be 0 */
834                             } isdn_conn_req_t;
835
836                           To  specify  a read-only, write-only, or read-write
837                           path, or to disconnect a path, the dir field should
838                           be  set  to ISDN_PATH_ONEWAY, ISDN_PATH_TWOWAY, and
839                           ISDN_PATH_DISCONNECT respectively.  To  modify  the
840                           format  of  a channel-channel datapath, a user must
841                           disconnect the channel and then reconnect with  the
842                           desired format.
843
844                           The  returned  failure codes and their descriptions
845                           are listed below:
846
847                             EPERM   /* No permission for intented operation */
848                             EBUSY   /* Connection in use */
849                             EINVAL  /* Invalid connection request */
850                             EIO     /* Connection attempt failed */
851
852
853
854       ISDN_GET_FORMAT     The ISDN_GET_FORMAT ioctl gets the ISDN data format
855                           of the channel-stream datapath described by fd. arg
856                           is a pointer to an ISDN data  format  request  type
857                           (isdn_format_req_t*). ISDN_GET_FORMAT can be issued
858                           on any channel to retrieve the format of any  chan‐
859                           nel  it owns. For example, if issued on the TE man‐
860                           agement channel, the format of any other te channel
861                           can be retrieved.
862
863
864       ISDN_GETCONFIG      The ISDN_GETCONFIG ioctl is used to get the current
865                           connection status of all ISDN  channels  associated
866                           with a particular management stream. ISDN_GETCONFIG
867                           also  retrieves  a  hardware  identifier  and   the
868                           generic  interface  type. arg is an ISDN connection
869                           table     pointer      (isdn_conn_tab_t*).      The
870                           isdn_conn_tab_t structure is shown below:
871
872                             typedef struct isdn_conn_tab {
873                               char name[ISDN_ID_SIZE];  /* identification string */
874                               isdn_interface_t type;
875                               int maxpaths;             /* size in entries of app's array int npaths; */
876                                                         /* number of valid entries returned by driver */
877                               isdn_conn_req_t *paths;   /* connection table in app's memory */
878                             } isdn_conn_tab_t;
879
880                           The  table  contains  a  string which is the inter‐
881                           face's unique  identification  string.  The  second
882                           element  of  this  table contains the ISDN transmit
883                           and receive connections and configuration  for  all
884                           possible  data  paths  for  each  type of ISDN con‐
885                           troller hardware. Entries that  are  not  connected
886                           will  have  a value of ISDN_NO_CHAN in the from and
887                           to fields. The number of  entries  will  always  be
888                           ISDN_MAX_CHANS,  and can be referenced in the hard‐
889                           ware  specific  implementation  documentation.   An
890                           isdn_conn_tab_t  structure  is  allocated  on a per
891                           controller basis.
892
893

SEE ALSO

895       getmsg(2), ioctl(2), open(2), poll(2),  read(2),  write(2),  audio(7I),
896       streamio(7I)
897
898
899       ISDN,  An  Introduction  - William Stallings, Macmillan Publishing Com‐
900       pany. ISBN 0-02-415471-7
901
902
903
904SunOS 5.11                        8 Apr 2009                        isdnio(7I)
Impressum