]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
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 ([email protected]) | |
6 | * Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg | |
7 | * Copyright 1995,96 by Michael Hipp ([email protected]) | |
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 | */ | |
1da177e4 LT |
13 | #ifndef __ISDN_H__ |
14 | #define __ISDN_H__ | |
15 | ||
1da177e4 | 16 | |
1da177e4 LT |
17 | #include <linux/errno.h> |
18 | #include <linux/fs.h> | |
19 | #include <linux/major.h> | |
1da177e4 LT |
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> | |
4e3dfaca | 38 | #include <linux/mutex.h> |
607ca46e | 39 | #include <uapi/linux/isdn.h> |
1da177e4 LT |
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> | |
4b32da2b | 65 | #include <linux/ppp-ioctl.h> |
1da177e4 LT |
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; | |
1da177e4 LT |
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 | ||
1da177e4 LT |
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 */ | |
d62a38d1 | 254 | struct net_device *dev; /* interface to upper levels */ |
1da177e4 LT |
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 */ | |
1da177e4 LT |
270 | #define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */ |
271 | #define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */ | |
1da177e4 LT |
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; | |
48decc1c | 313 | struct tty_port port; |
1da177e4 LT |
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; | |
1da177e4 LT |
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 */ | |
322 | int rcvsched; /* Receive needs schedule */ | |
323 | int isdn_driver; /* Index to isdn-driver */ | |
324 | int isdn_channel; /* Index to isdn-channel */ | |
325 | int drv_index; /* Index to dev->usage */ | |
326 | int ncarrier; /* Flag: schedule NO CARRIER */ | |
327 | unsigned char last_cause[8]; /* Last cause message */ | |
328 | unsigned char last_num[ISDN_MSNLEN]; | |
329 | /* Last phone-number */ | |
330 | unsigned char last_l2; /* Last layer-2 protocol */ | |
331 | unsigned char last_si; /* Last service */ | |
332 | unsigned char last_lhup; /* Last hangup local? */ | |
333 | unsigned char last_dir; /* Last direction (in or out) */ | |
334 | struct timer_list nc_timer; /* Timer for delayed NO CARRIER */ | |
335 | int send_outstanding;/* # of outstanding send-requests */ | |
336 | int xmit_size; /* max. # of chars in xmit_buf */ | |
337 | int xmit_count; /* # of chars in xmit_buf */ | |
1da177e4 LT |
338 | struct sk_buff_head xmit_queue; /* transmit queue */ |
339 | atomic_t xmit_lock; /* Semaphore for isdn_tty_write */ | |
340 | #ifdef CONFIG_ISDN_AUDIO | |
341 | int vonline; /* Voice-channel status */ | |
342 | /* Bit 0 = recording */ | |
343 | /* Bit 1 = playback */ | |
344 | /* Bit 2 = playback, DLE-ETX seen */ | |
345 | struct sk_buff_head dtmf_queue; /* queue for dtmf results */ | |
346 | void *adpcms; /* state for adpcm decompression */ | |
347 | void *adpcmr; /* state for adpcm compression */ | |
348 | void *dtmf_state; /* state for dtmf decoder */ | |
349 | void *silence_state; /* state for silence detection */ | |
350 | #endif | |
351 | #ifdef CONFIG_ISDN_TTY_FAX | |
352 | struct T30_s *fax; /* T30 Fax Group 3 data/interface */ | |
353 | int faxonline; /* Fax-channel status */ | |
354 | #endif | |
1da177e4 | 355 | atemu emu; /* AT-emulator data */ |
1da177e4 LT |
356 | spinlock_t readlock; |
357 | } modem_info; | |
358 | ||
359 | #define ISDN_MODEM_WINSIZE 8 | |
360 | ||
361 | /* Description of one ISDN-tty */ | |
362 | typedef struct _isdn_modem { | |
363 | int refcount; /* Number of opens */ | |
364 | struct tty_driver *tty_modem; /* tty-device */ | |
365 | struct tty_struct *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */ | |
606d099c AC |
366 | struct ktermios *modem_termios[ISDN_MAX_CHANNELS]; |
367 | struct ktermios *modem_termios_locked[ISDN_MAX_CHANNELS]; | |
1da177e4 LT |
368 | modem_info info[ISDN_MAX_CHANNELS]; /* Private data */ |
369 | } isdn_modem_t; | |
370 | ||
371 | /*======================= End of ISDN-tty stuff ============================*/ | |
372 | ||
373 | /*======================== Start of V.110 stuff ============================*/ | |
374 | #define V110_BUFSIZE 1024 | |
375 | ||
376 | typedef struct { | |
377 | int nbytes; /* 1 Matrixbyte -> nbytes in stream */ | |
378 | int nbits; /* Number of used bits in streambyte */ | |
379 | unsigned char key; /* Bitmask in stream eg. 11 (nbits=2) */ | |
380 | int decodelen; /* Amount of data in decodebuf */ | |
381 | int SyncInit; /* Number of sync frames to send */ | |
382 | unsigned char *OnlineFrame; /* Precalculated V110 idle frame */ | |
383 | unsigned char *OfflineFrame; /* Precalculated V110 sync Frame */ | |
384 | int framelen; /* Length of frames */ | |
385 | int skbuser; /* Number of unacked userdata skbs */ | |
386 | int skbidle; /* Number of unacked idle/sync skbs */ | |
387 | int introducer; /* Local vars for decoder */ | |
388 | int dbit; | |
389 | unsigned char b; | |
390 | int skbres; /* space to reserve in outgoing skb */ | |
391 | int maxsize; /* maxbufsize of lowlevel driver */ | |
392 | unsigned char *encodebuf; /* temporary buffer for encoding */ | |
393 | unsigned char decodebuf[V110_BUFSIZE]; /* incomplete V110 matrices */ | |
394 | } isdn_v110_stream; | |
395 | ||
396 | /*========================= End of V.110 stuff =============================*/ | |
397 | ||
398 | /*======================= Start of general stuff ===========================*/ | |
399 | ||
400 | typedef struct { | |
401 | char *next; | |
402 | char *private; | |
403 | } infostruct; | |
404 | ||
405 | #define DRV_FLAG_RUNNING 1 | |
406 | #define DRV_FLAG_REJBUS 2 | |
407 | #define DRV_FLAG_LOADED 4 | |
408 | ||
409 | /* Description of hardware-level-driver */ | |
410 | typedef struct _isdn_driver { | |
411 | ulong online; /* Channel-Online flags */ | |
412 | ulong flags; /* Misc driver Flags */ | |
413 | int locks; /* Number of locks for this driver */ | |
414 | int channels; /* Number of channels */ | |
415 | wait_queue_head_t st_waitq; /* Wait-Queue for status-read's */ | |
416 | int maxbufsize; /* Maximum Buffersize supported */ | |
417 | unsigned long pktcount; /* Until now: unused */ | |
418 | int stavail; /* Chars avail on Status-device */ | |
419 | isdn_if *interface; /* Interface to driver */ | |
420 | int *rcverr; /* Error-counters for B-Ch.-receive */ | |
421 | int *rcvcount; /* Byte-counters for B-Ch.-receive */ | |
422 | #ifdef CONFIG_ISDN_AUDIO | |
423 | unsigned long DLEflag; /* Flags: Insert DLE at next read */ | |
424 | #endif | |
425 | struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */ | |
426 | wait_queue_head_t *rcv_waitq; /* Wait-Queues for B-Channel-Reads */ | |
427 | wait_queue_head_t *snd_waitq; /* Wait-Queue for B-Channel-Send's */ | |
428 | char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */ | |
429 | } isdn_driver_t; | |
430 | ||
431 | /* Main driver-data */ | |
432 | typedef struct isdn_devt { | |
433 | struct module *owner; | |
434 | spinlock_t lock; | |
435 | unsigned short flags; /* Bitmapped Flags: */ | |
436 | int drivers; /* Current number of drivers */ | |
437 | int channels; /* Current number of channels */ | |
438 | int net_verbose; /* Verbose-Flag */ | |
439 | int modempoll; /* Flag: tty-read active */ | |
440 | spinlock_t timerlock; | |
441 | int tflags; /* Timer-Flags: */ | |
442 | /* see ISDN_TIMER_..defines */ | |
443 | int global_flags; | |
444 | infostruct *infochain; /* List of open info-devs. */ | |
445 | wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */ | |
446 | struct timer_list timer; /* Misc.-function Timer */ | |
447 | int chanmap[ISDN_MAX_CHANNELS]; /* Map minor->device-channel */ | |
448 | int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */ | |
449 | int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */ | |
450 | char num[ISDN_MAX_CHANNELS][ISDN_MSNLEN]; | |
451 | /* Remote number of active ch.*/ | |
452 | int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */ | |
453 | isdn_driver_t *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */ | |
454 | isdn_net_dev *netdev; /* Linked list of net-if's */ | |
455 | char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */ | |
456 | struct task_struct *profd; /* For iprofd */ | |
457 | isdn_modem_t mdm; /* tty-driver-data */ | |
458 | isdn_net_dev *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers */ | |
459 | isdn_net_dev *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers */ | |
460 | ulong ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes */ | |
461 | ulong obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes */ | |
462 | int v110emu[ISDN_MAX_CHANNELS]; /* V.110 emulator-mode 0=none */ | |
463 | atomic_t v110use[ISDN_MAX_CHANNELS]; /* Usage-Semaphore for stream */ | |
464 | isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */ | |
4e3dfaca | 465 | struct mutex mtx; /* serialize list access*/ |
1da177e4 LT |
466 | unsigned long global_features; |
467 | } isdn_dev; | |
468 | ||
469 | extern isdn_dev *dev; | |
470 | ||
471 | ||
1da177e4 | 472 | #endif /* __ISDN_H__ */ |