linux/include/linux/isdn.h
<<
>>
Prefs
   1/* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $
   2 *
   3 * Main header for the Linux ISDN subsystem (linklevel).
   4 *
   5 * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
   6 * Copyright 1995,96    by Thinking Objects Software GmbH Wuerzburg
   7 * Copyright 1995,96    by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
   8 * 
   9 * This software may be used and distributed according to the terms
  10 * of the GNU General Public License, incorporated herein by reference.
  11 *
  12 */
  13
  14#ifndef __ISDN_H__
  15#define __ISDN_H__
  16
  17#include <linux/ioctl.h>
  18#include <linux/tty.h>
  19
  20#define ISDN_MAX_DRIVERS    32
  21#define ISDN_MAX_CHANNELS   64
  22
  23/* New ioctl-codes */
  24#define IIOCNETAIF  _IO('I',1)
  25#define IIOCNETDIF  _IO('I',2)
  26#define IIOCNETSCF  _IO('I',3)
  27#define IIOCNETGCF  _IO('I',4)
  28#define IIOCNETANM  _IO('I',5)
  29#define IIOCNETDNM  _IO('I',6)
  30#define IIOCNETGNM  _IO('I',7)
  31#define IIOCGETSET  _IO('I',8) /* no longer supported */
  32#define IIOCSETSET  _IO('I',9) /* no longer supported */
  33#define IIOCSETVER  _IO('I',10)
  34#define IIOCNETHUP  _IO('I',11)
  35#define IIOCSETGST  _IO('I',12)
  36#define IIOCSETBRJ  _IO('I',13)
  37#define IIOCSIGPRF  _IO('I',14)
  38#define IIOCGETPRF  _IO('I',15)
  39#define IIOCSETPRF  _IO('I',16)
  40#define IIOCGETMAP  _IO('I',17)
  41#define IIOCSETMAP  _IO('I',18)
  42#define IIOCNETASL  _IO('I',19)
  43#define IIOCNETDIL  _IO('I',20)
  44#define IIOCGETCPS  _IO('I',21)
  45#define IIOCGETDVR  _IO('I',22)
  46#define IIOCNETLCR  _IO('I',23) /* dwabc ioctl for LCR from isdnlog */
  47#define IIOCNETDWRSET  _IO('I',24) /* dwabc ioctl to reset abc-values to default on a net-interface */
  48
  49#define IIOCNETALN  _IO('I',32)
  50#define IIOCNETDLN  _IO('I',33)
  51
  52#define IIOCNETGPN  _IO('I',34)
  53
  54#define IIOCDBGVAR  _IO('I',127)
  55
  56#define IIOCDRVCTL  _IO('I',128)
  57
  58/* cisco hdlck device private ioctls */
  59#define SIOCGKEEPPERIOD (SIOCDEVPRIVATE + 0)
  60#define SIOCSKEEPPERIOD (SIOCDEVPRIVATE + 1)
  61#define SIOCGDEBSERINT  (SIOCDEVPRIVATE + 2)
  62#define SIOCSDEBSERINT  (SIOCDEVPRIVATE + 3)
  63
  64/* Packet encapsulations for net-interfaces */
  65#define ISDN_NET_ENCAP_ETHER      0
  66#define ISDN_NET_ENCAP_RAWIP      1
  67#define ISDN_NET_ENCAP_IPTYP      2
  68#define ISDN_NET_ENCAP_CISCOHDLC  3 /* Without SLARP and keepalive */
  69#define ISDN_NET_ENCAP_SYNCPPP    4
  70#define ISDN_NET_ENCAP_UIHDLC     5
  71#define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive    */
  72#define ISDN_NET_ENCAP_X25IFACE   7 /* Documentation/networking/x25-iface.txt */
  73#define ISDN_NET_ENCAP_MAX_ENCAP  ISDN_NET_ENCAP_X25IFACE
  74
  75/* Facility which currently uses an ISDN-channel */
  76#define ISDN_USAGE_NONE       0
  77#define ISDN_USAGE_RAW        1
  78#define ISDN_USAGE_MODEM      2
  79#define ISDN_USAGE_NET        3
  80#define ISDN_USAGE_VOICE      4
  81#define ISDN_USAGE_FAX        5
  82#define ISDN_USAGE_MASK       7 /* Mask to get plain usage */
  83#define ISDN_USAGE_DISABLED  32 /* This bit is set, if channel is disabled */
  84#define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */
  85#define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing  */
  86
  87#define ISDN_MODEM_NUMREG    24        /* Number of Modem-Registers        */
  88#define ISDN_LMSNLEN         255 /* Length of tty's Listen-MSN string */
  89#define ISDN_CMSGLEN         50  /* Length of CONNECT-Message to add for Modem */
  90
  91#define ISDN_MSNLEN          32
  92#define NET_DV 0x06  /* Data version for isdn_net_ioctl_cfg   */
  93#define TTY_DV 0x06  /* Data version for iprofd etc.          */
  94
  95#define INF_DV 0x01  /* Data version for /dev/isdninfo        */
  96
  97typedef struct {
  98  char drvid[25];
  99  unsigned long arg;
 100} isdn_ioctl_struct;
 101
 102typedef struct {
 103  char name[10];
 104  char phone[ISDN_MSNLEN];
 105  int  outgoing;
 106} isdn_net_ioctl_phone;
 107
 108typedef struct {
 109  char name[10];     /* Name of interface                     */
 110  char master[10];   /* Name of Master for Bundling           */
 111  char slave[10];    /* Name of Slave for Bundling            */
 112  char eaz[256];     /* EAZ/MSN                               */
 113  char drvid[25];    /* DriverId for Bindings                 */
 114  int  onhtime;      /* Hangup-Timeout                        */
 115  int  charge;       /* Charge-Units                          */
 116  int  l2_proto;     /* Layer-2 protocol                      */
 117  int  l3_proto;     /* Layer-3 protocol                      */
 118  int  p_encap;      /* Encapsulation                         */
 119  int  exclusive;    /* Channel, if bound exclusive           */
 120  int  dialmax;      /* Dial Retry-Counter                    */
 121  int  slavedelay;   /* Delay until slave starts up           */
 122  int  cbdelay;      /* Delay before Callback                 */
 123  int  chargehup;    /* Flag: Charge-Hangup                   */
 124  int  ihup;         /* Flag: Hangup-Timeout on incoming line */
 125  int  secure;       /* Flag: Secure                          */
 126  int  callback;     /* Flag: Callback                        */
 127  int  cbhup;        /* Flag: Reject Call before Callback     */
 128  int  pppbind;      /* ippp device for bindings              */
 129  int  chargeint;    /* Use fixed charge interval length      */
 130  int  triggercps;   /* BogoCPS needed for triggering slave   */
 131  int  dialtimeout;  /* Dial-Timeout                          */
 132  int  dialwait;     /* Time to wait after failed dial        */
 133  int  dialmode;     /* Flag: off / on / auto                 */
 134} isdn_net_ioctl_cfg;
 135
 136#define ISDN_NET_DIALMODE_MASK  0xC0    /* bits for status                */
 137#define ISDN_NET_DM_OFF         0x00    /* this interface is stopped      */
 138#define ISDN_NET_DM_MANUAL      0x40    /* this interface is on (manual)  */
 139#define ISDN_NET_DM_AUTO        0x80    /* this interface is autodial     */
 140#define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK)
 141
 142#ifdef __KERNEL__
 143
 144#include <linux/errno.h>
 145#include <linux/fs.h>
 146#include <linux/major.h>
 147#include <asm/io.h>
 148#include <linux/kernel.h>
 149#include <linux/signal.h>
 150#include <linux/slab.h>
 151#include <linux/timer.h>
 152#include <linux/wait.h>
 153#include <linux/tty.h>
 154#include <linux/tty_flip.h>
 155#include <linux/serial_reg.h>
 156#include <linux/fcntl.h>
 157#include <linux/types.h>
 158#include <linux/interrupt.h>
 159#include <linux/ip.h>
 160#include <linux/in.h>
 161#include <linux/netdevice.h>
 162#include <linux/etherdevice.h>
 163#include <linux/skbuff.h>
 164#include <linux/tcp.h>
 165#include <linux/mutex.h>
 166
 167#define ISDN_TTY_MAJOR    43
 168#define ISDN_TTYAUX_MAJOR 44
 169#define ISDN_MAJOR        45
 170
 171/* The minor-devicenumbers for Channel 0 and 1 are used as arguments for
 172 * physical Channel-Mapping, so they MUST NOT be changed without changing
 173 * the correspondent code in isdn.c
 174 */
 175
 176#define ISDN_MINOR_B        0
 177#define ISDN_MINOR_BMAX     (ISDN_MAX_CHANNELS-1)
 178#define ISDN_MINOR_CTRL     64
 179#define ISDN_MINOR_CTRLMAX  (64 + (ISDN_MAX_CHANNELS-1))
 180#define ISDN_MINOR_PPP      128
 181#define ISDN_MINOR_PPPMAX   (128 + (ISDN_MAX_CHANNELS-1))
 182#define ISDN_MINOR_STATUS   255
 183
 184#ifdef CONFIG_ISDN_PPP
 185
 186#ifdef CONFIG_ISDN_PPP_VJ
 187#  include <net/slhc_vj.h>
 188#endif
 189
 190#include <linux/ppp_defs.h>
 191#include <linux/ppp-ioctl.h>
 192
 193#include <linux/isdn_ppp.h>
 194#endif
 195
 196#ifdef CONFIG_ISDN_X25
 197#  include <linux/concap.h>
 198#endif
 199
 200#include <linux/isdnif.h>
 201
 202#define ISDN_DRVIOCTL_MASK       0x7f  /* Mask for Device-ioctl */
 203
 204/* Until now unused */
 205#define ISDN_SERVICE_VOICE 1
 206#define ISDN_SERVICE_AB    1<<1 
 207#define ISDN_SERVICE_X21   1<<2
 208#define ISDN_SERVICE_G4    1<<3
 209#define ISDN_SERVICE_BTX   1<<4
 210#define ISDN_SERVICE_DFUE  1<<5
 211#define ISDN_SERVICE_X25   1<<6
 212#define ISDN_SERVICE_TTX   1<<7
 213#define ISDN_SERVICE_MIXED 1<<8
 214#define ISDN_SERVICE_FW    1<<9
 215#define ISDN_SERVICE_GTEL  1<<10
 216#define ISDN_SERVICE_BTXN  1<<11
 217#define ISDN_SERVICE_BTEL  1<<12
 218
 219/* Macros checking plain usage */
 220#define USG_NONE(x)         ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE)
 221#define USG_RAW(x)          ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW)
 222#define USG_MODEM(x)        ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM)
 223#define USG_VOICE(x)        ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)
 224#define USG_NET(x)          ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET)
 225#define USG_FAX(x)          ((x & ISDN_USAGE_MASK)==ISDN_USAGE_FAX)
 226#define USG_OUTGOING(x)     ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING)
 227#define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \
 228                             ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)     )
 229
 230/* Timer-delays and scheduling-flags */
 231#define ISDN_TIMER_RES         4                         /* Main Timer-Resolution   */
 232#define ISDN_TIMER_02SEC       (HZ/ISDN_TIMER_RES/5)     /* Slow-Timer1 .2 sec      */
 233#define ISDN_TIMER_1SEC        (HZ/ISDN_TIMER_RES)       /* Slow-Timer2 1 sec       */
 234#define ISDN_TIMER_RINGING     5 /* tty RINGs = ISDN_TIMER_1SEC * this factor       */
 235#define ISDN_TIMER_KEEPINT    10 /* Cisco-Keepalive = ISDN_TIMER_1SEC * this factor */
 236#define ISDN_TIMER_MODEMREAD   1
 237#define ISDN_TIMER_MODEMPLUS   2
 238#define ISDN_TIMER_MODEMRING   4
 239#define ISDN_TIMER_MODEMXMIT   8
 240#define ISDN_TIMER_NETDIAL    16 
 241#define ISDN_TIMER_NETHANGUP  32
 242#define ISDN_TIMER_CARRIER   256 /* Wait for Carrier */
 243#define ISDN_TIMER_FAST      (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \
 244                              ISDN_TIMER_MODEMXMIT)
 245#define ISDN_TIMER_SLOW      (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \
 246                              ISDN_TIMER_NETDIAL | ISDN_TIMER_CARRIER)
 247
 248/* Timeout-Values for isdn_net_dial() */
 249#define ISDN_TIMER_DTIMEOUT10 (10*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
 250#define ISDN_TIMER_DTIMEOUT15 (15*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
 251#define ISDN_TIMER_DTIMEOUT60 (60*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1)))
 252
 253/* GLOBAL_FLAGS */
 254#define ISDN_GLOBAL_STOPPED 1
 255
 256/*=================== Start of ip-over-ISDN stuff =========================*/
 257
 258/* Feature- and status-flags for a net-interface */
 259#define ISDN_NET_CONNECTED  0x01       /* Bound to ISDN-Channel             */
 260#define ISDN_NET_SECURE     0x02       /* Accept calls from phonelist only  */
 261#define ISDN_NET_CALLBACK   0x04       /* activate callback                 */
 262#define ISDN_NET_CBHUP      0x08       /* hangup before callback            */
 263#define ISDN_NET_CBOUT      0x10       /* remote machine does callback      */
 264
 265#define ISDN_NET_MAGIC      0x49344C02 /* for paranoia-checking             */
 266
 267/* Phone-list-element */
 268typedef struct {
 269  void *next;
 270  char num[ISDN_MSNLEN];
 271} isdn_net_phone;
 272
 273/*
 274   Principles when extending structures for generic encapsulation protocol
 275   ("concap") support:
 276   - Stuff which is hardware specific (here i4l-specific) goes in 
 277     the netdev -> local structure (here: isdn_net_local)
 278   - Stuff which is encapsulation protocol specific goes in the structure
 279     which holds the linux device structure (here: isdn_net_device)
 280*/
 281
 282/* Local interface-data */
 283typedef struct isdn_net_local_s {
 284  ulong                  magic;
 285  struct net_device_stats stats;       /* Ethernet Statistics              */
 286  int                    isdn_device;  /* Index to isdn-device             */
 287  int                    isdn_channel; /* Index to isdn-channel            */
 288  int                    ppp_slot;     /* PPPD device slot number          */
 289  int                    pre_device;   /* Preselected isdn-device          */
 290  int                    pre_channel;  /* Preselected isdn-channel         */
 291  int                    exclusive;    /* If non-zero idx to reserved chan.*/
 292  int                    flags;        /* Connection-flags                 */
 293  int                    dialretry;    /* Counter for Dialout-retries      */
 294  int                    dialmax;      /* Max. Number of Dial-retries      */
 295  int                    cbdelay;      /* Delay before Callback starts     */
 296  int                    dtimer;       /* Timeout-counter for dialing      */
 297  char                   msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */
 298  u_char                 cbhup;        /* Flag: Reject Call before Callback*/
 299  u_char                 dialstate;    /* State for dialing                */
 300  u_char                 p_encap;      /* Packet encapsulation             */
 301                                       /*   0 = Ethernet over ISDN         */
 302                                       /*   1 = RAW-IP                     */
 303                                       /*   2 = IP with type field         */
 304  u_char                 l2_proto;     /* Layer-2-protocol                 */
 305                                       /* See ISDN_PROTO_L2..-constants in */
 306                                       /* isdnif.h                         */
 307                                       /*   0 = X75/LAPB with I-Frames     */
 308                                       /*   1 = X75/LAPB with UI-Frames    */
 309                                       /*   2 = X75/LAPB with BUI-Frames   */
 310                                       /*   3 = HDLC                       */
 311  u_char                 l3_proto;     /* Layer-3-protocol                 */
 312                                       /* See ISDN_PROTO_L3..-constants in */
 313                                       /* isdnif.h                         */
 314                                       /*   0 = Transparent                */
 315  int                    huptimer;     /* Timeout-counter for auto-hangup  */
 316  int                    charge;       /* Counter for charging units       */
 317  ulong                  chargetime;   /* Timer for Charging info          */
 318  int                    hupflags;     /* Flags for charge-unit-hangup:    */
 319                                       /* bit0: chargeint is invalid       */
 320                                       /* bit1: Getting charge-interval    */
 321                                       /* bit2: Do charge-unit-hangup      */
 322                                       /* bit3: Do hangup even on incoming */
 323  int                    outgoing;     /* Flag: outgoing call              */
 324  int                    onhtime;      /* Time to keep link up             */
 325  int                    chargeint;    /* Interval between charge-infos    */
 326  int                    onum;         /* Flag: at least 1 outgoing number */
 327  int                    cps;          /* current speed of this interface  */
 328  int                    transcount;   /* byte-counter for cps-calculation */
 329  int                    sqfull;       /* Flag: netdev-queue overloaded    */
 330  ulong                  sqfull_stamp; /* Start-Time of overload           */
 331  ulong                  slavedelay;   /* Dynamic bundling delaytime       */
 332  int                    triggercps;   /* BogoCPS needed for trigger slave */
 333  isdn_net_phone         *phone[2];    /* List of remote-phonenumbers      */
 334                                       /* phone[0] = Incoming Numbers      */
 335                                       /* phone[1] = Outgoing Numbers      */
 336  isdn_net_phone         *dial;        /* Pointer to dialed number         */
 337  struct net_device      *master;      /* Ptr to Master device for slaves  */
 338  struct net_device      *slave;       /* Ptr to Slave device for masters  */
 339  struct isdn_net_local_s *next;       /* Ptr to next link in bundle       */
 340  struct isdn_net_local_s *last;       /* Ptr to last link in bundle       */
 341  struct isdn_net_dev_s  *netdev;      /* Ptr to netdev                    */
 342  struct sk_buff_head    super_tx_queue; /* List of supervisory frames to  */
 343                                       /* be transmitted asap              */
 344  atomic_t frame_cnt;                  /* number of frames currently       */
 345                                       /* queued in HL driver              */    
 346                                       /* Ptr to orig. hard_header_cache   */
 347  spinlock_t             xmit_lock;    /* used to protect the xmit path of */
 348                                       /* a particular channel (including  */
 349                                       /* the frame_cnt                    */
 350
 351  int  pppbind;                        /* ippp device for bindings         */
 352  int                                   dialtimeout;    /* How long shall we try on dialing? (jiffies) */
 353  int                                   dialwait;               /* How long shall we wait after failed attempt? (jiffies) */
 354  ulong                                 dialstarted;    /* jiffies of first dialing-attempt */
 355  ulong                                 dialwait_timer; /* jiffies of earliest next dialing-attempt */
 356  int                                   huptimeout;             /* How long will the connection be up? (seconds) */
 357#ifdef CONFIG_ISDN_X25
 358  struct concap_device_ops *dops;      /* callbacks used by encapsulator   */
 359#endif
 360  /* use an own struct for that in later versions */
 361  ulong cisco_myseq;                   /* Local keepalive seq. for Cisco   */
 362  ulong cisco_mineseen;                /* returned keepalive seq. from remote */
 363  ulong cisco_yourseq;                 /* Remote keepalive seq. for Cisco  */
 364  int cisco_keepalive_period;           /* keepalive period */
 365  ulong cisco_last_slarp_in;            /* jiffie of last keepalive packet we received */
 366  char cisco_line_state;                /* state of line according to keepalive packets */
 367  char cisco_debserint;                 /* debugging flag of cisco hdlc with slarp */
 368  struct timer_list cisco_timer;
 369  struct work_struct tqueue;
 370} isdn_net_local;
 371
 372/* the interface itself */
 373typedef struct isdn_net_dev_s {
 374  isdn_net_local *local;
 375  isdn_net_local *queue;               /* circular list of all bundled
 376                                          channels, which are currently
 377                                          online                           */
 378  spinlock_t queue_lock;               /* lock to protect queue            */
 379  void *next;                          /* Pointer to next isdn-interface   */
 380  struct net_device *dev;              /* interface to upper levels        */
 381#ifdef CONFIG_ISDN_PPP
 382  ippp_bundle * pb;             /* pointer to the common bundle structure
 383                                 * with the per-bundle data */
 384#endif
 385#ifdef CONFIG_ISDN_X25
 386  struct concap_proto  *cprot; /* connection oriented encapsulation protocol */
 387#endif
 388
 389} isdn_net_dev;
 390
 391/*===================== End of ip-over-ISDN stuff ===========================*/
 392
 393/*======================= Start of ISDN-tty stuff ===========================*/
 394
 395#define ISDN_ASYNC_MAGIC          0x49344C01 /* for paranoia-checking        */
 396#define ISDN_SERIAL_XMIT_SIZE           1024 /* Default bufsize for write    */
 397#define ISDN_SERIAL_XMIT_MAX            4000 /* Maximum bufsize for write    */
 398
 399#ifdef CONFIG_ISDN_AUDIO
 400/* For using sk_buffs with audio we need some private variables
 401 * within each sk_buff. For this purpose, we declare a struct here,
 402 * and put it always at the private skb->cb data array. A few macros help
 403 * accessing the variables.
 404 */
 405typedef struct _isdn_audio_data {
 406  unsigned short dle_count;
 407  unsigned char  lock;
 408} isdn_audio_data_t;
 409
 410#define ISDN_AUDIO_SKB_DLECOUNT(skb)    (((isdn_audio_data_t *)&skb->cb[0])->dle_count)
 411#define ISDN_AUDIO_SKB_LOCK(skb)        (((isdn_audio_data_t *)&skb->cb[0])->lock)
 412#endif
 413
 414/* Private data of AT-command-interpreter */
 415typedef struct atemu {
 416        u_char       profile[ISDN_MODEM_NUMREG]; /* Modem-Regs. Profile 0              */
 417        u_char       mdmreg[ISDN_MODEM_NUMREG];  /* Modem-Registers                    */
 418        char         pmsn[ISDN_MSNLEN];          /* EAZ/MSNs Profile 0                 */
 419        char         msn[ISDN_MSNLEN];           /* EAZ/MSN                            */
 420        char         plmsn[ISDN_LMSNLEN];        /* Listening MSNs Profile 0           */
 421        char         lmsn[ISDN_LMSNLEN];         /* Listening MSNs                     */
 422        char         cpn[ISDN_MSNLEN];           /* CalledPartyNumber on incoming call */
 423        char         connmsg[ISDN_CMSGLEN];      /* CONNECT-Msg from HL-Driver         */
 424#ifdef CONFIG_ISDN_AUDIO
 425        u_char       vpar[10];                   /* Voice-parameters                   */
 426        int          lastDLE;                    /* Flag for voice-coding: DLE seen    */
 427#endif
 428        int          mdmcmdl;                    /* Length of Modem-Commandbuffer      */
 429        int          pluscount;                  /* Counter for +++ sequence           */
 430        u_long       lastplus;                   /* Timestamp of last +                */
 431        int          carrierwait;                /* Seconds of carrier waiting         */
 432        char         mdmcmd[255];                /* Modem-Commandbuffer                */
 433        unsigned int charge;                     /* Charge units of current connection */
 434} atemu;
 435
 436/* Private data (similar to async_struct in <linux/serial.h>) */
 437typedef struct modem_info {
 438  int                   magic;
 439  struct tty_port       port;
 440  int                   x_char;          /* xon/xoff character             */
 441  int                   mcr;             /* Modem control register         */
 442  int                   msr;             /* Modem status register          */
 443  int                   lsr;             /* Line status register           */
 444  int                   line;
 445  int                   online;          /* 1 = B-Channel is up, drop data */
 446                                         /* 2 = B-Channel is up, deliver d.*/
 447  int                   dialing;         /* Dial in progress or ATA        */
 448  int                   rcvsched;        /* Receive needs schedule         */
 449  int                   isdn_driver;     /* Index to isdn-driver           */
 450  int                   isdn_channel;    /* Index to isdn-channel          */
 451  int                   drv_index;       /* Index to dev->usage            */
 452  int                   ncarrier;        /* Flag: schedule NO CARRIER      */
 453  unsigned char         last_cause[8];   /* Last cause message             */
 454  unsigned char         last_num[ISDN_MSNLEN];
 455                                         /* Last phone-number              */
 456  unsigned char         last_l2;         /* Last layer-2 protocol          */
 457  unsigned char         last_si;         /* Last service                   */
 458  unsigned char         last_lhup;       /* Last hangup local?             */
 459  unsigned char         last_dir;        /* Last direction (in or out)     */
 460  struct timer_list     nc_timer;        /* Timer for delayed NO CARRIER   */
 461  int                   send_outstanding;/* # of outstanding send-requests */
 462  int                   xmit_size;       /* max. # of chars in xmit_buf    */
 463  int                   xmit_count;      /* # of chars in xmit_buf         */
 464  struct sk_buff_head   xmit_queue;      /* transmit queue                 */
 465  atomic_t              xmit_lock;       /* Semaphore for isdn_tty_write   */
 466#ifdef CONFIG_ISDN_AUDIO
 467  int                   vonline;         /* Voice-channel status           */
 468                                         /* Bit 0 = recording              */
 469                                         /* Bit 1 = playback               */
 470                                         /* Bit 2 = playback, DLE-ETX seen */
 471  struct sk_buff_head   dtmf_queue;      /* queue for dtmf results         */
 472  void                  *adpcms;         /* state for adpcm decompression  */
 473  void                  *adpcmr;         /* state for adpcm compression    */
 474  void                  *dtmf_state;     /* state for dtmf decoder         */
 475  void                  *silence_state;  /* state for silence detection    */
 476#endif
 477#ifdef CONFIG_ISDN_TTY_FAX
 478  struct T30_s          *fax;            /* T30 Fax Group 3 data/interface */
 479  int                   faxonline;       /* Fax-channel status             */
 480#endif
 481  atemu                 emu;             /* AT-emulator data               */
 482  spinlock_t            readlock;
 483} modem_info;
 484
 485#define ISDN_MODEM_WINSIZE 8
 486
 487/* Description of one ISDN-tty */
 488typedef struct _isdn_modem {
 489  int                refcount;                          /* Number of opens        */
 490  struct tty_driver  *tty_modem;                        /* tty-device             */
 491  struct tty_struct  *modem_table[ISDN_MAX_CHANNELS];   /* ?? copied from Orig    */
 492  struct ktermios     *modem_termios[ISDN_MAX_CHANNELS];
 493  struct ktermios     *modem_termios_locked[ISDN_MAX_CHANNELS];
 494  modem_info         info[ISDN_MAX_CHANNELS];      /* Private data           */
 495} isdn_modem_t;
 496
 497/*======================= End of ISDN-tty stuff ============================*/
 498
 499/*======================== Start of V.110 stuff ============================*/
 500#define V110_BUFSIZE 1024
 501
 502typedef struct {
 503        int nbytes;                    /* 1 Matrixbyte -> nbytes in stream     */
 504        int nbits;                     /* Number of used bits in streambyte    */
 505        unsigned char key;             /* Bitmask in stream eg. 11 (nbits=2)   */
 506        int decodelen;                 /* Amount of data in decodebuf          */
 507        int SyncInit;                  /* Number of sync frames to send        */
 508        unsigned char *OnlineFrame;    /* Precalculated V110 idle frame        */
 509        unsigned char *OfflineFrame;   /* Precalculated V110 sync Frame        */
 510        int framelen;                  /* Length of frames                     */
 511        int skbuser;                   /* Number of unacked userdata skbs      */
 512        int skbidle;                   /* Number of unacked idle/sync skbs     */
 513        int introducer;                /* Local vars for decoder               */
 514        int dbit;
 515        unsigned char b;
 516        int skbres;                    /* space to reserve in outgoing skb     */
 517        int maxsize;                   /* maxbufsize of lowlevel driver        */
 518        unsigned char *encodebuf;      /* temporary buffer for encoding        */
 519        unsigned char decodebuf[V110_BUFSIZE]; /* incomplete V110 matrices     */
 520} isdn_v110_stream;
 521
 522/*========================= End of V.110 stuff =============================*/
 523
 524/*======================= Start of general stuff ===========================*/
 525
 526typedef struct {
 527        char *next;
 528        char *private;
 529} infostruct;
 530
 531#define DRV_FLAG_RUNNING 1
 532#define DRV_FLAG_REJBUS  2
 533#define DRV_FLAG_LOADED  4
 534
 535/* Description of hardware-level-driver */
 536typedef struct _isdn_driver {
 537        ulong               online;           /* Channel-Online flags             */
 538        ulong               flags;            /* Misc driver Flags                */
 539        int                 locks;            /* Number of locks for this driver  */
 540        int                 channels;         /* Number of channels               */
 541        wait_queue_head_t   st_waitq;         /* Wait-Queue for status-read's     */
 542        int                 maxbufsize;       /* Maximum Buffersize supported     */
 543        unsigned long       pktcount;         /* Until now: unused                */
 544        int                 stavail;          /* Chars avail on Status-device     */
 545        isdn_if            *interface;        /* Interface to driver              */
 546        int                *rcverr;           /* Error-counters for B-Ch.-receive */
 547        int                *rcvcount;         /* Byte-counters for B-Ch.-receive  */
 548#ifdef CONFIG_ISDN_AUDIO
 549        unsigned long      DLEflag;           /* Flags: Insert DLE at next read   */
 550#endif
 551        struct sk_buff_head *rpqueue;         /* Pointers to start of Rcv-Queue   */
 552        wait_queue_head_t  *rcv_waitq;       /* Wait-Queues for B-Channel-Reads  */
 553        wait_queue_head_t  *snd_waitq;       /* Wait-Queue for B-Channel-Send's  */
 554        char               msn2eaz[10][ISDN_MSNLEN];  /* Mapping-Table MSN->EAZ   */
 555} isdn_driver_t;
 556
 557/* Main driver-data */
 558typedef struct isdn_devt {
 559        struct module     *owner;
 560        spinlock_t        lock;
 561        unsigned short    flags;                      /* Bitmapped Flags:           */
 562        int               drivers;                    /* Current number of drivers  */
 563        int               channels;                   /* Current number of channels */
 564        int               net_verbose;                /* Verbose-Flag               */
 565        int               modempoll;                  /* Flag: tty-read active      */
 566        spinlock_t        timerlock;
 567        int               tflags;                     /* Timer-Flags:               */
 568        /*  see ISDN_TIMER_..defines  */
 569        int               global_flags;
 570        infostruct        *infochain;                 /* List of open info-devs.    */
 571        wait_queue_head_t info_waitq;                 /* Wait-Queue for isdninfo    */
 572        struct timer_list timer;                      /* Misc.-function Timer       */
 573        int               chanmap[ISDN_MAX_CHANNELS]; /* Map minor->device-channel  */
 574        int               drvmap[ISDN_MAX_CHANNELS];  /* Map minor->driver-index    */
 575        int               usage[ISDN_MAX_CHANNELS];   /* Used by tty/ip/voice       */
 576        char              num[ISDN_MAX_CHANNELS][ISDN_MSNLEN];
 577        /* Remote number of active ch.*/
 578        int               m_idx[ISDN_MAX_CHANNELS];   /* Index for mdm....          */
 579        isdn_driver_t     *drv[ISDN_MAX_DRIVERS];     /* Array of drivers           */
 580        isdn_net_dev      *netdev;                    /* Linked list of net-if's    */
 581        char              drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID                 */
 582        struct task_struct *profd;                    /* For iprofd                 */
 583        isdn_modem_t      mdm;                        /* tty-driver-data            */
 584        isdn_net_dev      *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers     */
 585        isdn_net_dev      *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers   */
 586        ulong             ibytes[ISDN_MAX_CHANNELS];  /* Statistics incoming bytes  */
 587        ulong             obytes[ISDN_MAX_CHANNELS];  /* Statistics outgoing bytes  */
 588        int               v110emu[ISDN_MAX_CHANNELS]; /* V.110 emulator-mode 0=none */
 589        atomic_t          v110use[ISDN_MAX_CHANNELS]; /* Usage-Semaphore for stream */
 590        isdn_v110_stream  *v110[ISDN_MAX_CHANNELS];   /* V.110 private data         */
 591        struct mutex      mtx;                        /* serialize list access*/
 592        unsigned long     global_features;
 593} isdn_dev;
 594
 595extern isdn_dev *dev;
 596
 597
 598#endif /* __KERNEL__ */
 599
 600#endif /* __ISDN_H__ */
 601
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.