Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #ifndef __ISDN_H__ |
| 14 | #define __ISDN_H__ |
| 15 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <linux/errno.h> |
| 18 | #include <linux/fs.h> |
| 19 | #include <linux/major.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include <asm/io.h> |
| 21 | #include <linux/kernel.h> |
| 22 | #include <linux/signal.h> |
| 23 | #include <linux/slab.h> |
| 24 | #include <linux/timer.h> |
| 25 | #include <linux/wait.h> |
| 26 | #include <linux/tty.h> |
| 27 | #include <linux/tty_flip.h> |
| 28 | #include <linux/serial_reg.h> |
| 29 | #include <linux/fcntl.h> |
| 30 | #include <linux/types.h> |
| 31 | #include <linux/interrupt.h> |
| 32 | #include <linux/ip.h> |
| 33 | #include <linux/in.h> |
| 34 | #include <linux/netdevice.h> |
| 35 | #include <linux/etherdevice.h> |
| 36 | #include <linux/skbuff.h> |
| 37 | #include <linux/tcp.h> |
Matthias Kaehlcke | 4e3dfac | 2007-10-16 01:27:50 -0700 | [diff] [blame] | 38 | #include <linux/mutex.h> |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 39 | #include <uapi/linux/isdn.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | #define ISDN_TTY_MAJOR 43 |
| 42 | #define ISDN_TTYAUX_MAJOR 44 |
| 43 | #define ISDN_MAJOR 45 |
| 44 | |
| 45 | /* The minor-devicenumbers for Channel 0 and 1 are used as arguments for |
| 46 | * physical Channel-Mapping, so they MUST NOT be changed without changing |
| 47 | * the correspondent code in isdn.c |
| 48 | */ |
| 49 | |
| 50 | #define ISDN_MINOR_B 0 |
| 51 | #define ISDN_MINOR_BMAX (ISDN_MAX_CHANNELS-1) |
| 52 | #define ISDN_MINOR_CTRL 64 |
| 53 | #define ISDN_MINOR_CTRLMAX (64 + (ISDN_MAX_CHANNELS-1)) |
| 54 | #define ISDN_MINOR_PPP 128 |
| 55 | #define ISDN_MINOR_PPPMAX (128 + (ISDN_MAX_CHANNELS-1)) |
| 56 | #define ISDN_MINOR_STATUS 255 |
| 57 | |
| 58 | #ifdef CONFIG_ISDN_PPP |
| 59 | |
| 60 | #ifdef CONFIG_ISDN_PPP_VJ |
| 61 | # include <net/slhc_vj.h> |
| 62 | #endif |
| 63 | |
| 64 | #include <linux/ppp_defs.h> |
Paul Mackerras | 4b32da2b | 2012-03-04 12:56:55 +0000 | [diff] [blame] | 65 | #include <linux/ppp-ioctl.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
| 67 | #include <linux/isdn_ppp.h> |
| 68 | #endif |
| 69 | |
| 70 | #ifdef CONFIG_ISDN_X25 |
| 71 | # include <linux/concap.h> |
| 72 | #endif |
| 73 | |
| 74 | #include <linux/isdnif.h> |
| 75 | |
| 76 | #define ISDN_DRVIOCTL_MASK 0x7f /* Mask for Device-ioctl */ |
| 77 | |
| 78 | /* Until now unused */ |
| 79 | #define ISDN_SERVICE_VOICE 1 |
| 80 | #define ISDN_SERVICE_AB 1<<1 |
| 81 | #define ISDN_SERVICE_X21 1<<2 |
| 82 | #define ISDN_SERVICE_G4 1<<3 |
| 83 | #define ISDN_SERVICE_BTX 1<<4 |
| 84 | #define ISDN_SERVICE_DFUE 1<<5 |
| 85 | #define ISDN_SERVICE_X25 1<<6 |
| 86 | #define ISDN_SERVICE_TTX 1<<7 |
| 87 | #define ISDN_SERVICE_MIXED 1<<8 |
| 88 | #define ISDN_SERVICE_FW 1<<9 |
| 89 | #define ISDN_SERVICE_GTEL 1<<10 |
| 90 | #define ISDN_SERVICE_BTXN 1<<11 |
| 91 | #define ISDN_SERVICE_BTEL 1<<12 |
| 92 | |
| 93 | /* Macros checking plain usage */ |
| 94 | #define USG_NONE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE) |
| 95 | #define USG_RAW(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW) |
| 96 | #define USG_MODEM(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) |
| 97 | #define USG_VOICE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) |
| 98 | #define USG_NET(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET) |
| 99 | #define USG_FAX(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_FAX) |
| 100 | #define USG_OUTGOING(x) ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING) |
| 101 | #define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \ |
| 102 | ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) ) |
| 103 | |
| 104 | /* Timer-delays and scheduling-flags */ |
| 105 | #define ISDN_TIMER_RES 4 /* Main Timer-Resolution */ |
| 106 | #define ISDN_TIMER_02SEC (HZ/ISDN_TIMER_RES/5) /* Slow-Timer1 .2 sec */ |
| 107 | #define ISDN_TIMER_1SEC (HZ/ISDN_TIMER_RES) /* Slow-Timer2 1 sec */ |
| 108 | #define ISDN_TIMER_RINGING 5 /* tty RINGs = ISDN_TIMER_1SEC * this factor */ |
| 109 | #define ISDN_TIMER_KEEPINT 10 /* Cisco-Keepalive = ISDN_TIMER_1SEC * this factor */ |
| 110 | #define ISDN_TIMER_MODEMREAD 1 |
| 111 | #define ISDN_TIMER_MODEMPLUS 2 |
| 112 | #define ISDN_TIMER_MODEMRING 4 |
| 113 | #define ISDN_TIMER_MODEMXMIT 8 |
| 114 | #define ISDN_TIMER_NETDIAL 16 |
| 115 | #define ISDN_TIMER_NETHANGUP 32 |
| 116 | #define ISDN_TIMER_CARRIER 256 /* Wait for Carrier */ |
| 117 | #define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \ |
| 118 | ISDN_TIMER_MODEMXMIT) |
| 119 | #define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \ |
| 120 | ISDN_TIMER_NETDIAL | ISDN_TIMER_CARRIER) |
| 121 | |
| 122 | /* Timeout-Values for isdn_net_dial() */ |
| 123 | #define ISDN_TIMER_DTIMEOUT10 (10*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1))) |
| 124 | #define ISDN_TIMER_DTIMEOUT15 (15*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1))) |
| 125 | #define ISDN_TIMER_DTIMEOUT60 (60*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1))) |
| 126 | |
| 127 | /* GLOBAL_FLAGS */ |
| 128 | #define ISDN_GLOBAL_STOPPED 1 |
| 129 | |
| 130 | /*=================== Start of ip-over-ISDN stuff =========================*/ |
| 131 | |
| 132 | /* Feature- and status-flags for a net-interface */ |
| 133 | #define ISDN_NET_CONNECTED 0x01 /* Bound to ISDN-Channel */ |
| 134 | #define ISDN_NET_SECURE 0x02 /* Accept calls from phonelist only */ |
| 135 | #define ISDN_NET_CALLBACK 0x04 /* activate callback */ |
| 136 | #define ISDN_NET_CBHUP 0x08 /* hangup before callback */ |
| 137 | #define ISDN_NET_CBOUT 0x10 /* remote machine does callback */ |
| 138 | |
| 139 | #define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */ |
| 140 | |
| 141 | /* Phone-list-element */ |
| 142 | typedef struct { |
| 143 | void *next; |
| 144 | char num[ISDN_MSNLEN]; |
| 145 | } isdn_net_phone; |
| 146 | |
| 147 | /* |
| 148 | Principles when extending structures for generic encapsulation protocol |
| 149 | ("concap") support: |
| 150 | - Stuff which is hardware specific (here i4l-specific) goes in |
| 151 | the netdev -> local structure (here: isdn_net_local) |
| 152 | - Stuff which is encapsulation protocol specific goes in the structure |
| 153 | which holds the linux device structure (here: isdn_net_device) |
| 154 | */ |
| 155 | |
| 156 | /* Local interface-data */ |
| 157 | typedef struct isdn_net_local_s { |
| 158 | ulong magic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | struct net_device_stats stats; /* Ethernet Statistics */ |
| 160 | int isdn_device; /* Index to isdn-device */ |
| 161 | int isdn_channel; /* Index to isdn-channel */ |
| 162 | int ppp_slot; /* PPPD device slot number */ |
| 163 | int pre_device; /* Preselected isdn-device */ |
| 164 | int pre_channel; /* Preselected isdn-channel */ |
| 165 | int exclusive; /* If non-zero idx to reserved chan.*/ |
| 166 | int flags; /* Connection-flags */ |
| 167 | int dialretry; /* Counter for Dialout-retries */ |
| 168 | int dialmax; /* Max. Number of Dial-retries */ |
| 169 | int cbdelay; /* Delay before Callback starts */ |
| 170 | int dtimer; /* Timeout-counter for dialing */ |
| 171 | char msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */ |
| 172 | u_char cbhup; /* Flag: Reject Call before Callback*/ |
| 173 | u_char dialstate; /* State for dialing */ |
| 174 | u_char p_encap; /* Packet encapsulation */ |
| 175 | /* 0 = Ethernet over ISDN */ |
| 176 | /* 1 = RAW-IP */ |
| 177 | /* 2 = IP with type field */ |
| 178 | u_char l2_proto; /* Layer-2-protocol */ |
| 179 | /* See ISDN_PROTO_L2..-constants in */ |
| 180 | /* isdnif.h */ |
| 181 | /* 0 = X75/LAPB with I-Frames */ |
| 182 | /* 1 = X75/LAPB with UI-Frames */ |
| 183 | /* 2 = X75/LAPB with BUI-Frames */ |
| 184 | /* 3 = HDLC */ |
| 185 | u_char l3_proto; /* Layer-3-protocol */ |
| 186 | /* See ISDN_PROTO_L3..-constants in */ |
| 187 | /* isdnif.h */ |
| 188 | /* 0 = Transparent */ |
| 189 | int huptimer; /* Timeout-counter for auto-hangup */ |
| 190 | int charge; /* Counter for charging units */ |
| 191 | ulong chargetime; /* Timer for Charging info */ |
| 192 | int hupflags; /* Flags for charge-unit-hangup: */ |
| 193 | /* bit0: chargeint is invalid */ |
| 194 | /* bit1: Getting charge-interval */ |
| 195 | /* bit2: Do charge-unit-hangup */ |
| 196 | /* bit3: Do hangup even on incoming */ |
| 197 | int outgoing; /* Flag: outgoing call */ |
| 198 | int onhtime; /* Time to keep link up */ |
| 199 | int chargeint; /* Interval between charge-infos */ |
| 200 | int onum; /* Flag: at least 1 outgoing number */ |
| 201 | int cps; /* current speed of this interface */ |
| 202 | int transcount; /* byte-counter for cps-calculation */ |
| 203 | int sqfull; /* Flag: netdev-queue overloaded */ |
| 204 | ulong sqfull_stamp; /* Start-Time of overload */ |
| 205 | ulong slavedelay; /* Dynamic bundling delaytime */ |
| 206 | int triggercps; /* BogoCPS needed for trigger slave */ |
| 207 | isdn_net_phone *phone[2]; /* List of remote-phonenumbers */ |
| 208 | /* phone[0] = Incoming Numbers */ |
| 209 | /* phone[1] = Outgoing Numbers */ |
| 210 | isdn_net_phone *dial; /* Pointer to dialed number */ |
| 211 | struct net_device *master; /* Ptr to Master device for slaves */ |
| 212 | struct net_device *slave; /* Ptr to Slave device for masters */ |
| 213 | struct isdn_net_local_s *next; /* Ptr to next link in bundle */ |
| 214 | struct isdn_net_local_s *last; /* Ptr to last link in bundle */ |
| 215 | struct isdn_net_dev_s *netdev; /* Ptr to netdev */ |
| 216 | struct sk_buff_head super_tx_queue; /* List of supervisory frames to */ |
| 217 | /* be transmitted asap */ |
| 218 | atomic_t frame_cnt; /* number of frames currently */ |
| 219 | /* queued in HL driver */ |
| 220 | /* Ptr to orig. hard_header_cache */ |
| 221 | spinlock_t xmit_lock; /* used to protect the xmit path of */ |
| 222 | /* a particular channel (including */ |
| 223 | /* the frame_cnt */ |
| 224 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | int pppbind; /* ippp device for bindings */ |
| 226 | int dialtimeout; /* How long shall we try on dialing? (jiffies) */ |
| 227 | int dialwait; /* How long shall we wait after failed attempt? (jiffies) */ |
| 228 | ulong dialstarted; /* jiffies of first dialing-attempt */ |
| 229 | ulong dialwait_timer; /* jiffies of earliest next dialing-attempt */ |
| 230 | int huptimeout; /* How long will the connection be up? (seconds) */ |
| 231 | #ifdef CONFIG_ISDN_X25 |
| 232 | struct concap_device_ops *dops; /* callbacks used by encapsulator */ |
| 233 | #endif |
| 234 | /* use an own struct for that in later versions */ |
| 235 | ulong cisco_myseq; /* Local keepalive seq. for Cisco */ |
| 236 | ulong cisco_mineseen; /* returned keepalive seq. from remote */ |
| 237 | ulong cisco_yourseq; /* Remote keepalive seq. for Cisco */ |
| 238 | int cisco_keepalive_period; /* keepalive period */ |
| 239 | ulong cisco_last_slarp_in; /* jiffie of last keepalive packet we received */ |
| 240 | char cisco_line_state; /* state of line according to keepalive packets */ |
| 241 | char cisco_debserint; /* debugging flag of cisco hdlc with slarp */ |
| 242 | struct timer_list cisco_timer; |
| 243 | struct work_struct tqueue; |
| 244 | } isdn_net_local; |
| 245 | |
| 246 | /* the interface itself */ |
| 247 | typedef struct isdn_net_dev_s { |
| 248 | isdn_net_local *local; |
| 249 | isdn_net_local *queue; /* circular list of all bundled |
| 250 | channels, which are currently |
| 251 | online */ |
| 252 | spinlock_t queue_lock; /* lock to protect queue */ |
| 253 | void *next; /* Pointer to next isdn-interface */ |
Karsten Keil | d62a38d | 2007-10-08 20:37:11 -0700 | [diff] [blame] | 254 | struct net_device *dev; /* interface to upper levels */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | #ifdef CONFIG_ISDN_PPP |
| 256 | ippp_bundle * pb; /* pointer to the common bundle structure |
| 257 | * with the per-bundle data */ |
| 258 | #endif |
| 259 | #ifdef CONFIG_ISDN_X25 |
| 260 | struct concap_proto *cprot; /* connection oriented encapsulation protocol */ |
| 261 | #endif |
| 262 | |
| 263 | } isdn_net_dev; |
| 264 | |
| 265 | /*===================== End of ip-over-ISDN stuff ===========================*/ |
| 266 | |
| 267 | /*======================= Start of ISDN-tty stuff ===========================*/ |
| 268 | |
| 269 | #define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | #define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */ |
| 271 | #define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | |
| 273 | #ifdef CONFIG_ISDN_AUDIO |
| 274 | /* For using sk_buffs with audio we need some private variables |
| 275 | * within each sk_buff. For this purpose, we declare a struct here, |
| 276 | * and put it always at the private skb->cb data array. A few macros help |
| 277 | * accessing the variables. |
| 278 | */ |
| 279 | typedef struct _isdn_audio_data { |
| 280 | unsigned short dle_count; |
| 281 | unsigned char lock; |
| 282 | } isdn_audio_data_t; |
| 283 | |
| 284 | #define ISDN_AUDIO_SKB_DLECOUNT(skb) (((isdn_audio_data_t *)&skb->cb[0])->dle_count) |
| 285 | #define ISDN_AUDIO_SKB_LOCK(skb) (((isdn_audio_data_t *)&skb->cb[0])->lock) |
| 286 | #endif |
| 287 | |
| 288 | /* Private data of AT-command-interpreter */ |
| 289 | typedef struct atemu { |
| 290 | u_char profile[ISDN_MODEM_NUMREG]; /* Modem-Regs. Profile 0 */ |
| 291 | u_char mdmreg[ISDN_MODEM_NUMREG]; /* Modem-Registers */ |
| 292 | char pmsn[ISDN_MSNLEN]; /* EAZ/MSNs Profile 0 */ |
| 293 | char msn[ISDN_MSNLEN]; /* EAZ/MSN */ |
| 294 | char plmsn[ISDN_LMSNLEN]; /* Listening MSNs Profile 0 */ |
| 295 | char lmsn[ISDN_LMSNLEN]; /* Listening MSNs */ |
| 296 | char cpn[ISDN_MSNLEN]; /* CalledPartyNumber on incoming call */ |
| 297 | char connmsg[ISDN_CMSGLEN]; /* CONNECT-Msg from HL-Driver */ |
| 298 | #ifdef CONFIG_ISDN_AUDIO |
| 299 | u_char vpar[10]; /* Voice-parameters */ |
| 300 | int lastDLE; /* Flag for voice-coding: DLE seen */ |
| 301 | #endif |
| 302 | int mdmcmdl; /* Length of Modem-Commandbuffer */ |
| 303 | int pluscount; /* Counter for +++ sequence */ |
| 304 | u_long lastplus; /* Timestamp of last + */ |
| 305 | int carrierwait; /* Seconds of carrier waiting */ |
| 306 | char mdmcmd[255]; /* Modem-Commandbuffer */ |
| 307 | unsigned int charge; /* Charge units of current connection */ |
| 308 | } atemu; |
| 309 | |
| 310 | /* Private data (similar to async_struct in <linux/serial.h>) */ |
| 311 | typedef struct modem_info { |
| 312 | int magic; |
Jiri Slaby | 48decc1 | 2012-04-02 13:53:54 +0200 | [diff] [blame] | 313 | struct tty_port port; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | int x_char; /* xon/xoff character */ |
| 315 | int mcr; /* Modem control register */ |
| 316 | int msr; /* Modem status register */ |
| 317 | int lsr; /* Line status register */ |
| 318 | int line; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | int online; /* 1 = B-Channel is up, drop data */ |
| 320 | /* 2 = B-Channel is up, deliver d.*/ |
| 321 | int dialing; /* Dial in progress or ATA */ |
Peter Hurley | a657eec | 2016-01-10 14:51:39 -0800 | [diff] [blame] | 322 | int closing; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | int rcvsched; /* Receive needs schedule */ |
| 324 | int isdn_driver; /* Index to isdn-driver */ |
| 325 | int isdn_channel; /* Index to isdn-channel */ |
| 326 | int drv_index; /* Index to dev->usage */ |
| 327 | int ncarrier; /* Flag: schedule NO CARRIER */ |
| 328 | unsigned char last_cause[8]; /* Last cause message */ |
| 329 | unsigned char last_num[ISDN_MSNLEN]; |
| 330 | /* Last phone-number */ |
| 331 | unsigned char last_l2; /* Last layer-2 protocol */ |
| 332 | unsigned char last_si; /* Last service */ |
| 333 | unsigned char last_lhup; /* Last hangup local? */ |
| 334 | unsigned char last_dir; /* Last direction (in or out) */ |
| 335 | struct timer_list nc_timer; /* Timer for delayed NO CARRIER */ |
| 336 | int send_outstanding;/* # of outstanding send-requests */ |
| 337 | int xmit_size; /* max. # of chars in xmit_buf */ |
| 338 | int xmit_count; /* # of chars in xmit_buf */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | struct sk_buff_head xmit_queue; /* transmit queue */ |
| 340 | atomic_t xmit_lock; /* Semaphore for isdn_tty_write */ |
| 341 | #ifdef CONFIG_ISDN_AUDIO |
| 342 | int vonline; /* Voice-channel status */ |
| 343 | /* Bit 0 = recording */ |
| 344 | /* Bit 1 = playback */ |
| 345 | /* Bit 2 = playback, DLE-ETX seen */ |
| 346 | struct sk_buff_head dtmf_queue; /* queue for dtmf results */ |
| 347 | void *adpcms; /* state for adpcm decompression */ |
| 348 | void *adpcmr; /* state for adpcm compression */ |
| 349 | void *dtmf_state; /* state for dtmf decoder */ |
| 350 | void *silence_state; /* state for silence detection */ |
| 351 | #endif |
| 352 | #ifdef CONFIG_ISDN_TTY_FAX |
| 353 | struct T30_s *fax; /* T30 Fax Group 3 data/interface */ |
| 354 | int faxonline; /* Fax-channel status */ |
| 355 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | atemu emu; /* AT-emulator data */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | spinlock_t readlock; |
| 358 | } modem_info; |
| 359 | |
| 360 | #define ISDN_MODEM_WINSIZE 8 |
| 361 | |
| 362 | /* Description of one ISDN-tty */ |
| 363 | typedef struct _isdn_modem { |
| 364 | int refcount; /* Number of opens */ |
| 365 | struct tty_driver *tty_modem; /* tty-device */ |
| 366 | struct tty_struct *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */ |
Alan Cox | 606d099 | 2006-12-08 02:38:45 -0800 | [diff] [blame] | 367 | struct ktermios *modem_termios[ISDN_MAX_CHANNELS]; |
| 368 | struct ktermios *modem_termios_locked[ISDN_MAX_CHANNELS]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | modem_info info[ISDN_MAX_CHANNELS]; /* Private data */ |
| 370 | } isdn_modem_t; |
| 371 | |
| 372 | /*======================= End of ISDN-tty stuff ============================*/ |
| 373 | |
| 374 | /*======================== Start of V.110 stuff ============================*/ |
| 375 | #define V110_BUFSIZE 1024 |
| 376 | |
| 377 | typedef struct { |
| 378 | int nbytes; /* 1 Matrixbyte -> nbytes in stream */ |
| 379 | int nbits; /* Number of used bits in streambyte */ |
| 380 | unsigned char key; /* Bitmask in stream eg. 11 (nbits=2) */ |
| 381 | int decodelen; /* Amount of data in decodebuf */ |
| 382 | int SyncInit; /* Number of sync frames to send */ |
| 383 | unsigned char *OnlineFrame; /* Precalculated V110 idle frame */ |
| 384 | unsigned char *OfflineFrame; /* Precalculated V110 sync Frame */ |
| 385 | int framelen; /* Length of frames */ |
| 386 | int skbuser; /* Number of unacked userdata skbs */ |
| 387 | int skbidle; /* Number of unacked idle/sync skbs */ |
| 388 | int introducer; /* Local vars for decoder */ |
| 389 | int dbit; |
| 390 | unsigned char b; |
| 391 | int skbres; /* space to reserve in outgoing skb */ |
| 392 | int maxsize; /* maxbufsize of lowlevel driver */ |
| 393 | unsigned char *encodebuf; /* temporary buffer for encoding */ |
| 394 | unsigned char decodebuf[V110_BUFSIZE]; /* incomplete V110 matrices */ |
| 395 | } isdn_v110_stream; |
| 396 | |
| 397 | /*========================= End of V.110 stuff =============================*/ |
| 398 | |
| 399 | /*======================= Start of general stuff ===========================*/ |
| 400 | |
| 401 | typedef struct { |
| 402 | char *next; |
| 403 | char *private; |
| 404 | } infostruct; |
| 405 | |
| 406 | #define DRV_FLAG_RUNNING 1 |
| 407 | #define DRV_FLAG_REJBUS 2 |
| 408 | #define DRV_FLAG_LOADED 4 |
| 409 | |
| 410 | /* Description of hardware-level-driver */ |
| 411 | typedef struct _isdn_driver { |
| 412 | ulong online; /* Channel-Online flags */ |
| 413 | ulong flags; /* Misc driver Flags */ |
| 414 | int locks; /* Number of locks for this driver */ |
| 415 | int channels; /* Number of channels */ |
| 416 | wait_queue_head_t st_waitq; /* Wait-Queue for status-read's */ |
| 417 | int maxbufsize; /* Maximum Buffersize supported */ |
| 418 | unsigned long pktcount; /* Until now: unused */ |
| 419 | int stavail; /* Chars avail on Status-device */ |
| 420 | isdn_if *interface; /* Interface to driver */ |
| 421 | int *rcverr; /* Error-counters for B-Ch.-receive */ |
| 422 | int *rcvcount; /* Byte-counters for B-Ch.-receive */ |
| 423 | #ifdef CONFIG_ISDN_AUDIO |
| 424 | unsigned long DLEflag; /* Flags: Insert DLE at next read */ |
| 425 | #endif |
| 426 | struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */ |
| 427 | wait_queue_head_t *rcv_waitq; /* Wait-Queues for B-Channel-Reads */ |
| 428 | wait_queue_head_t *snd_waitq; /* Wait-Queue for B-Channel-Send's */ |
| 429 | char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */ |
| 430 | } isdn_driver_t; |
| 431 | |
| 432 | /* Main driver-data */ |
| 433 | typedef struct isdn_devt { |
| 434 | struct module *owner; |
| 435 | spinlock_t lock; |
| 436 | unsigned short flags; /* Bitmapped Flags: */ |
| 437 | int drivers; /* Current number of drivers */ |
| 438 | int channels; /* Current number of channels */ |
| 439 | int net_verbose; /* Verbose-Flag */ |
| 440 | int modempoll; /* Flag: tty-read active */ |
| 441 | spinlock_t timerlock; |
| 442 | int tflags; /* Timer-Flags: */ |
| 443 | /* see ISDN_TIMER_..defines */ |
| 444 | int global_flags; |
| 445 | infostruct *infochain; /* List of open info-devs. */ |
| 446 | wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */ |
| 447 | struct timer_list timer; /* Misc.-function Timer */ |
| 448 | int chanmap[ISDN_MAX_CHANNELS]; /* Map minor->device-channel */ |
| 449 | int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */ |
| 450 | int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */ |
| 451 | char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN]; |
| 452 | /* Remote number of active ch.*/ |
| 453 | int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */ |
| 454 | isdn_driver_t *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */ |
| 455 | isdn_net_dev *netdev; /* Linked list of net-if's */ |
| 456 | char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */ |
| 457 | struct task_struct *profd; /* For iprofd */ |
| 458 | isdn_modem_t mdm; /* tty-driver-data */ |
| 459 | isdn_net_dev *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers */ |
| 460 | isdn_net_dev *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers */ |
| 461 | ulong ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes */ |
| 462 | ulong obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes */ |
| 463 | int v110emu[ISDN_MAX_CHANNELS]; /* V.110 emulator-mode 0=none */ |
| 464 | atomic_t v110use[ISDN_MAX_CHANNELS]; /* Usage-Semaphore for stream */ |
| 465 | isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */ |
Matthias Kaehlcke | 4e3dfac | 2007-10-16 01:27:50 -0700 | [diff] [blame] | 466 | struct mutex mtx; /* serialize list access*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | unsigned long global_features; |
| 468 | } isdn_dev; |
| 469 | |
| 470 | extern isdn_dev *dev; |
| 471 | |
| 472 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | #endif /* __ISDN_H__ */ |