Version 0.3.0 from FTP
[asterisk/asterisk.git] / channels / adtranvofr.h
1 /*
2  * Asterisk -- A telephony toolkit for Linux.
3  *
4  * Implementation of Voice over Frame Relay, Adtran Style
5  * 
6  * Copyright (C) 1999, Mark Spencer
7  *
8  * Mark Spencer <markster@linux-support.net>
9  *
10  * This program is free software, distributed under the terms of
11  * the GNU General Public License
12  */
13
14 #ifndef _ADTRANVOFR_H
15 #define _ADTRANVOFR_H
16
17 #define VOFR_CONTROL_ADTRAN             0x0
18 #define VOFR_CONTROL_VOICE              0x1
19 #define VOFR_CONTROL_RFC1490            0x3
20
21 #define VOFR_TYPE_SIGNAL                0x0
22 #define VOFR_TYPE_VOICE                 0x1
23 #define VOFR_TYPE_ANSWER                0x2
24 #define VOFR_TYPE_FAX                   0x3
25 #define VOFR_TYPE_DTMF                  0x4
26
27 #define VOFR_CARD_TYPE_UNSPEC           0x0
28 #define VOFR_CARD_TYPE_FXS              0x1
29 #define VOFR_CARD_TYPE_FXO              0x2
30 #define VOFR_CARD_TYPE_ENM              0x3
31 #define VOFR_CARD_TYPE_VCOM             0x4
32 #define VOFR_CARD_TYPE_ASTERISK         0xf
33
34 #define VOFR_MODULATION_SINGLE          0x0
35 #define VOFR_MODULATION_V21             0x1
36 #define VOFR_MODULATION_V27ter_2        0x2
37 #define VOFR_MODULATION_V27ter_4        0x3
38 #define VOFR_MODULATION_V29_7           0x4
39 #define VOFR_MODULATION_V29_9           0x5
40 #define VOFR_MODULATION_V33_12          0x6
41 #define VOFR_MODULATION_V33_14          0x7
42
43 #define VOFR_ROUTE_NONE                 0x0
44 #define VOFR_ROUTE_LOCAL                0x1
45 #define VOFR_ROUTE_VOICE                0x2
46 #define VOFR_ROUTE_DTE1                 0x4
47 #define VOFR_ROUTE_DTE2                 0x8
48 #define VOFR_ROUTE_DTE                  0xC
49
50 #define VOFR_MASK_EI                    0x80
51 #define VOFR_MASK_LI                    0x40
52 #define VOFR_MASK_CONTROL               0x3F
53
54 #define VOFR_SIGNAL_ON_HOOK             0x00
55 #define VOFR_SIGNAL_OFF_HOOK            0x01
56 #define VOFR_SIGNAL_RING                0x40
57 #define VOFR_SIGNAL_SWITCHED_DIAL       0x08
58 #define VOFR_SIGNAL_BUSY                0x02
59 #define VOFR_SIGNAL_TRUNK_BUSY          0x04
60 #define VOFR_SIGNAL_UNKNOWN             0x10
61 #define VOFR_SIGNAL_OFFHOOK             0x81
62
63 #define VOFR_TRACE_SIGNAL               1 << 0
64 #define VOFR_TRACE_VOICE                1 << 1
65
66 #define VOFR_MAX_PKT_SIZE               1500
67
68 /*
69  * Wire level protocol 
70  */
71
72 struct vofr_hdr {
73         u_int8_t control;               /* Also contains unused EI and LI bits */
74 #if __BYTE_ORDER == __LITTLE_ENDIAN
75         u_int8_t dtype:4;               /* Data type */
76         u_int8_t ctag:4;                /* Connect tag */
77         u_int8_t dlcih:4;               /* Hi 2 bits of DLCI x-ref */
78         u_int8_t vflags:4;              /* Voice Routing Flags */
79         u_int8_t dlcil;                 /* Lo 8 bits of DLCI x-ref */
80         u_int8_t cid;                   /* Channel ID */
81         u_int8_t mod:4;                 /* Modulation */
82         u_int8_t remid:4;               /* Remote ID */
83 #elif __BYTE_ORDER == __BIG_ENDIAN
84         u_int8_t ctag:4;                /* Connect tag */
85         u_int8_t dtype:4;               /* Data type */
86         u_int8_t vflags:4;              /* Voice Routing Flags */
87         u_int8_t dlcih:4;               /* Hi 2 bits of DLCI x-ref */
88         u_int8_t dlcil;                 /* Lo 8 bits of DLCI x-ref */
89         u_int8_t cid;                   /* Channel ID */
90         u_int8_t remid:4;               /* Remote ID or Relay CMD*/
91         u_int8_t mod:4;                 /* Modulation */
92 #else
93 #error  "Please fix <bytesex.h>"
94 #endif
95 #ifdef __GNUC__
96         u_int8_t data[0];               /* Data */
97 #endif
98 };
99
100 #define VOFR_HDR_SIZE 6
101
102 /* Number of milliseconds to fudge -- experimentally derived */
103 #define VOFR_FUDGE 2
104
105 #endif