blob: dc5eba9aeceb98369c45e2990c81bbc7970fe23a [file] [log] [blame]
Harald Welte52b1f982008-12-23 20:25:15 +00001#ifndef _GSM_04_08_H
2#define _GSM_04_08_H
3
4/* GSM TS 04.08 definitions */
5
6/* Chapter 10.5.2.5 */
7struct gsm48_chan_desc {
8 u_int8_t chan_nr;
9 union {
10 struct {
11 u_int8_t maio_high:4,
12 h:1,
13 tsc:3;
14 u_int8_t hsn:6,
15 maio_low:2;
16 } h1;
17 struct {
18 u_int8_t arfcn_high:2,
19 spare:2,
20 h:1,
21 tsc:3;
22 u_int8_t arfcn_low;
23 } h0;
24 };
25};
26
27/* Chapter 10.5.2.30 */
28struct gsm48_req_ref {
29 u_int8_t ra;
30 u_int8_t t3_high:3,
31 t1_:5;
32 u_int8_t t2:5,
33 t3_low:3;
34};
35
36/* Chapter 9.1.18 */
37struct gsm48_imm_ass {
38 u_int8_t l2_plen;
39 u_int8_t proto_discr;
40 u_int8_t msg_type;
41 u_int8_t page_mode;
42 struct gsm48_chan_desc chan_desc;
43 struct gsm48_req_ref req_ref;
44 u_int8_t timing_advance;
45 u_int8_t mob_alloc_len;
46 u_int8_t mob_alloc[0];
47};
48
49struct gsm48_loc_area_id {
50 u_int8_t digits[3]; /* BCD! */
51 u_int16_t lac;
52} __attribute__ ((packed));
53
54/* Section 9.2.15 */
55struct gsm48_loc_upd_req {
56 u_int8_t type:4,
57 key_seq:4;
58 struct gsm48_loc_area_id lai;
59 u_int8_t classmark1;
60 u_int8_t ie_mi;
61 u_int8_t mi_len;
62 u_int8_t mi[0];
63} __attribute__ ((packed));
64
65/* Section 10.1 */
66struct gsm48_hdr {
67 u_int8_t proto_discr;
68 u_int8_t msg_type;
69 u_int8_t data[0];
70} __attribute__ ((packed));
71
72/* Section 10.2 */
73#define GSM48_PDISC_CC 0x02
74#define GSM48_PDISC_MM 0x05
75#define GSM48_PDISC_RR 0x06
76#define GSM48_PDISC_MM_GPRS 0x08
77#define GSM48_PDISC_SM 0x0a
78
79/* Section 10.4 */
80#define GSM48_MT_RR_INIT_REQ 0x3c
81#define GSM48_MT_RR_ADD_ASS 0x3b
82#define GSM48_MT_RR_IMM_ASS 0x3f
83#define GSM48_MT_RR_IMM_ASS_EXT 0x39
84#define GSM48_MT_RR_IMM_ASS_REJ 0x3a
85
86#define GSM48_MT_RR_CIPH_M_CMD 0x35
87#define GSM48_MT_RR_CIPH_M_COMPL 0x32
88
89#define GSM48_MT_RR_CFG_CHG_CMD 0x30
90#define GSM48_MT_RR_CFG_CHG_ACK 0x31
91#define GSM48_MT_RR_CFG_CHG_REJ 0x33
92
93#define GSM48_MT_RR_ASS_CMD 0x2e
94#define GSM48_MT_RR_ASS_COMPL 0x29
95#define GSM48_MT_RR_ASS_FAIL 0x2f
96#define GSM48_MT_RR_HANDO_CMD 0x2b
97#define GSM48_MT_RR_HANDO_COMPL 0x2c
98#define GSM48_MT_RR_HANDO_FAIL 0x28
99#define GSM48_MT_RR_HANDO_INFO 0x2d
100
101#define GSM48_MT_RR_CELL_CHG_ORDER 0x08
102#define GSM48_MT_RR_PDCH_ASS_CMD 0x23
103
104#define GSM48_MT_RR_CHAN_REL 0x0d
105#define GSM48_MT_RR_PART_REL 0x0a
106#define GSM48_MT_RR_PART_REL_COMP 0x0f
107
108#define GSM48_MT_RR_PAG_REQ_1 0x21
109#define GSM48_MT_RR_PAG_REQ_2 0x22
110#define GSM48_MT_RR_PAG_REQ_3 0x24
111#define GSM48_MT_RR_PAG_RESP 0x27
112#define GSM48_MT_RR_NOTIF_NCH 0x20
113#define GSM48_MT_RR_NOTIF_FACCH 0x25
114#define GSM48_MT_RR_NOTIF_RESP 0x26
115
116#define GSM48_MT_RR_SYSINFO_8 0x18
117#define GSM48_MT_RR_SYSINFO_1 0x19
118#define GSM48_MT_RR_SYSINFO_2 0x1a
119#define GSM48_MT_RR_SYSINFO_3 0x1b
120#define GSM48_MT_RR_SYSINFO_4 0x1c
121#define GSM48_MT_RR_SYSINFO_5 0x1d
122#define GSM48_MT_RR_SYSINFO_6 0x1e
123#define GSM48_MT_RR_SYSINFO_7 0x1f
124
125#define GSM48_MT_RR_SYSINFO_2bis 0x02
126#define GSM48_MT_RR_SYSINFO_2ter 0x03
127#define GSM48_MT_RR_SYSINFO_5bis 0x05
128#define GSM48_MT_RR_SYSINFO_5ter 0x06
129#define GSM48_MT_RR_SYSINFO_9 0x04
130#define GSM48_MT_RR_SYSINFO_13 0x00
131
132#define GSM48_MT_RR_SYSINFO_16 0x3d
133#define GSM48_MT_RR_SYSINFO_17 0x3e
134
135#define GSM48_MT_RR_CHAN_MODE_MODIF 0x10
136#define GSM48_MT_RR_STATUS 0x12
137#define GSM48_MT_RR_CHAN_MODE_MODIF_ACK 0x17
138#define GSM48_MT_RR_FREQ_REDEF 0x14
139#define GSM48_MT_RR_MEAS_REP 0x15
140#define GSM48_MT_RR_CLSM_CHG 0x16
141#define GSM48_MT_RR_CLSM_ENQ 0x13
142#define GSM48_MT_RR_EXT_MEAS_REP 0x36
143#define GSM48_MT_RR_EXT_MEAS_REP_ORD 0x37
144#define GSM48_MT_RR_GPRS_SUSP_REQ 0x34
145
146#define GSM48_MT_RR_VGCS_UPL_GRANT 0x08
147#define GSM48_MT_RR_UPLINK_RELEASE 0x0e
148#define GSM48_MT_RR_UPLINK_FREE 0x0c
149#define GSM48_MT_RR_UPLINK_BUSY 0x2a
150#define GSM48_MT_RR_TALKER_IND 0x11
151
152#define GSM48_MT_RR_APP_INFO 0x38
153
154/* Table 10.2/3GPP TS 04.08 */
155#define GSM48_MT_MM_IMSI_DETACH_IND 0x01
156#define GSM48_MT_MM_LOC_UPD_ACCEPT 0x02
157#define GSM48_MT_MM_LOC_UPD_REJECT 0x04
158#define GSM48_MT_MM_LOC_UPD_REQUEST 0x08
159
160#define GSM48_MT_MM_AUTH_REJ 0x11
161#define GSM48_MT_MM_AUTH_REQ 0x12
162#define GSM48_MT_MM_AUTH_RESP 0x14
163#define GSM48_MT_MM_ID_REQ 0x18
164#define GSM48_MT_MM_ID_RESP 0x19
165#define GSM48_MT_MM_TMSI_REALL_CMD 0x1a
166#define GSM48_MT_MM_TMSI_REALL_COMPL 0x1b
167
168#define GSM48_MT_MM_CM_SERV_ACC 0x21
169#define GSM48_MT_MM_CM_SERV_REJ 0x22
170#define GSM48_MT_MM_CM_SERV_ABORT 0x23
171#define GSM48_MT_MM_CM_SERV_REQ 0x24
172#define GSM48_MT_MM_CM_SERV_PROMPT 0x25
173#define GSM48_MT_MM_CM_REEST_REQ 0x28
174#define GSM48_MT_MM_ABORT 0x29
175
176#define GSM48_MT_MM_NULL 0x30
177#define GSM48_MT_MM_STATUS 0x31
178#define GSM48_MT_MM_INFO 0x32
179
180/* Table 10.3/3GPP TS 04.08 */
181#define GSM48_MT_CC_ALERTING 0x01
182#define GSM48_MT_CC_CALL_CONF 0x08
183#define GSM48_MT_CC_CALL_PROC 0x02
184#define GSM48_MT_CC_CONNECT 0x07
185#define GSM48_MT_CC_CONNECT_ACK 0x0f
186#define GSM48_MT_CC_EMERG_SETUP 0x0e
187#define GSM48_MT_CC_PROGRESS 0x03
188#define GSM48_MT_CC_ESTAB 0x04
189#define GSM48_MT_CC_ESTAB_CONF 0x06
190#define GSM48_MT_CC_RECALL 0x0b
191#define GSM48_MT_CC_START_CC 0x09
192#define GSM48_MT_CC_SETUP 0x05
193
194#define GSM48_MT_CC_MODIFY 0x17
195#define GSM48_MT_CC_MODIFY_COMPL 0x1f
196#define GSM48_MT_CC_MODIFY_REJECT 0x13
197#define GSM48_MT_CC_USER_INFO 0x10
198#define GSM48_MT_CC_HOLD 0x18
199#define GSM48_MT_CC_HOLD_ACK 0x19
200#define GSM48_MT_CC_HOLD_REJ 0x1a
201#define GSM48_MT_CC_RETR 0x1c
202#define GSM48_MT_CC_RETR_ACK 0x1d
203#define GSM48_MT_CC_RETR_REJ 0x1e
204
205#define GSM48_MT_CC_DISCONNECT 0x25
206#define GSM48_MT_CC_RELEASE 0x2d
207#define GSM48_MT_CC_RELEASE_COMPL 0xea
208
209#define GSM48_MT_CC_CONG_CTRL 0x39
210#define GSM48_MT_CC_NOTIFY 0x3e
211#define GSM48_MT_CC_STATUS 0x3d
212#define GSM48_MT_CC_STATUS_ENQ 0x34
213#define GSM48_MT_CC_START_DTMF 0x35
214#define GSM48_MT_CC_STOP_DTMF 0x31
215#define GSM48_MT_CC_STOP_DTMF_ACK 0x32
216#define GSM48_MT_CC_START_DTMF_ACK 0x36
217#define GSM48_MT_CC_START_DTMF_REJ 0x37
218#define GSM48_MT_CC_FACILITY 0x3a
219
220/* FIXME: Table 10.4 / 10.4a (GPRS) */
221
222/* Section 10.5.2.26, Table 10.5.64 */
223#define GSM48_PM_MASK 0x03
224#define GSM48_PM_NORMAL 0x00
225#define GSM48_PM_EXTENDED 0x01
226#define GSM48_PM_REORG 0x02
227#define GSM48_PM_SAME 0x03
228
229/* Table 10.5.4 */
230#define GSM_MI_TYPE_MASK 0x07
231#define GSM_MI_TYPE_NONE 0x00
232#define GSM_MI_TYPE_IMSI 0x01
233#define GSM_MI_TYPE_IMEI 0x02
234#define GSM_MI_TYPE_IMEISV 0x03
235#define GSM_MI_TYPE_TMSI 0x04
236#define GSM_MI_ODD 0x08
237
Harald Welte8470bf22008-12-25 23:28:35 +0000238struct msgb;
239struct gsm_bts;
240
241int gsm0408_rcvmsg(struct msgb *msg);
242enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra);
243
244
Harald Welte52b1f982008-12-23 20:25:15 +0000245#endif