home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / src / linux-headers-2.6.17-6 / include / linux / mISDNif.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-08-11  |  20.9 KB  |  749 lines

  1. /* $Id: mISDNif.h,v 1.32 2004/07/08 00:58:20 keil Exp $
  2.  *
  3.  */
  4.  
  5. #ifndef mISDNIF_H
  6. #define mISDNIF_H
  7.  
  8. #include <stdarg.h>
  9. #include <linux/types.h>
  10. #include <linux/errno.h>
  11.  
  12. /* primitives for information exchange
  13.  * generell format
  14.  * <8 bit reserved>
  15.  * <4 bit flags>
  16.  * <4 bit layer>
  17.  * <8 bit command>
  18.  * <8 bit subcommand>
  19.  *
  20.  */
  21.  
  22. /*
  23.  * ABI Version 32 bit
  24.  *
  25.  * <16 bit> Major version
  26.  *        - changed if any interface become backwards incompatible
  27.  *
  28.  * <16 bit> Minor version
  29.  *              - changed if any interface is extended but backwards compatible
  30.  *
  31.  */
  32. #define    MISDN_MAJOR_VERSION    1
  33. #define    MISDN_MINOR_VERSION    0
  34. #define    MISDN_VERSION        ((MISDN_MAJOR_VERSION<<16) | MISDN_MINOR_VERSION)
  35.  
  36. #define MISDN_REVISION        "$Revision: 1.32 $"
  37. #define MISDN_DATE        "$Date: 2004/07/08 00:58:20 $"
  38.  
  39. /* SUBCOMMANDS */
  40. #define REQUEST        0x80
  41. #define CONFIRM        0x81
  42. #define INDICATION    0x82
  43. #define RESPONSE    0x83
  44. #define SUB_ERROR    0xff
  45.  
  46. /* management */
  47. #define MGR_FUNCTION    0x0f0000
  48. #define MGR_GETOBJECT    0x0f0100
  49. #define MGR_NEWOBJECT    0x0f0200
  50. #define MGR_DELOBJECT    0x0f0300
  51. #define MGR_NEWENTITY    0x0f0600
  52. #define MGR_DELENTITY    0x0f0700
  53. #define MGR_GETSTACK    0x0f1100
  54. #define MGR_NEWSTACK    0x0f1200
  55. #define MGR_DELSTACK    0x0f1300
  56. #define MGR_SETSTACK    0x0f1400
  57. #define MGR_CLEARSTACK    0x0f1500
  58. #define MGR_REGLAYER    0x0f1600
  59. #define MGR_UNREGLAYER    0x0f1700
  60. #define MGR_SELCHANNEL    0x0f1800
  61. #define MGR_SETSTACK_NW    0x0f1900
  62. #define MGR_ADDSTPARA    0x0f1A00
  63. #define MGR_CLRSTPARA    0x0f1B00
  64. #define MGR_GETLAYER    0x0f2100
  65. #define MGR_GETLAYERID    0x0f2200
  66. #define MGR_NEWLAYER    0x0f2300
  67. #define MGR_DELLAYER    0x0f2400
  68. #define MGR_CLONELAYER    0x0f2500
  69. #define MGR_GETIF    0x0f3100
  70. #define MGR_CONNECT    0x0f3200
  71. #define MGR_DISCONNECT    0x0f3300
  72. #define MGR_SETIF    0x0f3400
  73. #define MGR_ADDIF    0x0f3500
  74. #define MGR_QUEUEIF    0x0f3600
  75. #define MGR_CTRLREADY    0x0f4100
  76. #define MGR_RELEASE    0x0f4500
  77. #define MGR_GETDEVICE    0x0f5100
  78. #define MGR_DELDEVICE    0x0f5200
  79. #define MGR_SETDEVOPT    0x0f5300
  80. #define MGR_GETDEVOPT    0x0f5400
  81. #define MGR_INITTIMER    0x0f8100
  82. #define MGR_ADDTIMER    0x0f8200
  83. #define MGR_DELTIMER    0x0f8300
  84. #define MGR_REMOVETIMER    0x0f8400
  85. #define MGR_TIMER    0x0f8800
  86. #define MGR_CONTROL    0x0fe100
  87. #define MGR_STATUS    0x0fe200
  88. #define MGR_HASPROTOCOL 0x0fe300
  89. #define MGR_EVALSTACK    0x0fe400
  90. #define MGR_GLOBALOPT    0x0fe500
  91. #define MGR_LOADFIRM    0x0ff000
  92. #define MGR_LOGDATA    0x0ff100
  93. #define MGR_DEBUGDATA    0x0ff200
  94. #define MGR_VERSION    0x0fff00
  95.  
  96. /* layer 1 <-> hardware */
  97. #define PH_SIGNAL    0x000100
  98. #define PH_CONTROL    0x000200
  99. #define PH_STATUS    0x000300
  100.  
  101. /* PH_SIGNAL parameter */
  102. #define INFO0        0x1000
  103. #define INFO1        0x1100
  104. #define INFO2        0x1200
  105. #define INFO3_P8    0x1308
  106. #define INFO3_P10    0x130a
  107. #define INFO4_P8    0x1408
  108. #define INFO4_P10    0x140a
  109. #define LOSTFRAMING    0x1f00
  110. #define ANYSIGNAL    0x1f01
  111.  
  112. /* PH_CONTROL parameter */
  113. #define HW_RESET    0x0001 
  114. #define HW_POWERDOWN    0x0100 
  115. #define HW_POWERUP    0x0101
  116. #define HW_DEACTIVATE    0x0200
  117. #define HW_ACTIVATE    0x0201
  118. #define HW_MOD_FRM    0x0400
  119. #define HW_MOD_FRH    0x0401
  120. #define HW_MOD_FTM    0x0402
  121. #define HW_MOD_FTH    0x0403
  122. #define HW_MOD_FTS    0x0404
  123. #define HW_MOD_CONNECT    0x0410
  124. #define HW_MOD_OK    0x0411
  125. #define HW_MOD_NOCARR    0x0412
  126. #define HW_MOD_FCERROR    0x0413
  127. #define HW_MOD_READY    0x0414
  128. #define HW_MOD_LASTDATA    0x0415
  129. #define HW_MOD_SILENCE    0x0416
  130. #define HW_FEATURES    0x04ff
  131. #define HW_HFC_COEFF    0x0500
  132. #define HW_LOS        0x0501
  133. #define HW_LOS_OFF    0x0502
  134. #define HW_AIS        0x0503
  135. #define HW_AIS_OFF    0x0504
  136. #define HW_SLIP_TX    0x0505
  137. #define HW_SLIP_RX    0x0506
  138. #define HW_PCM_CONN    0x0580
  139. #define HW_PCM_DISC    0x0581
  140. #define HW_CONF_JOIN    0x0582
  141. #define HW_CONF_SPLIT    0x0583
  142. #define HW_RECEIVE_OFF    0x0584
  143. #define HW_RECEIVE_ON    0x0585
  144. #define HW_SPL_LOOP_ON    0x0586
  145. #define HW_SPL_LOOP_OFF    0x0587
  146. #define HW_TESTLOOP    0xFF00
  147. #define HW_FIRM_START    0xFF10
  148. #define HW_FIRM_DATA    0xFF11
  149. #define HW_FIRM_END    0xFF12
  150. #define HW_D_BLOCKED    0xFF20 
  151. #define HW_D_NOBLOCKED    0xFF21 
  152. #define HW_TESTRX_RAW    0xFF40
  153. #define HW_TESTRX_HDLC    0xFF41
  154. #define HW_TESTRX_OFF    0xFF4f
  155. /* TOUCH TONE IS 0x20XX  XX "0"..."9", "A","B","C","D","*","#" */
  156. #define DTMF_TONE_VAL    0x2000
  157. #define DTMF_TONE_MASK    0x007F
  158. #define DTMF_TONE_START    0x2100
  159. #define DTMF_TONE_STOP    0x2200
  160. #define CMX_CONF_JOIN    0x2300
  161. #define CMX_CONF_SPLIT    0x2301
  162. #define CMX_ECHO_ON    0x2302
  163. #define CMX_ECHO_OFF    0x2303
  164. #define CMX_RECEIVE_OFF    0x2304
  165. #define CMX_RECEIVE_ON    0x2305
  166. #define CMX_MIX_ON    0x2306
  167. #define CMX_MIX_OFF    0x2307
  168. #define TONE_PATT_ON    0x2310
  169. #define TONE_PATT_OFF    0x2311
  170. #define VOL_CHANGE_TX    0x2312
  171. #define VOL_CHANGE_RX    0x2313
  172. #define BF_ENABLE_KEY    0x2314
  173. #define BF_DISABLE    0x2315
  174. #define BF_ACCEPT    0x2316
  175. #define BF_REJECT    0x2317
  176. #define HW_POTS_ON        0x1001
  177. #define HW_POTS_OFF        0x1002
  178. #define HW_POTS_SETMICVOL    0x1100
  179. #define HW_POTS_SETSPKVOL    0x1101
  180. #define HW_POTS_GETMICVOL    0x1110
  181. #define HW_POTS_GETSPKVOL    0x1111
  182.  
  183. /* TONE_PATT_ON parameter */
  184. #define TONE_OFF            0x0000
  185. #define TONE_GERMAN_DIALTONE        0x0001
  186. #define TONE_GERMAN_OLDDIALTONE        0x0002
  187. #define TONE_AMERICAN_DIALTONE        0x0003
  188. #define TONE_GERMAN_DIALPBX        0x0004
  189. #define TONE_GERMAN_OLDDIALPBX        0x0005
  190. #define TONE_AMERICAN_DIALPBX        0x0006
  191. #define TONE_GERMAN_RINGING        0x0007
  192. #define TONE_GERMAN_OLDRINGING        0x0008
  193. #define TONE_AMERICAN_RINGPBX        0x000b
  194. #define TONE_GERMAN_RINGPBX        0x000c
  195. #define TONE_GERMAN_OLDRINGPBX        0x000d
  196. #define TONE_AMERICAN_RINGING        0x000e
  197. #define TONE_GERMAN_BUSY        0x000f
  198. #define TONE_GERMAN_OLDBUSY        0x0010
  199. #define TONE_AMERICAN_BUSY        0x0011
  200. #define TONE_GERMAN_HANGUP        0x0012
  201. #define TONE_GERMAN_OLDHANGUP        0x0013
  202. #define TONE_AMERICAN_HANGUP        0x0014
  203. #define TONE_SPECIAL_INFO        0x0015
  204. #define TONE_GERMAN_GASSENBESETZT    0x0016
  205. #define TONE_GERMAN_AUFSCHALTTON    0x0016
  206.  
  207. #define GLOBALOPT_INTERNAL_CTRL        0x0001
  208. #define GLOBALOPT_EXTERNAL_EQUIPMENT    0x0002
  209. #define GLOBALOPT_HANDSET        0x0004
  210. #define GLOBALOPT_DTMF            0x0008
  211. #define GLOBALOPT_SUPPLEMENTARY_SERVICE    0x0010
  212. #define GLOBALOPT_CHANNEL_ALLOCATION    0x0020
  213. #define GLOBALOPT_PARAMETER_B_CHANNEL    0x0040
  214. #define GLOBALOPT_LINE_INTERCONNECT    0x0080
  215.  
  216.  
  217. /* layer 1 */
  218. #define PH_ACTIVATE    0x010100
  219. #define PH_DEACTIVATE    0x010000
  220. #define PH_DATA        0x110200
  221. #define MPH_DEACTIVATE    0x011000
  222. #define MPH_ACTIVATE    0x011100
  223. #define MPH_INFORMATION    0x012000
  224.  
  225. /* layer 2 */
  226. #define DL_ESTABLISH    0x020100
  227. #define DL_RELEASE    0x020000
  228. #define DL_DATA        0x120200
  229. #define DL_UNITDATA    0x120300
  230. #define MDL_UNITDATA    0x121200
  231. #define MDL_ASSIGN    0x022100
  232. #define MDL_REMOVE    0x022000
  233. #define MDL_ERROR    0x023000
  234. #define MDL_INFORMATION    0x024000
  235. #define MDL_STATUS    0x028100
  236. #define MDL_FINDTEI    0x028200
  237.  
  238. /* layer 3 */
  239. #define CC_ALERTING        0x030100
  240. #define CC_PROCEEDING        0x030200
  241. #define CC_PROGRESS        0x030300
  242. #define CC_SETUP        0x030500
  243. #define CC_CONNECT        0x030700
  244. #define CC_SETUP_ACKNOWLEDGE    0x030d00
  245. #define CC_CONNECT_ACKNOWLEDGE    0x030f00
  246. #define CC_USER_INFORMATION    0x032000
  247. #define CC_SUSPEND_REJECT    0x032100
  248. #define CC_RESUME_REJECT    0x032200
  249. #define CC_HOLD            0x032400
  250. #define CC_SUSPEND        0x032500
  251. #define CC_RESUME        0x032600
  252. #define CC_HOLD_ACKNOWLEDGE    0x032800
  253. #define CC_SUSPEND_ACKNOWLEDGE    0x032d00
  254. #define CC_RESUME_ACKNOWLEDGE    0x032e00
  255. #define CC_HOLD_REJECT        0x033000
  256. #define CC_RETRIEVE        0x033100
  257. #define CC_RETRIEVE_ACKNOWLEDGE    0x033300
  258. #define CC_RETRIEVE_REJECT    0x033700
  259. #define CC_DISCONNECT        0x034500
  260. #define CC_RESTART        0x034600
  261. #define CC_RELEASE        0x034d00
  262. #define CC_RELEASE_COMPLETE    0x035a00
  263. #define CC_FACILITY        0x036200
  264. #define CC_NOTIFY        0x036e00
  265. #define CC_STATUS_ENQUIRY    0x037500
  266. #define CC_INFORMATION        0x037b00
  267. #define CC_STATUS        0x037d00
  268.  
  269. #define CC_NEW_CR        0x03f000
  270. #define CC_RELEASE_CR        0x03f100
  271. #define CC_TIMEOUT        0x03ff00
  272.  
  273. #define CC_B3_DATA        0x138600
  274.  
  275. #define LAYER_MASK    0x0F0000
  276. #define COMMAND_MASK    0x00FF00
  277. #define SUBCOMMAND_MASK    0x0000FF
  278. #define DATA_COMMAND    0x100000
  279. #define CMD_IS_DATA(p)    (p & DATA_COMMAND)
  280.  
  281. /* short cuts layer 1 */
  282. #define PH_ACTIVATE_REQ        (PH_ACTIVATE | REQUEST)
  283. #define PH_ACTIVATE_IND        (PH_ACTIVATE | INDICATION)
  284. #define PH_DEACTIVATE_IND    (PH_DEACTIVATE | INDICATION)
  285. #define PH_DATA_REQ        (PH_DATA | REQUEST)
  286. #define PH_DATA_IND        (PH_DATA | INDICATION)
  287. #define PH_DATA_CNF        (PH_DATA | CONFIRM)
  288. #define PH_DATA_RSP        (PH_DATA | RESPONSE)
  289. #define MPH_ACTIVATE_REQ    (MPH_ACTIVATE | REQUEST)
  290. #define MPH_DEACTIVATE_REQ    (MPH_DEACTIVATE | REQUEST)
  291. #define MPH_INFORMATION_IND    (MPH_INFORMATION | INDICATION)
  292.  
  293. /* short cuts layer 2 */
  294. #define DL_ESTABLISH_REQ    (DL_ESTABLISH | REQUEST)
  295. #define DL_ESTABLISH_IND    (DL_ESTABLISH | INDICATION)
  296. #define DL_ESTABLISH_CNF    (DL_ESTABLISH | CONFIRM)
  297. #define DL_RELEASE_REQ        (DL_RELEASE | REQUEST)
  298. #define DL_RELEASE_IND        (DL_RELEASE | INDICATION)
  299. #define DL_RELEASE_CNF        (DL_RELEASE | CONFIRM)
  300. #define DL_DATA_REQ        (DL_DATA | REQUEST)
  301. #define DL_DATA_IND        (DL_DATA | INDICATION)
  302. #define DL_UNITDATA_REQ        (DL_UNITDATA | REQUEST)
  303. #define DL_UNITDATA_IND        (DL_UNITDATA | INDICATION)
  304. #define MDL_ASSIGN_REQ        (MDL_ASSIGN | REQUEST)
  305. #define MDL_ASSIGN_IND        (MDL_ASSIGN | INDICATION)
  306. #define MDL_REMOVE_REQ        (MDL_REMOVE | REQUEST)
  307. #define MDL_ERROR_IND        (MDL_ERROR | INDICATION)
  308. #define MDL_ERROR_RSP        (MDL_ERROR | RESPONSE)
  309. #define MDL_INFORMATION_IND    (MDL_INFORMATION | INDICATION)
  310.  
  311. /* protocol id */
  312. #define ISDN_PID_NONE            0
  313. #define ISDN_PID_ANY            0xffffffff
  314. #define ISDN_PID_L0_TE_S0        0x00000001
  315. #define ISDN_PID_L0_NT_S0        0x00000100
  316. #define ISDN_PID_L0_TE_U        0x00000002
  317. #define ISDN_PID_L0_NT_U        0x00000200
  318. #define ISDN_PID_L0_TE_UP2        0x00000004
  319. #define ISDN_PID_L0_NT_UP2        0x00000400
  320. #define ISDN_PID_L0_TE_E1        0x00000008
  321. #define ISDN_PID_L0_NT_E1        0x00000800
  322. #define ISDN_PID_L1_TE_S0        0x01000001
  323. #define ISDN_PID_L1_NT_S0        0x01000100
  324. #define ISDN_PID_L1_TE_U        0x01000002
  325. #define ISDN_PID_L1_NT_U        0x01000200
  326. #define ISDN_PID_L1_TE_UP2        0x01000004
  327. #define ISDN_PID_L1_NT_UP2        0x01000400
  328. #define ISDN_PID_L1_TE_E1        0x01000008
  329. #define ISDN_PID_L1_NT_E1        0x01000800
  330. /* Bit 15-0  reserved for CAPI defined protocols */
  331. #define ISDN_PID_L1_B_64HDLC        0x41000001
  332. #define ISDN_PID_L1_B_64TRANS        0x41000002
  333. #define ISDN_PID_L1_B_V110_ASYNC    0x41000004
  334. #define ISDN_PID_L1_B_V110_HDLC        0x41000008
  335. #define ISDN_PID_L1_B_T30FAX        0x41000010
  336. #define ISDN_PID_L1_B_64HDLC_INV    0x41000020
  337. #define ISDN_PID_L1_B_56TRANS        0x41000040
  338. #define ISDN_PID_L1_B_MODEM_ALL        0x41000080
  339. #define ISDN_PID_L1_B_MODEM_ASYNC    0x41000100
  340. #define ISDN_PID_L1_B_MODEM_HDLC    0x41000200
  341. #define ISDN_PID_L2_LAPD        0x02000001
  342. #define ISDN_PID_L2_LAPD_NET        0x02000002
  343. /* Bit 15-0  reserved for CAPI defined protocols */
  344. #define ISDN_PID_L2_B_X75SLP        0x42000001
  345. #define ISDN_PID_L2_B_TRANS        0x42000002
  346. #define ISDN_PID_L2_B_TRANSDTMF        0x42300002
  347. #define ISDN_PID_L2_B_RAWDEV        0x42400002
  348. #define ISDN_PID_L2_B_SDLC        0x42000004
  349. #define ISDN_PID_L2_B_LAPD        0x42000008
  350. #define ISDN_PID_L2_B_T30        0x42000010
  351. #define ISDN_PID_L2_B_PPP        0x42000020
  352. #define ISDN_PID_L2_B_TRANSNOERR    0x42000040
  353. #define ISDN_PID_L2_B_MODEM        0x42000080
  354. #define ISDN_PID_L2_B_X75SLPV42BIS    0x42000100
  355. #define ISDN_PID_L2_B_V120ASYNC        0x42000200
  356. #define ISDN_PID_L2_B_V120ASYNCV42BIS    0x42000400
  357. #define ISDN_PID_L2_B_V120TRANS        0x42000800
  358. #define ISDN_PID_L2_B_LAPDFREESAPI    0x42001000
  359. #define ISDN_PID_L3_B_TRANS        0x43000001
  360. #define ISDN_PID_L3_B_T90NL        0x43000002
  361. #define ISDN_PID_L3_B_X25DTE        0x43000004
  362. #define ISDN_PID_L3_B_X25DCE        0x43000008
  363. #define ISDN_PID_L3_B_T30        0x43000010
  364. #define ISDN_PID_L3_B_T30EXT        0x43000020
  365. #define ISDN_PID_L3_B_MODEM        0x43000080
  366. /* Bit 15-0  reserved for CAPI defined protocols */
  367. #define ISDN_PID_L3_B_DSP        0x43010000
  368. #define ISDN_PID_L3_DSS1USER        0x03000001
  369. #define ISDN_PID_L3_DSS1NET        0x03000100
  370. #define ISDN_PID_L4_CAPI20        0x04000001
  371. #define ISDN_PID_L4_B_CAPI20        0x44000001
  372.  
  373. #define ISDN_PID_BCHANNEL_BIT        0x40000000
  374. #define ISDN_PID_LAYER_MASK        0x0f000000
  375. #define ISDN_PID_LAYER(n)        (n<<24)
  376. #define ISDN_PID_FEATURE_MASK        0x00F00000
  377. #define ISDN_PID_IDX_MAX        23
  378.  
  379. #define ISDN_PID_L2_DF_PTP        0x00100000
  380. #define ISDN_PID_L2_DF_MULT_TEI        0x00200000
  381. #define    ISDN_PID_L3_DF_PTP        0x00100000
  382. #define ISDN_PID_L3_DF_EXTCID        0x00200000
  383. #define ISDN_PID_L3_DF_CRLEN2        0x00400000
  384.  
  385. #define mISDN_CORE_DEVICE    0
  386. #define mISDN_RAW_DEVICE    128
  387.  
  388. #define FLG_mISDNPORT_BUSY    1
  389. #define FLG_mISDNPORT_ENABLED    2
  390. #define FLG_mISDNPORT_BLOCK    3
  391. #define FLG_mISDNPORT_OPEN    4
  392. #define FLG_mISDNPORT_ONEFRAME    5
  393.  
  394.  
  395. /*
  396.  * A "ENTITY" is a instance which assign id's with a none local
  397.  * scope. A id has a local part (a range of ids which the instance
  398.  * maintains) and the global ENTITY ID.
  399.  * A instance which wan't to assign IDs have to request a unique
  400.  * ENTITY ID with MGR_NEWENTITY | REQUEST.
  401.  * If the instance is deleted or don't need this feature anymore
  402.  * it has to delete the ENTITY with MGR_DELENTITY | REQUEST.
  403.  * ENTITY ID 0xFFFF is a special one.
  404.  * One example for using this is the L3/L4 process ID.
  405.  */
  406.  
  407. #define MISDN_MAX_ENTITY    2048
  408. #define MISDN_ENTITY_NONE    0x0000ffff
  409. #define MISDN_ID_ENTITYMASK    0xffff0000
  410. #define MISDN_ID_LOCALMASK    0x0000FFFF
  411. #define MISDN_ID_ANY        0xffffffff
  412. #define MISDN_ID_NONE        0xfffffffe
  413. #define MISDN_ID_DUMMY        0xffff0001
  414. #define MISDN_ID_GLOBAL        0xffff0002
  415.  
  416. #define MAX_LAYER_NR    7
  417. #define ISDN_LAYER(n)    (1<<n)
  418. #define LAYER_OUTRANGE(layer)    ((layer<0) || (layer>MAX_LAYER_NR))
  419. #define mISDN_MAX_IDLEN    16
  420.  
  421. #define IF_NOACTIV    0x00000000
  422. #define IF_DOWN        0x01000000
  423. #define IF_UP        0x02000000
  424. #define IF_CHAIN    0x04000000
  425. #define IF_HANDSHAKE    0x08000000
  426. #define IF_TYPEMASK    0x07000000
  427. #define IF_ADDRMASK    0xF0FFFFFF
  428. #define IF_IADDRMASK    0xF0FFFFFF
  429. #define IF_CONTRMASK    0x000000FF
  430. #define IF_CHILDMASK    0x1000FF00
  431. #define IF_CLONEMASK    0x2000FF00
  432. #define IF_INSTMASK    0x400F0000
  433. #define IF_LAYERMASK    0x00F00000
  434. #define IF_TYPE(i)    ((i)->stat & IF_TYPEMASK)
  435. #define CHILD_ID_INC    0x00000100
  436. #define CHILD_ID_MAX    0x1000FF00
  437. #define CLONE_ID_INC    0x00000100
  438. #define CLONE_ID_MAX    0x2000FF00
  439. #define INST_ID_INC    0x00010000
  440. #define INST_ID_MAX    0x400F0000
  441. #define FLG_CHILD_STACK    0x10000000
  442. #define FLG_CLONE_STACK    0x20000000
  443. #define FLG_INSTANCE    0x40000000
  444.  
  445. #define DUMMY_CR_FLAG    0x7FFFFF00
  446. #define CONTROLER_MASK    0x000000FF
  447.  
  448. /* stack channel values */
  449. #define CHANNEL_NUMBER    0x000000FF
  450. #define CHANNEL_RXSLOT    0x0000FF00
  451. #define CHANNEL_TXSLOT    0x00FF0000
  452. #define CHANNEL_EXTINFO    0xFF000000
  453. #define CHANNEL_NR_D    0x00000000
  454. #define CHANNEL_NR_B1    0x00000001
  455. #define CHANNEL_NR_B2    0x00000002
  456. #define CHANNEL_EXT_PCM    0x01000000
  457. #define CHANNEL_EXT_REV    0x02000000
  458.  
  459. /* interface extentions */
  460. #define EXT_STACK_CLONE 0x00000001
  461. #define EXT_INST_CLONE    0x00000100
  462. #define EXT_INST_MGR    0x00000200
  463. #define EXT_INST_MIDDLE    0x00000400
  464. #define EXT_IF_CHAIN    0x00010000
  465. #define EXT_IF_EXCLUSIV    0x00020000
  466. #define EXT_IF_CREATE    0x00040000
  467. #define EXT_IF_SPLIT    0x00080000
  468.  
  469.  
  470. /* special packet type */
  471. #define PACKET_NOACK    250
  472.  
  473. /* limits for buffers */
  474.  
  475. #define MAX_PHONE_DIGIT        31
  476. #define MAX_DFRAME_LEN        260
  477. #define MAX_DATA_SIZE        2048
  478. #define MAX_DATA_MEM        2080
  479. #define MAX_HEADER_LEN        4
  480. #define    DEFAULT_PORT_QUEUELEN    256
  481. #define PORT_SKB_RESERVE    L3_EXTRA_SIZE
  482. #define PORT_SKB_MINIMUM    128
  483.  
  484. /* structure for information exchange between layer/entity boundaries */
  485.  
  486. #define STATUS_INFO_L1    1
  487. #define STATUS_INFO_L2    2
  488.  
  489. typedef struct _mISDN_head {
  490.     u_int    addr __attribute__((packed));
  491.     u_int    prim __attribute__((packed));
  492.     int    dinfo __attribute__((packed));
  493.     int    len __attribute__((packed));
  494. } mISDN_head_t;
  495.  
  496. #define mISDN_HEADER_LEN    sizeof(mISDN_head_t)
  497.  
  498. typedef struct _status_info {
  499.     int    len;
  500.     int    typ;
  501.     u_char    info[120];
  502. } status_info_t;
  503.  
  504. typedef struct _logdata {
  505.     char    *head;
  506.     char    *fmt;
  507.     va_list args;    
  508. } logdata_t;
  509.  
  510. typedef struct _moditem {
  511.     char    *name;
  512.     int    protocol;
  513. } moditem_t;
  514.  
  515. typedef struct _mISDN_pid {
  516.     int    protocol[MAX_LAYER_NR +1];
  517.     u_char    *param[MAX_LAYER_NR +1];
  518.     __u16    global;
  519.     int    layermask;
  520.     int    maxplen;
  521.     u_char    *pbuf;
  522. } mISDN_pid_t;
  523.  
  524. typedef struct _mISDN_stPara {
  525.     int    maxdatalen;
  526.     int    up_headerlen;
  527.     int    down_headerlen;
  528. } mISDN_stPara_t;
  529.  
  530. typedef struct _stack_info {
  531.     u_int        id;
  532.     mISDN_pid_t    pid;
  533.     mISDN_stPara_t    para;
  534.     u_int        extentions;
  535.     u_int        mgr;
  536.     int        instcnt;
  537.     int        inst[MAX_LAYER_NR +1];
  538.     int        childcnt;
  539.     u_int        child[2]; /* this is correct handled for PRI see get_stack_info() */
  540. } stack_info_t;
  541.  
  542. typedef struct _layer_info {
  543.     char        name[mISDN_MAX_IDLEN];
  544.     int        object_id;
  545.     int        extentions;
  546.     u_int        id;
  547.     u_int        st;
  548.     mISDN_pid_t    pid;
  549. } layer_info_t;
  550.  
  551.  
  552. typedef struct _interface_info {
  553.     int        extentions;
  554.     u_int        owner;
  555.     u_int        peer;
  556.     int        stat;
  557. } interface_info_t;
  558.  
  559. typedef struct _channel_info {
  560.     u_int        channel;
  561.     union {
  562.         u_int    id;
  563.         void    *p;
  564.     } st;
  565. } channel_info_t;
  566.  
  567. /* l3 pointer arrays */
  568.  
  569. typedef struct _Q931_info {
  570.     u_char    type __attribute__((packed));
  571.     u_char    crlen __attribute__((packed));
  572.     u16    cr __attribute__((packed));
  573.     u16    bearer_capability __attribute__((packed));
  574.     u16    cause __attribute__((packed));
  575.     u16    call_id __attribute__((packed));
  576.     u16    call_state __attribute__((packed));
  577.     u16    channel_id __attribute__((packed));
  578.     u16    facility __attribute__((packed));
  579.     u16    progress __attribute__((packed));
  580.     u16    net_fac __attribute__((packed));
  581.     u16    notify __attribute__((packed));
  582.     u16    display __attribute__((packed));
  583.     u16    date __attribute__((packed));
  584.     u16    keypad __attribute__((packed));
  585.     u16    signal __attribute__((packed));
  586.     u16    info_rate __attribute__((packed));
  587.     u16    end2end_transit __attribute__((packed));
  588.     u16    transit_delay_sel __attribute__((packed));
  589.     u16    pktl_bin_para __attribute__((packed));
  590.     u16    pktl_window __attribute__((packed));
  591.     u16    pkt_size __attribute__((packed));
  592.     u16    closed_userg __attribute__((packed));
  593.     u16    connected_nr __attribute__((packed));
  594.     u16    connected_sub __attribute__((packed));
  595.     u16    calling_nr __attribute__((packed));
  596.     u16    calling_sub __attribute__((packed));
  597.     u16    called_nr __attribute__((packed));
  598.     u16    called_sub __attribute__((packed));
  599.     u16    redirect_nr __attribute__((packed));
  600.     u16    transit_net_sel __attribute__((packed));
  601.     u16    restart_ind __attribute__((packed));
  602.     u16    llc __attribute__((packed));
  603.     u16    hlc __attribute__((packed));
  604.     u16    useruser __attribute__((packed));
  605.     u16    more_data __attribute__((packed));
  606.     u16    sending_complete __attribute__((packed));
  607.     u16    congestion_level __attribute__((packed));
  608.     u16    fill1 __attribute__((packed));
  609. } Q931_info_t;
  610.  
  611. #define L3_EXTRA_SIZE    sizeof(Q931_info_t)
  612.  
  613. #ifdef __KERNEL__
  614. #include <linux/isdn_compat.h>
  615. #include <linux/list.h>
  616. #include <linux/skbuff.h>
  617.  
  618. typedef struct _mISDNobject    mISDNobject_t;
  619. typedef struct _mISDNinstance    mISDNinstance_t;
  620. typedef struct _mISDNlayer    mISDNlayer_t;
  621. typedef struct _mISDNstack    mISDNstack_t;
  622. typedef struct _mISDNport    mISDNport_t;
  623. typedef struct _mISDNdevice    mISDNdevice_t;
  624. typedef struct _mISDNif        mISDNif_t;
  625. typedef int    (ctrl_func_t)(void *, u_int, void *);
  626. typedef int    (if_func_t)(struct _mISDNif *, struct sk_buff *);
  627. typedef int    (lock_func_t)(void *, int);
  628. typedef void    (unlock_func_t)(void *);
  629.  
  630. #define mISDN_HEAD_P(s)        ((mISDN_head_t *)&s->cb[0])
  631. #define mISDN_HEAD_PRIM(s)    ((mISDN_head_t *)&s->cb[0])->prim
  632. #define mISDN_HEAD_DINFO(s)    ((mISDN_head_t *)&s->cb[0])->dinfo
  633.  
  634. typedef struct _mISDN_headext {
  635.     u_int    addr __attribute__((packed));
  636.     u_int    prim __attribute__((packed));
  637.     int    dinfo  __attribute__((packed));
  638.     void    *data[3];
  639.     union {
  640.         ctrl_func_t    *ctrl;
  641.         if_func_t    *iff;
  642.         void        *func;
  643.     } func;
  644. } mISDN_headext_t;
  645.  
  646. #define mISDN_HEADEXT_P(s) ((mISDN_headext_t *)&s->cb[0])
  647.  
  648. /* Basic struct of a mISDN component */
  649. struct _mISDNobject {
  650.     struct list_head    list;
  651.     char            *name;
  652.     int            id;
  653.     int            refcnt;
  654.     mISDN_pid_t        DPROTO;
  655.     mISDN_pid_t        BPROTO;
  656.     ctrl_func_t        *own_ctrl;
  657.     ctrl_func_t        *ctrl;
  658.     struct list_head    ilist;
  659.     struct module        *owner;
  660. };
  661.  
  662. /* the interface between two mISDNinstances */
  663. struct _mISDNif {
  664.     if_func_t        *func;
  665.     void            *fdata;
  666.     mISDNif_t        *clone;
  667.     mISDNif_t        *predecessor;
  668.     int            extentions;
  669.     int            stat;
  670.     mISDNstack_t        *st;
  671.     mISDNinstance_t        *owner;
  672.     mISDNinstance_t        *peer;
  673. };
  674.  
  675. /* a instance of a mISDNobject */
  676. struct _mISDNinstance {
  677.     struct list_head    list;
  678.     char            name[mISDN_MAX_IDLEN];
  679.     int            extentions;
  680.     u_int            id;
  681.     mISDN_pid_t        pid;
  682.     mISDNstack_t        *st;
  683.     mISDNobject_t        *obj;
  684.     void            *data;
  685.     mISDNif_t        up;
  686.     mISDNif_t        down;
  687.     lock_func_t        *lock;
  688.     unlock_func_t        *unlock;
  689. };
  690.  
  691. /* a list of parallel (horizontal) mISDNinstances in the same layer
  692.  * normally here is only one instance per layer only if the information
  693.  * will be splitted here are more instances */
  694. struct _mISDNlayer {
  695.     struct list_head    list;
  696.     mISDNinstance_t        *inst;
  697. };
  698.  
  699. /* the STACK; a (vertical) chain of layers */
  700.  
  701. struct _mISDNstack {
  702.     struct list_head    list;
  703.     u_int            id;
  704.     u_int            extentions;
  705.     mISDN_pid_t        pid;
  706.     mISDN_stPara_t        para;
  707.     struct list_head    layerlist;
  708.     mISDNinstance_t        *mgr;
  709.     struct list_head    childlist;
  710. };
  711.  
  712. /* lowlevel read/write struct for the mISDNdevice */
  713. struct _mISDNport {
  714.     wait_queue_head_t    procq;
  715.     spinlock_t        lock;
  716.     mISDNif_t        pif;
  717.     u_long            Flag;
  718.     struct sk_buff_head    queue;
  719.     u_int            maxqlen;
  720. };
  721.  
  722. /* the user interface to handle /dev/mISDN */
  723. struct _mISDNdevice {
  724.     struct list_head    list;
  725.     int            minor;
  726.     struct semaphore    io_sema;
  727.     int            open_mode;
  728.     mISDNport_t        rport;
  729.     mISDNport_t        wport;
  730.     struct list_head    layerlist;
  731.     struct list_head    stacklist;
  732.     struct list_head    timerlist;
  733.     struct list_head    entitylist;
  734. };
  735.  
  736. /* common helper functions */
  737. extern int    mISDN_bprotocol2pid(void *, mISDN_pid_t *);
  738. extern int    mISDN_SetIF(mISDNinstance_t *, mISDNif_t *, u_int, void *, void *, void *);
  739. extern int    mISDN_ConnectIF(mISDNinstance_t *, mISDNinstance_t *);
  740. extern int    mISDN_DisConnectIF(mISDNinstance_t *, mISDNif_t *);
  741.  
  742. /* global register/unregister functions */
  743.  
  744. extern int    mISDN_register(mISDNobject_t *obj);
  745. extern int    mISDN_unregister(mISDNobject_t *obj);
  746.  
  747. #endif /* __KERNEL__ */
  748. #endif /* mISDNIF_H */
  749.