blob: fe18f4ee5702a0af4eea3fab38cb144419c6a66f [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 */
Holger Freyther1adb4ff2009-02-04 00:04:52 +00005struct gsm_lchan;
Harald Welte52b1f982008-12-23 20:25:15 +00006
Harald Weltef7c43522009-06-09 20:24:21 +00007struct gsm48_classmark1 {
8 u_int8_t spare:1,
9 rev_level:2,
10 es_ind:1,
11 a5_1:1,
12 pwr_lev:3;
13} __attribute__ ((packed));
14
Harald Welte52b1f982008-12-23 20:25:15 +000015/* Chapter 10.5.2.5 */
16struct gsm48_chan_desc {
17 u_int8_t chan_nr;
18 union {
19 struct {
20 u_int8_t maio_high:4,
21 h:1,
22 tsc:3;
23 u_int8_t hsn:6,
24 maio_low:2;
25 } h1;
26 struct {
27 u_int8_t arfcn_high:2,
28 spare:2,
29 h:1,
30 tsc:3;
31 u_int8_t arfcn_low;
32 } h0;
33 };
Harald Welteb84e2f42008-12-28 23:42:04 +000034} __attribute__ ((packed));
Harald Welte52b1f982008-12-23 20:25:15 +000035
36/* Chapter 10.5.2.30 */
37struct gsm48_req_ref {
38 u_int8_t ra;
39 u_int8_t t3_high:3,
40 t1_:5;
41 u_int8_t t2:5,
42 t3_low:3;
Harald Welteb84e2f42008-12-28 23:42:04 +000043} __attribute__ ((packed));
Harald Welte52b1f982008-12-23 20:25:15 +000044
Harald Welte7584aea2009-02-11 11:44:12 +000045/* Chapter 9.1.5 */
46struct gsm48_chan_mode_modify {
47 struct gsm48_chan_desc chan_desc;
48 u_int8_t mode;
49} __attribute__ ((packed));
50
Harald Welte8e4ae952009-02-18 03:28:01 +000051#define GSM48_CMODE_SIGN 0x00
52#define GSM48_CMODE_SPEECH_V1 0x01
53#define GSM48_CMODE_SPEECH_EFR 0x21
54#define GSM48_CMODE_SPEECH_AMR 0x41
55#define GSM48_CMODE_DATA_14k5 0x0f
56#define GSM48_CMODE_DATA_12k0 0x03
57#define GSM48_CMODE_DATA_6k0 0x0b
58#define GSM48_CMODE_DATA_3k6 0x23
59
Harald Welte52b1f982008-12-23 20:25:15 +000060/* Chapter 9.1.18 */
61struct gsm48_imm_ass {
62 u_int8_t l2_plen;
63 u_int8_t proto_discr;
64 u_int8_t msg_type;
65 u_int8_t page_mode;
66 struct gsm48_chan_desc chan_desc;
67 struct gsm48_req_ref req_ref;
68 u_int8_t timing_advance;
69 u_int8_t mob_alloc_len;
70 u_int8_t mob_alloc[0];
Harald Welteb84e2f42008-12-28 23:42:04 +000071} __attribute__ ((packed));
Harald Welte52b1f982008-12-23 20:25:15 +000072
Harald Welte4b634542008-12-27 01:55:51 +000073/* Chapter 10.5.1.3 */
Harald Welte52b1f982008-12-23 20:25:15 +000074struct gsm48_loc_area_id {
75 u_int8_t digits[3]; /* BCD! */
76 u_int16_t lac;
77} __attribute__ ((packed));
78
79/* Section 9.2.15 */
80struct gsm48_loc_upd_req {
81 u_int8_t type:4,
82 key_seq:4;
83 struct gsm48_loc_area_id lai;
Harald Weltef7c43522009-06-09 20:24:21 +000084 struct gsm48_classmark1 classmark1;
Harald Welte52b1f982008-12-23 20:25:15 +000085 u_int8_t mi_len;
86 u_int8_t mi[0];
87} __attribute__ ((packed));
88
89/* Section 10.1 */
90struct gsm48_hdr {
91 u_int8_t proto_discr;
92 u_int8_t msg_type;
93 u_int8_t data[0];
94} __attribute__ ((packed));
95
Holger Freyther5e85c8e2008-12-28 16:32:39 +000096/* Section 9.1.3x System information Type header */
97struct gsm48_system_information_type_header {
98 u_int8_t l2_plen;
99 u_int8_t rr_protocol_discriminator :4,
100 skip_indicator:4;
101 u_int8_t system_information;
102} __attribute__ ((packed));
103
Harald Weltede9226d2008-12-29 02:37:23 +0000104struct gsm48_rach_control {
105 u_int8_t re :1,
106 cell_bar :1,
107 tx_integer :4,
108 max_trans :2;
109 u_int8_t t2;
110 u_int8_t t3;
111} __attribute__ ((packed));
112
Holger Freyther1adb4ff2009-02-04 00:04:52 +0000113/* Section 10.5.2.11 Control Channel Description , Figure 10.5.33 */
114struct gsm48_control_channel_descr {
115 u_int8_t ccch_conf :3,
116 bs_ag_blks_res :3,
117 att :1,
118 spare1 :1;
119 u_int8_t bs_pa_mfrms : 3,
120 spare2 :5;
121 u_int8_t t3212;
122} __attribute__ ((packed));
123
Harald Welteba4cf162009-01-10 01:49:35 +0000124/* Section 9.2.9 CM service request */
125struct gsm48_service_request {
126 u_int8_t cm_service_type : 4,
127 cipher_key_seq : 4;
128 /* length + 3 bytes */
129 u_int32_t classmark;
130 u_int8_t mi_len;
131 u_int8_t mi[0];
132 /* optional priority level */
133} __attribute__ ((packed));
134
Holger Freyther5e85c8e2008-12-28 16:32:39 +0000135/* Section 9.1.31 System information Type 1 */
136struct gsm48_system_information_type_1 {
137 struct gsm48_system_information_type_header header;
138 u_int8_t cell_channel_description[16];
Harald Weltede9226d2008-12-29 02:37:23 +0000139 struct gsm48_rach_control rach_control;
Holger Freyther5e85c8e2008-12-28 16:32:39 +0000140 u_int8_t s1_reset;
141} __attribute__ ((packed));
142
143/* Section 9.1.32 System information Type 2 */
144struct gsm48_system_information_type_2 {
145 struct gsm48_system_information_type_header header;
146 u_int8_t bcch_frequency_list[16];
147 u_int8_t ncc_permitted;
Harald Weltede9226d2008-12-29 02:37:23 +0000148 struct gsm48_rach_control rach_control;
Holger Freyther5e85c8e2008-12-28 16:32:39 +0000149} __attribute__ ((packed));
150
151/* Section 9.1.35 System information Type 3 */
152struct gsm48_system_information_type_3 {
153 struct gsm48_system_information_type_header header;
154 u_int16_t cell_identity;
155 struct gsm48_loc_area_id lai;
Holger Freyther1adb4ff2009-02-04 00:04:52 +0000156 struct gsm48_control_channel_descr control_channel_desc;
Holger Freyther5e85c8e2008-12-28 16:32:39 +0000157 u_int8_t cell_options;
158 u_int8_t cell_selection[2];
Harald Weltede9226d2008-12-29 02:37:23 +0000159 struct gsm48_rach_control rach_control;
Holger Freyther5e85c8e2008-12-28 16:32:39 +0000160 u_int8_t s3_reset_octets[4];
161} __attribute__ ((packed));
162
163/* Section 9.1.36 System information Type 4 */
164struct gsm48_system_information_type_4 {
165 struct gsm48_system_information_type_header header;
166 struct gsm48_loc_area_id lai;
167 u_int8_t cell_selection[2];
Harald Weltede9226d2008-12-29 02:37:23 +0000168 struct gsm48_rach_control rach_control;
Holger Freyther5e85c8e2008-12-28 16:32:39 +0000169 /* optional CBCH conditional CBCH... followed by
170 mandantory SI 4 Reset Octets
171 */
172 u_int8_t data[0];
173} __attribute__ ((packed));
174
175/* Section 9.1.37 System information Type 5 */
176struct gsm48_system_information_type_5 {
177 u_int8_t rr_protocol_discriminator :4,
178 skip_indicator:4;
179 u_int8_t system_information;
180 u_int8_t bcch_frequency_list[16];
181} __attribute__ ((packed));
182
183/* Section 9.1.40 System information Type 6 */
184struct gsm48_system_information_type_6 {
185 u_int8_t rr_protocol_discriminator :4,
186 skip_indicator:4;
187 u_int8_t system_information;
188 u_int8_t cell_identity[2];
189 struct gsm48_loc_area_id lai;
190 u_int8_t cell_options;
191 u_int8_t ncc_permitted;
192 u_int8_t si_6_reset[0];
193} __attribute__ ((packed));
194
Harald Welte2f74aa42009-02-22 21:14:04 +0000195/* Section 9.2.12 IMSI Detach Indication */
196struct gsm48_imsi_detach_ind {
Harald Weltef7c43522009-06-09 20:24:21 +0000197 struct gsm48_classmark1 classmark1;
Harald Welte2f74aa42009-02-22 21:14:04 +0000198 u_int8_t mi_len;
199 u_int8_t mi[0];
200} __attribute__ ((packed));
201
Harald Weltebcae43f2008-12-27 21:45:37 +0000202/* Section 10.2 + GSM 04.07 12.2.3.1.1 */
203#define GSM48_PDISC_GROUP_CC 0x00
204#define GSM48_PDISC_BCAST_CC 0x01
205#define GSM48_PDISC_PDSS1 0x02
Harald Welte4b634542008-12-27 01:55:51 +0000206#define GSM48_PDISC_CC 0x03
Harald Weltebcae43f2008-12-27 21:45:37 +0000207#define GSM48_PDISC_PDSS2 0x04
Harald Welte52b1f982008-12-23 20:25:15 +0000208#define GSM48_PDISC_MM 0x05
209#define GSM48_PDISC_RR 0x06
210#define GSM48_PDISC_MM_GPRS 0x08
Harald Weltebcae43f2008-12-27 21:45:37 +0000211#define GSM48_PDISC_SMS 0x09
212#define GSM48_PDISC_SM_GPRS 0x0a
213#define GSM48_PDISC_NC_SS 0x0b
214#define GSM48_PDISC_LOC 0x0c
Harald Weltede9226d2008-12-29 02:37:23 +0000215#define GSM48_PDISC_MASK 0x0f
Harald Weltea27d8d22009-03-10 12:13:42 +0000216#define GSM48_PDISC_USSD 0x11
Harald Welte52b1f982008-12-23 20:25:15 +0000217
218/* Section 10.4 */
219#define GSM48_MT_RR_INIT_REQ 0x3c
220#define GSM48_MT_RR_ADD_ASS 0x3b
221#define GSM48_MT_RR_IMM_ASS 0x3f
222#define GSM48_MT_RR_IMM_ASS_EXT 0x39
223#define GSM48_MT_RR_IMM_ASS_REJ 0x3a
224
225#define GSM48_MT_RR_CIPH_M_CMD 0x35
226#define GSM48_MT_RR_CIPH_M_COMPL 0x32
227
228#define GSM48_MT_RR_CFG_CHG_CMD 0x30
229#define GSM48_MT_RR_CFG_CHG_ACK 0x31
230#define GSM48_MT_RR_CFG_CHG_REJ 0x33
231
232#define GSM48_MT_RR_ASS_CMD 0x2e
233#define GSM48_MT_RR_ASS_COMPL 0x29
234#define GSM48_MT_RR_ASS_FAIL 0x2f
235#define GSM48_MT_RR_HANDO_CMD 0x2b
236#define GSM48_MT_RR_HANDO_COMPL 0x2c
237#define GSM48_MT_RR_HANDO_FAIL 0x28
238#define GSM48_MT_RR_HANDO_INFO 0x2d
239
240#define GSM48_MT_RR_CELL_CHG_ORDER 0x08
241#define GSM48_MT_RR_PDCH_ASS_CMD 0x23
242
243#define GSM48_MT_RR_CHAN_REL 0x0d
244#define GSM48_MT_RR_PART_REL 0x0a
245#define GSM48_MT_RR_PART_REL_COMP 0x0f
246
247#define GSM48_MT_RR_PAG_REQ_1 0x21
248#define GSM48_MT_RR_PAG_REQ_2 0x22
249#define GSM48_MT_RR_PAG_REQ_3 0x24
250#define GSM48_MT_RR_PAG_RESP 0x27
251#define GSM48_MT_RR_NOTIF_NCH 0x20
252#define GSM48_MT_RR_NOTIF_FACCH 0x25
253#define GSM48_MT_RR_NOTIF_RESP 0x26
254
255#define GSM48_MT_RR_SYSINFO_8 0x18
256#define GSM48_MT_RR_SYSINFO_1 0x19
257#define GSM48_MT_RR_SYSINFO_2 0x1a
258#define GSM48_MT_RR_SYSINFO_3 0x1b
259#define GSM48_MT_RR_SYSINFO_4 0x1c
260#define GSM48_MT_RR_SYSINFO_5 0x1d
261#define GSM48_MT_RR_SYSINFO_6 0x1e
262#define GSM48_MT_RR_SYSINFO_7 0x1f
263
264#define GSM48_MT_RR_SYSINFO_2bis 0x02
265#define GSM48_MT_RR_SYSINFO_2ter 0x03
266#define GSM48_MT_RR_SYSINFO_5bis 0x05
267#define GSM48_MT_RR_SYSINFO_5ter 0x06
268#define GSM48_MT_RR_SYSINFO_9 0x04
269#define GSM48_MT_RR_SYSINFO_13 0x00
270
271#define GSM48_MT_RR_SYSINFO_16 0x3d
272#define GSM48_MT_RR_SYSINFO_17 0x3e
273
274#define GSM48_MT_RR_CHAN_MODE_MODIF 0x10
275#define GSM48_MT_RR_STATUS 0x12
276#define GSM48_MT_RR_CHAN_MODE_MODIF_ACK 0x17
277#define GSM48_MT_RR_FREQ_REDEF 0x14
278#define GSM48_MT_RR_MEAS_REP 0x15
279#define GSM48_MT_RR_CLSM_CHG 0x16
280#define GSM48_MT_RR_CLSM_ENQ 0x13
281#define GSM48_MT_RR_EXT_MEAS_REP 0x36
282#define GSM48_MT_RR_EXT_MEAS_REP_ORD 0x37
283#define GSM48_MT_RR_GPRS_SUSP_REQ 0x34
284
285#define GSM48_MT_RR_VGCS_UPL_GRANT 0x08
286#define GSM48_MT_RR_UPLINK_RELEASE 0x0e
287#define GSM48_MT_RR_UPLINK_FREE 0x0c
288#define GSM48_MT_RR_UPLINK_BUSY 0x2a
289#define GSM48_MT_RR_TALKER_IND 0x11
290
291#define GSM48_MT_RR_APP_INFO 0x38
292
293/* Table 10.2/3GPP TS 04.08 */
294#define GSM48_MT_MM_IMSI_DETACH_IND 0x01
295#define GSM48_MT_MM_LOC_UPD_ACCEPT 0x02
296#define GSM48_MT_MM_LOC_UPD_REJECT 0x04
297#define GSM48_MT_MM_LOC_UPD_REQUEST 0x08
298
299#define GSM48_MT_MM_AUTH_REJ 0x11
300#define GSM48_MT_MM_AUTH_REQ 0x12
301#define GSM48_MT_MM_AUTH_RESP 0x14
302#define GSM48_MT_MM_ID_REQ 0x18
303#define GSM48_MT_MM_ID_RESP 0x19
304#define GSM48_MT_MM_TMSI_REALL_CMD 0x1a
305#define GSM48_MT_MM_TMSI_REALL_COMPL 0x1b
306
307#define GSM48_MT_MM_CM_SERV_ACC 0x21
308#define GSM48_MT_MM_CM_SERV_REJ 0x22
309#define GSM48_MT_MM_CM_SERV_ABORT 0x23
310#define GSM48_MT_MM_CM_SERV_REQ 0x24
311#define GSM48_MT_MM_CM_SERV_PROMPT 0x25
312#define GSM48_MT_MM_CM_REEST_REQ 0x28
313#define GSM48_MT_MM_ABORT 0x29
314
315#define GSM48_MT_MM_NULL 0x30
316#define GSM48_MT_MM_STATUS 0x31
317#define GSM48_MT_MM_INFO 0x32
318
319/* Table 10.3/3GPP TS 04.08 */
320#define GSM48_MT_CC_ALERTING 0x01
321#define GSM48_MT_CC_CALL_CONF 0x08
322#define GSM48_MT_CC_CALL_PROC 0x02
323#define GSM48_MT_CC_CONNECT 0x07
324#define GSM48_MT_CC_CONNECT_ACK 0x0f
325#define GSM48_MT_CC_EMERG_SETUP 0x0e
326#define GSM48_MT_CC_PROGRESS 0x03
327#define GSM48_MT_CC_ESTAB 0x04
328#define GSM48_MT_CC_ESTAB_CONF 0x06
329#define GSM48_MT_CC_RECALL 0x0b
330#define GSM48_MT_CC_START_CC 0x09
331#define GSM48_MT_CC_SETUP 0x05
332
333#define GSM48_MT_CC_MODIFY 0x17
334#define GSM48_MT_CC_MODIFY_COMPL 0x1f
335#define GSM48_MT_CC_MODIFY_REJECT 0x13
336#define GSM48_MT_CC_USER_INFO 0x10
337#define GSM48_MT_CC_HOLD 0x18
338#define GSM48_MT_CC_HOLD_ACK 0x19
339#define GSM48_MT_CC_HOLD_REJ 0x1a
340#define GSM48_MT_CC_RETR 0x1c
341#define GSM48_MT_CC_RETR_ACK 0x1d
342#define GSM48_MT_CC_RETR_REJ 0x1e
343
344#define GSM48_MT_CC_DISCONNECT 0x25
345#define GSM48_MT_CC_RELEASE 0x2d
Harald Welte7ccf7782009-02-17 01:43:01 +0000346#define GSM48_MT_CC_RELEASE_COMPL 0x2a
Harald Welte52b1f982008-12-23 20:25:15 +0000347
348#define GSM48_MT_CC_CONG_CTRL 0x39
349#define GSM48_MT_CC_NOTIFY 0x3e
350#define GSM48_MT_CC_STATUS 0x3d
351#define GSM48_MT_CC_STATUS_ENQ 0x34
352#define GSM48_MT_CC_START_DTMF 0x35
353#define GSM48_MT_CC_STOP_DTMF 0x31
354#define GSM48_MT_CC_STOP_DTMF_ACK 0x32
355#define GSM48_MT_CC_START_DTMF_ACK 0x36
356#define GSM48_MT_CC_START_DTMF_REJ 0x37
357#define GSM48_MT_CC_FACILITY 0x3a
358
359/* FIXME: Table 10.4 / 10.4a (GPRS) */
360
361/* Section 10.5.2.26, Table 10.5.64 */
362#define GSM48_PM_MASK 0x03
363#define GSM48_PM_NORMAL 0x00
364#define GSM48_PM_EXTENDED 0x01
365#define GSM48_PM_REORG 0x02
366#define GSM48_PM_SAME 0x03
367
Harald Welte2f74aa42009-02-22 21:14:04 +0000368/* Chapter 10.5.3.5 / Table 10.5.93 */
369#define GSM48_LUPD_NORMAL 0x0
370#define GSM48_LUPD_PERIODIC 0x1
371#define GSM48_LUPD_IMSI_ATT 0x2
372#define GSM48_LUPD_RESERVED 0x3
373
Harald Welte52b1f982008-12-23 20:25:15 +0000374/* Table 10.5.4 */
375#define GSM_MI_TYPE_MASK 0x07
376#define GSM_MI_TYPE_NONE 0x00
377#define GSM_MI_TYPE_IMSI 0x01
378#define GSM_MI_TYPE_IMEI 0x02
379#define GSM_MI_TYPE_IMEISV 0x03
380#define GSM_MI_TYPE_TMSI 0x04
381#define GSM_MI_ODD 0x08
382
Harald Welte4b634542008-12-27 01:55:51 +0000383#define GSM48_IE_MOBILE_ID 0x17
Harald Weltec6ba9c22008-12-30 18:01:02 +0000384#define GSM48_IE_NAME_LONG 0x43 /* 10.5.3.5a */
385#define GSM48_IE_NAME_SHORT 0x45 /* 10.5.3.5a */
386#define GSM48_IE_UTC 0x46 /* 10.5.3.8 */
387#define GSM48_IE_NET_TIME_TZ 0x47 /* 10.5.3.9 */
388#define GSM48_IE_LSA_IDENT 0x48 /* 10.5.3.11 */
Harald Welte4b634542008-12-27 01:55:51 +0000389
Harald Welte7584aea2009-02-11 11:44:12 +0000390#define GSM48_IE_BEARER_CAP 0x04 /* 10.5.4.5 */
391#define GSM48_IE_CAUSE 0x08 /* 10.5.4.11 */
392#define GSM48_IE_CC_CAP 0x15 /* 10.5.4.5a */
393#define GSM48_IE_ALERT 0x19 /* 10.5.4.26 */
394#define GSM48_IE_FACILITY 0x1c /* 10.5.4.15 */
395#define GSM48_IE_PROGR_IND 0x1e /* 10.5.4.21 */
396#define GSM48_IE_AUX_STATUS 0x24 /* 10.5.4.4 */
397#define GSM48_IE_KPD_FACILITY 0x2c /* 10.5.4.17 */
398#define GSM48_IE_SIGNAL 0x34 /* 10.5.4.23 */
399#define GSM48_IE_CONN_NUM 0x4c /* 10.5.4.13 */
400#define GSM48_IE_CONN_SUBADDR 0x4d /* 10.5.4.14 */
401#define GSM48_IE_CALLING_BCD 0x5c /* 10.5.4.9 */
402#define GSM48_IE_CALLING_SUB 0x5d /* 10.5.4.10 */
403#define GSM48_IE_CALLED_BCD 0x5e /* 10.5.4.7 */
404#define GSM48_IE_CALLED_SUB 0x6d /* 10.5.4.8 */
405#define GSM48_IE_REDIR_BCD 0x74 /* 10.5.4.21a */
406#define GSM48_IE_REDIR_SUB 0x75 /* 10.5.4.21b */
407#define GSM48_IE_LOWL_COMPAT 0x7c /* 10.5.4.18 */
408#define GSM48_IE_HIGHL_COMPAT 0x7d /* 10.5.4.16 */
409#define GSM48_IE_USER_USER 0x7e /* 10.5.4.25 */
410#define GSM48_IE_SS_VERS 0x7f /* 10.5.4.24 */
411#define GSM48_IE_MORE_DATA 0xa0 /* 10.5.4.19 */
412#define GSM48_IE_CLIR_SUPP 0xa1 /* 10.5.4.11a */
413#define GSM48_IE_CLIR_INVOC 0xa2 /* 10.5.4.11b */
414#define GSM48_IE_REV_C_SETUP 0xa3 /* 10.5.4.22a */
415
Harald Welte4b634542008-12-27 01:55:51 +0000416/* Section 10.5.4.11 / Table 10.5.122 */
417#define GSM48_CAUSE_CS_GSM 0x60
418
Harald Welte4a543e82009-02-28 13:17:55 +0000419/* Section 9.1.2 / Table 9.3 */
420#define GSM48_IE_FRQLIST_AFTER 0x05
421#define GSM48_IE_CELL_CH_DESC 0x62
422#define GSM48_IE_MSLOT_DESC 0x10
423#define GSM48_IE_CHANMODE_1 0x63
424#define GSM48_IE_CHANMODE_2 0x11
425#define GSM48_IE_CHANMODE_3 0x13
426#define GSM48_IE_CHANMODE_4 0x14
427#define GSM48_IE_CHANMODE_5 0x15
428#define GSM48_IE_CHANMODE_6 0x16
429#define GSM48_IE_CHANMODE_7 0x17
430#define GSM48_IE_CHANMODE_8 0x18
431#define GSM48_IE_CHANDESC_2 0x64
432/* FIXME */
433
Harald Welte7584aea2009-02-11 11:44:12 +0000434/* Section 10.5.4.23 / Table 10.5.130 */
435enum gsm48_signal_val {
436 GSM48_SIGNAL_DIALTONE = 0x00,
437 GSM48_SIGNAL_RINGBACK = 0x01,
438 GSM48_SIGNAL_INTERCEPT = 0x02,
439 GSM48_SIGNAL_NET_CONG = 0x03,
440 GSM48_SIGNAL_BUSY = 0x04,
441 GSM48_SIGNAL_CONFIRM = 0x05,
442 GSM48_SIGNAL_ANSWER = 0x06,
443 GSM48_SIGNAL_CALL_WAIT = 0x07,
444 GSM48_SIGNAL_OFF_HOOK = 0x08,
445 GSM48_SIGNAL_OFF = 0x3f,
446 GSM48_SIGNAL_ALERT_OFF = 0x4f,
447};
448
Harald Welte4b634542008-12-27 01:55:51 +0000449enum gsm48_cause_loc {
450 GSM48_CAUSE_LOC_USER = 0x00,
451 GSM48_CAUSE_LOC_PRN_S_LU = 0x01,
452 GSM48_CAUSE_LOC_PUN_S_LU = 0x02,
453 GSM48_CAUSE_LOC_TRANS_NET = 0x03,
454 GSM48_CAUSE_LOC_PUN_S_RU = 0x04,
455 GSM48_CAUSE_LOC_PRN_S_RU = 0x05,
456 /* not defined */
457 GSM48_CAUSE_LOC_INN_NET = 0x07,
458 GSM48_CAUSE_LOC_NET_BEYOND = 0x0a,
459};
460
Holger Freythere64a7a32009-02-06 21:55:37 +0000461/* Section 10.5.2.31 RR Cause / Table 10.5.70 */
462enum gsm48_rr_cause {
463 GSM48_RR_CAUSE_NORMAL = 0x00,
464 GSM48_RR_CAUSE_ABNORMAL_UNSPEC = 0x01,
465 GSM48_RR_CAUSE_ABNORMAL_UNACCT = 0x02,
466 GSM48_RR_CAUSE_ABNORMAL_TIMER = 0x03,
467 GSM48_RR_CAUSE_ABNORMAL_NOACT = 0x04,
468 GSM48_RR_CAUSE_PREMPTIVE_REL = 0x05,
469 GSM48_RR_CAUSE_HNDOVER_IMP = 0x06,
470 GSM48_RR_CAUSE_CHAN_MODE_UNACCT = 0x07,
471 GSM48_RR_CAUSE_FREQ_NOT_IMPL = 0x08,
Harald Weltecf5b3592009-05-01 18:28:42 +0000472 GSM48_RR_CAUSE_CALL_CLEARED = 0x41,
Holger Freythere64a7a32009-02-06 21:55:37 +0000473 GSM48_RR_CAUSE_SEMANT_INCORR = 0x5f,
474 GSM48_RR_CAUSE_INVALID_MAND_INF = 0x60,
475 GSM48_RR_CAUSE_MSG_TYPE_N = 0x61,
476 GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT= 0x62,
477 GSM48_RR_CAUSE_COND_IE_ERROR = 0x64,
478 GSM48_RR_CAUSE_NO_CELL_ALLOC_A = 0x65,
479 GSM48_RR_CAUSE_PROT_ERROR_UNSPC = 0x6f,
480};
481
Holger Freythera7677942008-12-30 16:18:16 +0000482/* Annex G, GSM specific cause values for mobility management */
483enum gsm48_reject_value {
484 GSM48_REJECT_IMSI_UNKNOWN_IN_HLR = 2,
485 GSM48_REJECT_ILLEGAL_MS = 3,
486 GSM48_REJECT_IMSI_UNKNOWN_IN_VLR = 4,
487 GSM48_REJECT_IMEI_NOT_ACCEPTED = 5,
488 GSM48_REJECT_ILLEGAL_ME = 6,
489 GSM48_REJECT_PLMN_NOT_ALLOWED = 11,
490 GSM48_REJECT_LOC_NOT_ALLOWED = 12,
491 GSM48_REJECT_ROAMING_NOT_ALLOWED = 13,
492 GSM48_REJECT_NETWORK_FAILURE = 17,
493 GSM48_REJECT_CONGESTION = 22,
494 GSM48_REJECT_SRV_OPT_NOT_SUPPORTED = 32,
495 GSM48_REJECT_RQD_SRV_OPT_NOT_SUPPORTED = 33,
496 GSM48_REJECT_SRV_OPT_TMP_OUT_OF_ORDER = 34,
497 GSM48_REJECT_CALL_CAN_NOT_BE_IDENTIFIED = 38,
498 GSM48_REJECT_INCORRECT_MESSAGE = 95,
499 GSM48_REJECT_INVALID_MANDANTORY_INF = 96,
500 GSM48_REJECT_MSG_TYPE_NOT_IMPLEMENTED = 97,
501 GSM48_REJECT_MSG_TYPE_NOT_COMPATIBLE = 98,
502 GSM48_REJECT_INF_ELEME_NOT_IMPLEMENTED = 99,
503 GSM48_REJECT_CONDTIONAL_IE_ERROR = 100,
504 GSM48_REJECT_MSG_NOT_COMPATIBLE = 101,
505 GSM48_REJECT_PROTOCOL_ERROR = 111,
506
507 /* according to G.6 Additional cause codes for GMM */
508 GSM48_REJECT_GPRS_NOT_ALLOWED = 7,
509 GSM48_REJECT_SERVICES_NOT_ALLOWED = 8,
510 GSM48_REJECT_MS_IDENTITY_NOT_DERVIVABLE = 9,
511 GSM48_REJECT_IMPLICITLY_DETACHED = 10,
512 GSM48_REJECT_GPRS_NOT_ALLOWED_IN_PLMN = 14,
513 GSM48_REJECT_MSC_TMP_NOT_REACHABLE = 16,
514};
515
516
Harald Weltef7c43522009-06-09 20:24:21 +0000517/* extracted from a L3 measurement report IE */
518struct gsm_meas_rep_cell {
519 u_int8_t rxlev;
520 u_int8_t bcch_freq; /* fixme: translate to ARFCN */
521 u_int8_t bsic;
522};
523
524struct gsm_meas_rep {
525 unsigned int flags;
526 u_int8_t rxlev_full;
527 u_int8_t rxqual_full;
528 u_int8_t rxlev_sub;
529 u_int8_t rxqual_sub;
530 int num_cell;
531 struct gsm_meas_rep_cell cell[6];
532};
533#define MEAS_REP_F_DTX 0x01
534#define MEAS_REP_F_VALID 0x02
535#define MEAS_REP_F_BA1 0x04
536
537void gsm48_parse_meas_rep(struct gsm_meas_rep *rep, const u_int8_t *data,
538 int len);
539
540
Harald Welte8470bf22008-12-25 23:28:35 +0000541struct msgb;
542struct gsm_bts;
Harald Welte0932d1e2009-02-16 22:53:52 +0000543struct gsm_subscriber;
Harald Welte8470bf22008-12-25 23:28:35 +0000544
Holger Freythere97f7fb2008-12-31 18:52:11 +0000545/* config options controlling the behaviour of the lower leves */
Holger Freyther89824fc2008-12-30 16:18:18 +0000546void gsm0408_allow_everyone(int allow);
Holger Freythere97f7fb2008-12-31 18:52:11 +0000547void gsm0408_set_reject_cause(int cause);
548
Harald Welte8470bf22008-12-25 23:28:35 +0000549int gsm0408_rcvmsg(struct msgb *msg);
Holger Freyther17746612008-12-28 16:32:44 +0000550void gsm0408_generate_lai(struct gsm48_loc_area_id *lai48, u_int16_t mcc,
551 u_int16_t mnc, u_int16_t lac);
Harald Welte49f48b82009-02-17 15:29:33 +0000552int gsm48_cc_tx_setup(struct gsm_lchan *lchan, struct gsm_subscriber *calling);
Harald Welte8470bf22008-12-25 23:28:35 +0000553enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra);
Harald Weltee14a57c2008-12-29 04:08:28 +0000554enum gsm_chreq_reason_t get_reason_by_chreq(struct gsm_bts *bts, u_int8_t ra);
Harald Welte8470bf22008-12-25 23:28:35 +0000555
Harald Weltec6ba9c22008-12-30 18:01:02 +0000556int gsm48_tx_mm_info(struct gsm_lchan *lchan);
Holger Freyther819dd202009-01-04 03:52:50 +0000557struct msgb *gsm48_msgb_alloc(void);
Holger Freyther3e2c3232009-01-04 03:55:31 +0000558int gsm48_sendmsg(struct msgb *msg);
Holger Freytherca362a62009-01-04 21:05:01 +0000559int generate_mid_from_tmsi(u_int8_t *buf, u_int32_t tmsi);
Harald Weltec6ba9c22008-12-30 18:01:02 +0000560
Holger Freythere64a7a32009-02-06 21:55:37 +0000561int gsm48_send_rr_release(struct gsm_lchan *lchan);
Harald Welte8470bf22008-12-25 23:28:35 +0000562
Harald Welte0932d1e2009-02-16 22:53:52 +0000563/* convert a ASCII phone number to call-control BCD */
564int encode_bcd_number(u_int8_t *bcd_lv, u_int8_t max_len,
565 u_int8_t type, const char *input);
566u_int8_t decode_bcd_number(char *output, int output_len, const u_int8_t *bcd_lv);
567
Harald Welte52b1f982008-12-23 20:25:15 +0000568#endif