blob: c79b1d035de973cb53144b7dac56d97f496438ee [file] [log] [blame]
Harald Welteec8b4502010-02-20 20:34:29 +01001#ifndef PROTO_GSM_04_08_H
2#define PROTO_GSM_04_08_H
3
4#include <stdint.h>
5
6/* GSM TS 04.08 definitions */
7struct gsm_lchan;
8
9struct gsm48_classmark1 {
10 uint8_t spare:1,
11 rev_level:2,
12 es_ind:1,
13 a5_1:1,
14 pwr_lev:3;
15} __attribute__ ((packed));
16
17/* Chapter 10.5.2.5 */
18struct gsm48_chan_desc {
19 uint8_t chan_nr;
20 union {
21 struct {
22 uint8_t maio_high:4,
23 h:1,
24 tsc:3;
25 uint8_t hsn:6,
26 maio_low:2;
27 } h1;
28 struct {
29 uint8_t arfcn_high:2,
30 spare:2,
31 h:1,
32 tsc:3;
33 uint8_t arfcn_low;
34 } h0;
35 };
36} __attribute__ ((packed));
37
38/* Chapter 10.5.2.21aa */
39struct gsm48_multi_rate_conf {
40 uint8_t smod : 2,
41 spare: 1,
42 icmi : 1,
43 nscb : 1,
44 ver : 3;
45 uint8_t m4_75 : 1,
46 m5_15 : 1,
47 m5_90 : 1,
48 m6_70 : 1,
49 m7_40 : 1,
50 m7_95 : 1,
51 m10_2 : 1,
52 m12_2 : 1;
53} __attribute__((packed));
54
55/* Chapter 10.5.2.30 */
56struct gsm48_req_ref {
57 uint8_t ra;
58 uint8_t t3_high:3,
59 t1_:5;
60 uint8_t t2:5,
61 t3_low:3;
62} __attribute__ ((packed));
63
64/*
65 * Chapter 9.1.5/9.1.6
66 *
67 * For 9.1.6 the chan_desc has the meaning of 10.5.2.5a
68 */
69struct gsm48_chan_mode_modify {
70 struct gsm48_chan_desc chan_desc;
71 uint8_t mode;
72} __attribute__ ((packed));
73
74enum gsm48_chan_mode {
75 GSM48_CMODE_SIGN = 0x00,
76 GSM48_CMODE_SPEECH_V1 = 0x01,
77 GSM48_CMODE_SPEECH_EFR = 0x21,
78 GSM48_CMODE_SPEECH_AMR = 0x41,
79 GSM48_CMODE_DATA_14k5 = 0x0f,
80 GSM48_CMODE_DATA_12k0 = 0x03,
81 GSM48_CMODE_DATA_6k0 = 0x0b,
82 GSM48_CMODE_DATA_3k6 = 0x23,
83};
84
85/* Chapter 9.1.2 */
86struct gsm48_ass_cmd {
87 /* Semantic is from 10.5.2.5a */
88 struct gsm48_chan_desc chan_desc;
89 uint8_t power_command;
90 uint8_t data[0];
91} __attribute__((packed));
92
93/* Chapter 10.5.2.2 */
94struct gsm48_cell_desc {
95 uint8_t bcc:3,
96 ncc:3,
97 arfcn_hi:2;
98 uint8_t arfcn_lo;
99} __attribute__((packed));
100
101/* Chapter 9.1.15 */
102struct gsm48_ho_cmd {
103 struct gsm48_cell_desc cell_desc;
104 struct gsm48_chan_desc chan_desc;
105 uint8_t ho_ref;
106 uint8_t power_command;
107 uint8_t data[0];
108} __attribute__((packed));
109
110/* Chapter 9.1.18 */
111struct gsm48_imm_ass {
112 uint8_t l2_plen;
113 uint8_t proto_discr;
114 uint8_t msg_type;
115 uint8_t page_mode;
116 struct gsm48_chan_desc chan_desc;
117 struct gsm48_req_ref req_ref;
118 uint8_t timing_advance;
119 uint8_t mob_alloc_len;
120 uint8_t mob_alloc[0];
121} __attribute__ ((packed));
122
Holger Hans Peter Freyther5dcef3c2010-05-15 22:35:25 +0800123/* Chapter 9.1.25 */
124struct gsm48_pag_resp {
125 uint8_t spare:4,
126 key_seq:4;
127 uint32_t classmark2;
128 uint8_t mi_len;
129 uint8_t mi[0];
130} __attribute__ ((packed));
131
Harald Welteec8b4502010-02-20 20:34:29 +0100132/* Chapter 10.5.1.3 */
133struct gsm48_loc_area_id {
134 uint8_t digits[3]; /* BCD! */
135 uint16_t lac;
136} __attribute__ ((packed));
137
138/* Section 9.2.2 */
139struct gsm48_auth_req {
140 uint8_t key_seq:4,
141 spare:4;
142 uint8_t rand[16];
143} __attribute__ ((packed));
144
Sylvain Munautd005eab2010-06-10 13:30:50 +0200145/* Section 9.2.3 */
146struct gsm48_auth_resp {
147 uint8_t sres[4];
148} __attribute__ ((packed));
149
Harald Welteec8b4502010-02-20 20:34:29 +0100150/* Section 9.2.15 */
151struct gsm48_loc_upd_req {
152 uint8_t type:4,
153 key_seq:4;
154 struct gsm48_loc_area_id lai;
155 struct gsm48_classmark1 classmark1;
156 uint8_t mi_len;
157 uint8_t mi[0];
158} __attribute__ ((packed));
159
160/* Section 10.1 */
161struct gsm48_hdr {
162 uint8_t proto_discr;
163 uint8_t msg_type;
164 uint8_t data[0];
165} __attribute__ ((packed));
166
167/* Section 9.1.3x System information Type header */
168struct gsm48_system_information_type_header {
169 uint8_t l2_plen;
170 uint8_t rr_protocol_discriminator :4,
171 skip_indicator:4;
172 uint8_t system_information;
173} __attribute__ ((packed));
174
175struct gsm48_rach_control {
176 uint8_t re :1,
177 cell_bar :1,
178 tx_integer :4,
179 max_trans :2;
180 uint8_t t2;
181 uint8_t t3;
182} __attribute__ ((packed));
183
184/* Section 10.5.2.4 Cell Selection Parameters */
185struct gsm48_cell_sel_par {
186 uint8_t ms_txpwr_max_ccch:5, /* GSM 05.08 MS-TXPWR-MAX-CCCH */
187 cell_resel_hyst:3; /* GSM 05.08 CELL-RESELECT-HYSTERESIS */
188 uint8_t rxlev_acc_min:6, /* GSM 05.08 RXLEV-ACCESS-MIN */
189 neci:1,
190 acs:1;
191} __attribute__ ((packed));
192
193/* Section 10.5.2.11 Control Channel Description , Figure 10.5.33 */
194struct gsm48_control_channel_descr {
195 uint8_t ccch_conf :3,
196 bs_ag_blks_res :3,
197 att :1,
198 spare1 :1;
199 uint8_t bs_pa_mfrms : 3,
200 spare2 :5;
201 uint8_t t3212;
202} __attribute__ ((packed));
203
204struct gsm48_cell_options {
205 uint8_t radio_link_timeout:4,
206 dtx:2,
207 pwrc:1,
208 spare:1;
209} __attribute__ ((packed));
210
211/* Section 9.2.9 CM service request */
212struct gsm48_service_request {
213 uint8_t cm_service_type : 4,
214 cipher_key_seq : 4;
215 /* length + 3 bytes */
216 uint32_t classmark;
217 uint8_t mi_len;
218 uint8_t mi[0];
219 /* optional priority level */
220} __attribute__ ((packed));
221
222/* Section 9.1.31 System information Type 1 */
223struct gsm48_system_information_type_1 {
224 struct gsm48_system_information_type_header header;
225 uint8_t cell_channel_description[16];
226 struct gsm48_rach_control rach_control;
227 uint8_t rest_octets[0]; /* NCH position on the CCCH */
228} __attribute__ ((packed));
229
230/* Section 9.1.32 System information Type 2 */
231struct gsm48_system_information_type_2 {
232 struct gsm48_system_information_type_header header;
233 uint8_t bcch_frequency_list[16];
234 uint8_t ncc_permitted;
235 struct gsm48_rach_control rach_control;
236} __attribute__ ((packed));
237
238/* Section 9.1.35 System information Type 3 */
239struct gsm48_system_information_type_3 {
240 struct gsm48_system_information_type_header header;
241 uint16_t cell_identity;
242 struct gsm48_loc_area_id lai;
243 struct gsm48_control_channel_descr control_channel_desc;
244 struct gsm48_cell_options cell_options;
245 struct gsm48_cell_sel_par cell_sel_par;
246 struct gsm48_rach_control rach_control;
247 uint8_t rest_octets[0];
248} __attribute__ ((packed));
249
250/* Section 9.1.36 System information Type 4 */
251struct gsm48_system_information_type_4 {
252 struct gsm48_system_information_type_header header;
253 struct gsm48_loc_area_id lai;
254 struct gsm48_cell_sel_par cell_sel_par;
255 struct gsm48_rach_control rach_control;
256 /* optional CBCH conditional CBCH... followed by
257 mandantory SI 4 Reset Octets
258 */
259 uint8_t data[0];
260} __attribute__ ((packed));
261
262/* Section 9.1.37 System information Type 5 */
263struct gsm48_system_information_type_5 {
264 uint8_t rr_protocol_discriminator :4,
265 skip_indicator:4;
266 uint8_t system_information;
267 uint8_t bcch_frequency_list[16];
268} __attribute__ ((packed));
269
270/* Section 9.1.40 System information Type 6 */
271struct gsm48_system_information_type_6 {
272 uint8_t rr_protocol_discriminator :4,
273 skip_indicator:4;
274 uint8_t system_information;
275 uint16_t cell_identity;
276 struct gsm48_loc_area_id lai;
277 struct gsm48_cell_options cell_options;
278 uint8_t ncc_permitted;
279 uint8_t rest_octets[0];
280} __attribute__ ((packed));
281
282/* Section 9.1.43a System Information type 13 */
283struct gsm48_system_information_type_13 {
284 struct gsm48_system_information_type_header header;
285 uint8_t rest_octets[0];
286} __attribute__ ((packed));
287
288/* Section 9.2.12 IMSI Detach Indication */
289struct gsm48_imsi_detach_ind {
290 struct gsm48_classmark1 classmark1;
291 uint8_t mi_len;
292 uint8_t mi[0];
293} __attribute__ ((packed));
294
295/* Section 10.2 + GSM 04.07 12.2.3.1.1 */
296#define GSM48_PDISC_GROUP_CC 0x00
297#define GSM48_PDISC_BCAST_CC 0x01
298#define GSM48_PDISC_PDSS1 0x02
299#define GSM48_PDISC_CC 0x03
300#define GSM48_PDISC_PDSS2 0x04
301#define GSM48_PDISC_MM 0x05
302#define GSM48_PDISC_RR 0x06
303#define GSM48_PDISC_MM_GPRS 0x08
304#define GSM48_PDISC_SMS 0x09
305#define GSM48_PDISC_SM_GPRS 0x0a
306#define GSM48_PDISC_NC_SS 0x0b
307#define GSM48_PDISC_LOC 0x0c
308#define GSM48_PDISC_MASK 0x0f
309#define GSM48_PDISC_USSD 0x11
310
311/* Section 10.4 */
312#define GSM48_MT_RR_INIT_REQ 0x3c
313#define GSM48_MT_RR_ADD_ASS 0x3b
314#define GSM48_MT_RR_IMM_ASS 0x3f
315#define GSM48_MT_RR_IMM_ASS_EXT 0x39
316#define GSM48_MT_RR_IMM_ASS_REJ 0x3a
317
318#define GSM48_MT_RR_CIPH_M_CMD 0x35
319#define GSM48_MT_RR_CIPH_M_COMPL 0x32
320
321#define GSM48_MT_RR_CFG_CHG_CMD 0x30
322#define GSM48_MT_RR_CFG_CHG_ACK 0x31
323#define GSM48_MT_RR_CFG_CHG_REJ 0x33
324
325#define GSM48_MT_RR_ASS_CMD 0x2e
326#define GSM48_MT_RR_ASS_COMPL 0x29
327#define GSM48_MT_RR_ASS_FAIL 0x2f
328#define GSM48_MT_RR_HANDO_CMD 0x2b
329#define GSM48_MT_RR_HANDO_COMPL 0x2c
330#define GSM48_MT_RR_HANDO_FAIL 0x28
331#define GSM48_MT_RR_HANDO_INFO 0x2d
332
333#define GSM48_MT_RR_CELL_CHG_ORDER 0x08
334#define GSM48_MT_RR_PDCH_ASS_CMD 0x23
335
336#define GSM48_MT_RR_CHAN_REL 0x0d
337#define GSM48_MT_RR_PART_REL 0x0a
338#define GSM48_MT_RR_PART_REL_COMP 0x0f
339
340#define GSM48_MT_RR_PAG_REQ_1 0x21
341#define GSM48_MT_RR_PAG_REQ_2 0x22
342#define GSM48_MT_RR_PAG_REQ_3 0x24
343#define GSM48_MT_RR_PAG_RESP 0x27
344#define GSM48_MT_RR_NOTIF_NCH 0x20
345#define GSM48_MT_RR_NOTIF_FACCH 0x25
346#define GSM48_MT_RR_NOTIF_RESP 0x26
347
348#define GSM48_MT_RR_SYSINFO_8 0x18
349#define GSM48_MT_RR_SYSINFO_1 0x19
350#define GSM48_MT_RR_SYSINFO_2 0x1a
351#define GSM48_MT_RR_SYSINFO_3 0x1b
352#define GSM48_MT_RR_SYSINFO_4 0x1c
353#define GSM48_MT_RR_SYSINFO_5 0x1d
354#define GSM48_MT_RR_SYSINFO_6 0x1e
355#define GSM48_MT_RR_SYSINFO_7 0x1f
356
357#define GSM48_MT_RR_SYSINFO_2bis 0x02
358#define GSM48_MT_RR_SYSINFO_2ter 0x03
359#define GSM48_MT_RR_SYSINFO_5bis 0x05
360#define GSM48_MT_RR_SYSINFO_5ter 0x06
361#define GSM48_MT_RR_SYSINFO_9 0x04
362#define GSM48_MT_RR_SYSINFO_13 0x00
363
364#define GSM48_MT_RR_SYSINFO_16 0x3d
365#define GSM48_MT_RR_SYSINFO_17 0x3e
366
367#define GSM48_MT_RR_CHAN_MODE_MODIF 0x10
368#define GSM48_MT_RR_STATUS 0x12
369#define GSM48_MT_RR_CHAN_MODE_MODIF_ACK 0x17
370#define GSM48_MT_RR_FREQ_REDEF 0x14
371#define GSM48_MT_RR_MEAS_REP 0x15
372#define GSM48_MT_RR_CLSM_CHG 0x16
373#define GSM48_MT_RR_CLSM_ENQ 0x13
374#define GSM48_MT_RR_EXT_MEAS_REP 0x36
375#define GSM48_MT_RR_EXT_MEAS_REP_ORD 0x37
376#define GSM48_MT_RR_GPRS_SUSP_REQ 0x34
377
378#define GSM48_MT_RR_VGCS_UPL_GRANT 0x08
379#define GSM48_MT_RR_UPLINK_RELEASE 0x0e
380#define GSM48_MT_RR_UPLINK_FREE 0x0c
381#define GSM48_MT_RR_UPLINK_BUSY 0x2a
382#define GSM48_MT_RR_TALKER_IND 0x11
383
384#define GSM48_MT_RR_APP_INFO 0x38
385
386/* Table 10.2/3GPP TS 04.08 */
387#define GSM48_MT_MM_IMSI_DETACH_IND 0x01
388#define GSM48_MT_MM_LOC_UPD_ACCEPT 0x02
389#define GSM48_MT_MM_LOC_UPD_REJECT 0x04
390#define GSM48_MT_MM_LOC_UPD_REQUEST 0x08
391
392#define GSM48_MT_MM_AUTH_REJ 0x11
393#define GSM48_MT_MM_AUTH_REQ 0x12
394#define GSM48_MT_MM_AUTH_RESP 0x14
395#define GSM48_MT_MM_ID_REQ 0x18
396#define GSM48_MT_MM_ID_RESP 0x19
397#define GSM48_MT_MM_TMSI_REALL_CMD 0x1a
398#define GSM48_MT_MM_TMSI_REALL_COMPL 0x1b
399
400#define GSM48_MT_MM_CM_SERV_ACC 0x21
401#define GSM48_MT_MM_CM_SERV_REJ 0x22
402#define GSM48_MT_MM_CM_SERV_ABORT 0x23
403#define GSM48_MT_MM_CM_SERV_REQ 0x24
404#define GSM48_MT_MM_CM_SERV_PROMPT 0x25
405#define GSM48_MT_MM_CM_REEST_REQ 0x28
406#define GSM48_MT_MM_ABORT 0x29
407
408#define GSM48_MT_MM_NULL 0x30
409#define GSM48_MT_MM_STATUS 0x31
410#define GSM48_MT_MM_INFO 0x32
411
412/* Table 10.3/3GPP TS 04.08 */
413#define GSM48_MT_CC_ALERTING 0x01
414#define GSM48_MT_CC_CALL_CONF 0x08
415#define GSM48_MT_CC_CALL_PROC 0x02
416#define GSM48_MT_CC_CONNECT 0x07
417#define GSM48_MT_CC_CONNECT_ACK 0x0f
418#define GSM48_MT_CC_EMERG_SETUP 0x0e
419#define GSM48_MT_CC_PROGRESS 0x03
420#define GSM48_MT_CC_ESTAB 0x04
421#define GSM48_MT_CC_ESTAB_CONF 0x06
422#define GSM48_MT_CC_RECALL 0x0b
423#define GSM48_MT_CC_START_CC 0x09
424#define GSM48_MT_CC_SETUP 0x05
425
426#define GSM48_MT_CC_MODIFY 0x17
427#define GSM48_MT_CC_MODIFY_COMPL 0x1f
428#define GSM48_MT_CC_MODIFY_REJECT 0x13
429#define GSM48_MT_CC_USER_INFO 0x10
430#define GSM48_MT_CC_HOLD 0x18
431#define GSM48_MT_CC_HOLD_ACK 0x19
432#define GSM48_MT_CC_HOLD_REJ 0x1a
433#define GSM48_MT_CC_RETR 0x1c
434#define GSM48_MT_CC_RETR_ACK 0x1d
435#define GSM48_MT_CC_RETR_REJ 0x1e
436
437#define GSM48_MT_CC_DISCONNECT 0x25
438#define GSM48_MT_CC_RELEASE 0x2d
439#define GSM48_MT_CC_RELEASE_COMPL 0x2a
440
441#define GSM48_MT_CC_CONG_CTRL 0x39
442#define GSM48_MT_CC_NOTIFY 0x3e
443#define GSM48_MT_CC_STATUS 0x3d
444#define GSM48_MT_CC_STATUS_ENQ 0x34
445#define GSM48_MT_CC_START_DTMF 0x35
446#define GSM48_MT_CC_STOP_DTMF 0x31
447#define GSM48_MT_CC_STOP_DTMF_ACK 0x32
448#define GSM48_MT_CC_START_DTMF_ACK 0x36
449#define GSM48_MT_CC_START_DTMF_REJ 0x37
450#define GSM48_MT_CC_FACILITY 0x3a
451
452/* FIXME: Table 10.4 / 10.4a (GPRS) */
453
454/* Section 10.5.2.26, Table 10.5.64 */
455#define GSM48_PM_MASK 0x03
456#define GSM48_PM_NORMAL 0x00
457#define GSM48_PM_EXTENDED 0x01
458#define GSM48_PM_REORG 0x02
459#define GSM48_PM_SAME 0x03
460
461/* Chapter 10.5.3.5 / Table 10.5.93 */
462#define GSM48_LUPD_NORMAL 0x0
463#define GSM48_LUPD_PERIODIC 0x1
464#define GSM48_LUPD_IMSI_ATT 0x2
465#define GSM48_LUPD_RESERVED 0x3
466
467/* Table 10.5.4 */
468#define GSM_MI_TYPE_MASK 0x07
469#define GSM_MI_TYPE_NONE 0x00
470#define GSM_MI_TYPE_IMSI 0x01
471#define GSM_MI_TYPE_IMEI 0x02
472#define GSM_MI_TYPE_IMEISV 0x03
473#define GSM_MI_TYPE_TMSI 0x04
474#define GSM_MI_ODD 0x08
475
476#define GSM48_IE_MUL_RATE_CFG 0x03 /* 10.5.2.21aa */
477#define GSM48_IE_MOBILE_ID 0x17
478#define GSM48_IE_NAME_LONG 0x43 /* 10.5.3.5a */
479#define GSM48_IE_NAME_SHORT 0x45 /* 10.5.3.5a */
480#define GSM48_IE_UTC 0x46 /* 10.5.3.8 */
481#define GSM48_IE_NET_TIME_TZ 0x47 /* 10.5.3.9 */
482#define GSM48_IE_LSA_IDENT 0x48 /* 10.5.3.11 */
483
484#define GSM48_IE_BEARER_CAP 0x04 /* 10.5.4.5 */
485#define GSM48_IE_CAUSE 0x08 /* 10.5.4.11 */
486#define GSM48_IE_CC_CAP 0x15 /* 10.5.4.5a */
487#define GSM48_IE_ALERT 0x19 /* 10.5.4.26 */
488#define GSM48_IE_FACILITY 0x1c /* 10.5.4.15 */
489#define GSM48_IE_PROGR_IND 0x1e /* 10.5.4.21 */
490#define GSM48_IE_AUX_STATUS 0x24 /* 10.5.4.4 */
491#define GSM48_IE_NOTIFY 0x27 /* 10.5.4.20 */
492#define GSM48_IE_KPD_FACILITY 0x2c /* 10.5.4.17 */
493#define GSM48_IE_SIGNAL 0x34 /* 10.5.4.23 */
494#define GSM48_IE_CONN_BCD 0x4c /* 10.5.4.13 */
495#define GSM48_IE_CONN_SUB 0x4d /* 10.5.4.14 */
496#define GSM48_IE_CALLING_BCD 0x5c /* 10.5.4.9 */
497#define GSM48_IE_CALLING_SUB 0x5d /* 10.5.4.10 */
498#define GSM48_IE_CALLED_BCD 0x5e /* 10.5.4.7 */
499#define GSM48_IE_CALLED_SUB 0x6d /* 10.5.4.8 */
500#define GSM48_IE_REDIR_BCD 0x74 /* 10.5.4.21a */
501#define GSM48_IE_REDIR_SUB 0x75 /* 10.5.4.21b */
502#define GSM48_IE_LOWL_COMPAT 0x7c /* 10.5.4.18 */
503#define GSM48_IE_HIGHL_COMPAT 0x7d /* 10.5.4.16 */
504#define GSM48_IE_USER_USER 0x7e /* 10.5.4.25 */
505#define GSM48_IE_SS_VERS 0x7f /* 10.5.4.24 */
506#define GSM48_IE_MORE_DATA 0xa0 /* 10.5.4.19 */
507#define GSM48_IE_CLIR_SUPP 0xa1 /* 10.5.4.11a */
508#define GSM48_IE_CLIR_INVOC 0xa2 /* 10.5.4.11b */
509#define GSM48_IE_REV_C_SETUP 0xa3 /* 10.5.4.22a */
510#define GSM48_IE_REPEAT_CIR 0xd1 /* 10.5.4.22 */
511#define GSM48_IE_REPEAT_SEQ 0xd3 /* 10.5.4.22 */
512
513/* Section 10.5.4.11 / Table 10.5.122 */
514#define GSM48_CAUSE_CS_GSM 0x60
515
516/* Section 9.1.2 / Table 9.3 */
517#define GSM48_IE_FRQLIST_AFTER 0x05
518#define GSM48_IE_CELL_CH_DESC 0x62
519#define GSM48_IE_MSLOT_DESC 0x10
520#define GSM48_IE_CHANMODE_1 0x63
521#define GSM48_IE_CHANMODE_2 0x11
522#define GSM48_IE_CHANMODE_3 0x13
523#define GSM48_IE_CHANMODE_4 0x14
524#define GSM48_IE_CHANMODE_5 0x15
525#define GSM48_IE_CHANMODE_6 0x16
526#define GSM48_IE_CHANMODE_7 0x17
527#define GSM48_IE_CHANMODE_8 0x18
528#define GSM48_IE_CHANDESC_2 0x64
529/* FIXME */
530
531/* Section 10.5.4.23 / Table 10.5.130 */
532enum gsm48_signal_val {
533 GSM48_SIGNAL_DIALTONE = 0x00,
534 GSM48_SIGNAL_RINGBACK = 0x01,
535 GSM48_SIGNAL_INTERCEPT = 0x02,
536 GSM48_SIGNAL_NET_CONG = 0x03,
537 GSM48_SIGNAL_BUSY = 0x04,
538 GSM48_SIGNAL_CONFIRM = 0x05,
539 GSM48_SIGNAL_ANSWER = 0x06,
540 GSM48_SIGNAL_CALL_WAIT = 0x07,
541 GSM48_SIGNAL_OFF_HOOK = 0x08,
542 GSM48_SIGNAL_OFF = 0x3f,
543 GSM48_SIGNAL_ALERT_OFF = 0x4f,
544};
545
546enum gsm48_cause_loc {
547 GSM48_CAUSE_LOC_USER = 0x00,
548 GSM48_CAUSE_LOC_PRN_S_LU = 0x01,
549 GSM48_CAUSE_LOC_PUN_S_LU = 0x02,
550 GSM48_CAUSE_LOC_TRANS_NET = 0x03,
551 GSM48_CAUSE_LOC_PUN_S_RU = 0x04,
552 GSM48_CAUSE_LOC_PRN_S_RU = 0x05,
553 /* not defined */
554 GSM48_CAUSE_LOC_INN_NET = 0x07,
555 GSM48_CAUSE_LOC_NET_BEYOND = 0x0a,
556};
557
558/* Section 10.5.2.31 RR Cause / Table 10.5.70 */
559enum gsm48_rr_cause {
560 GSM48_RR_CAUSE_NORMAL = 0x00,
561 GSM48_RR_CAUSE_ABNORMAL_UNSPEC = 0x01,
562 GSM48_RR_CAUSE_ABNORMAL_UNACCT = 0x02,
563 GSM48_RR_CAUSE_ABNORMAL_TIMER = 0x03,
564 GSM48_RR_CAUSE_ABNORMAL_NOACT = 0x04,
565 GSM48_RR_CAUSE_PREMPTIVE_REL = 0x05,
566 GSM48_RR_CAUSE_HNDOVER_IMP = 0x06,
567 GSM48_RR_CAUSE_CHAN_MODE_UNACCT = 0x07,
568 GSM48_RR_CAUSE_FREQ_NOT_IMPL = 0x08,
569 GSM48_RR_CAUSE_CALL_CLEARED = 0x41,
570 GSM48_RR_CAUSE_SEMANT_INCORR = 0x5f,
571 GSM48_RR_CAUSE_INVALID_MAND_INF = 0x60,
572 GSM48_RR_CAUSE_MSG_TYPE_N = 0x61,
573 GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT= 0x62,
574 GSM48_RR_CAUSE_COND_IE_ERROR = 0x64,
575 GSM48_RR_CAUSE_NO_CELL_ALLOC_A = 0x65,
576 GSM48_RR_CAUSE_PROT_ERROR_UNSPC = 0x6f,
577};
578
579/* Section 10.5.4.11 CC Cause / Table 10.5.123 */
580enum gsm48_cc_cause {
581 GSM48_CC_CAUSE_UNASSIGNED_NR = 1,
582 GSM48_CC_CAUSE_NO_ROUTE = 3,
583 GSM48_CC_CAUSE_CHAN_UNACCEPT = 6,
584 GSM48_CC_CAUSE_OP_DET_BARRING = 8,
585 GSM48_CC_CAUSE_NORM_CALL_CLEAR = 16,
586 GSM48_CC_CAUSE_USER_BUSY = 17,
587 GSM48_CC_CAUSE_USER_NOTRESPOND = 18,
588 GSM48_CC_CAUSE_USER_ALERTING_NA = 19,
589 GSM48_CC_CAUSE_CALL_REJECTED = 21,
590 GSM48_CC_CAUSE_NUMBER_CHANGED = 22,
591 GSM48_CC_CAUSE_PRE_EMPTION = 25,
592 GSM48_CC_CAUSE_NONSE_USER_CLR = 26,
593 GSM48_CC_CAUSE_DEST_OOO = 27,
594 GSM48_CC_CAUSE_INV_NR_FORMAT = 28,
595 GSM48_CC_CAUSE_FACILITY_REJ = 29,
596 GSM48_CC_CAUSE_RESP_STATUS_INQ = 30,
597 GSM48_CC_CAUSE_NORMAL_UNSPEC = 31,
598 GSM48_CC_CAUSE_NO_CIRCUIT_CHAN = 34,
599 GSM48_CC_CAUSE_NETWORK_OOO = 38,
600 GSM48_CC_CAUSE_TEMP_FAILURE = 41,
601 GSM48_CC_CAUSE_SWITCH_CONG = 42,
602 GSM48_CC_CAUSE_ACC_INF_DISCARD = 43,
603 GSM48_CC_CAUSE_REQ_CHAN_UNAVAIL = 44,
604 GSM48_CC_CAUSE_RESOURCE_UNAVAIL = 47,
605 GSM48_CC_CAUSE_QOS_UNAVAIL = 49,
606 GSM48_CC_CAUSE_REQ_FAC_NOT_SUBSC= 50,
607 GSM48_CC_CAUSE_INC_BARRED_CUG = 55,
608 GSM48_CC_CAUSE_BEARER_CAP_UNAUTH= 57,
609 GSM48_CC_CAUSE_BEARER_CA_UNAVAIL= 58,
610 GSM48_CC_CAUSE_SERV_OPT_UNAVAIL = 63,
611 GSM48_CC_CAUSE_BEARERSERV_UNIMPL= 65,
612 GSM48_CC_CAUSE_ACM_GE_ACM_MAX = 68,
613 GSM48_CC_CAUSE_REQ_FAC_NOTIMPL = 69,
614 GSM48_CC_CAUSE_RESTR_BCAP_AVAIL = 70,
615 GSM48_CC_CAUSE_SERV_OPT_UNIMPL = 79,
616 GSM48_CC_CAUSE_INVAL_TRANS_ID = 81,
617 GSM48_CC_CAUSE_USER_NOT_IN_CUG = 87,
618 GSM48_CC_CAUSE_INCOMPAT_DEST = 88,
619 GSM48_CC_CAUSE_INVAL_TRANS_NET = 91,
620 GSM48_CC_CAUSE_SEMANTIC_INCORR = 95,
621 GSM48_CC_CAUSE_INVAL_MAND_INF = 96,
622 GSM48_CC_CAUSE_MSGTYPE_NOTEXIST = 97,
623 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT = 98,
624 GSM48_CC_CAUSE_IE_NOTEXIST = 99,
625 GSM48_CC_CAUSE_COND_IE_ERR = 100,
626 GSM48_CC_CAUSE_MSG_INCOMP_STATE = 101,
627 GSM48_CC_CAUSE_RECOVERY_TIMER = 102,
628 GSM48_CC_CAUSE_PROTO_ERR = 111,
629 GSM48_CC_CAUSE_INTERWORKING = 127,
630};
631
632/* Annex G, GSM specific cause values for mobility management */
633enum gsm48_reject_value {
634 GSM48_REJECT_IMSI_UNKNOWN_IN_HLR = 2,
635 GSM48_REJECT_ILLEGAL_MS = 3,
636 GSM48_REJECT_IMSI_UNKNOWN_IN_VLR = 4,
637 GSM48_REJECT_IMEI_NOT_ACCEPTED = 5,
638 GSM48_REJECT_ILLEGAL_ME = 6,
639 GSM48_REJECT_PLMN_NOT_ALLOWED = 11,
640 GSM48_REJECT_LOC_NOT_ALLOWED = 12,
641 GSM48_REJECT_ROAMING_NOT_ALLOWED = 13,
642 GSM48_REJECT_NETWORK_FAILURE = 17,
643 GSM48_REJECT_CONGESTION = 22,
644 GSM48_REJECT_SRV_OPT_NOT_SUPPORTED = 32,
645 GSM48_REJECT_RQD_SRV_OPT_NOT_SUPPORTED = 33,
646 GSM48_REJECT_SRV_OPT_TMP_OUT_OF_ORDER = 34,
647 GSM48_REJECT_CALL_CAN_NOT_BE_IDENTIFIED = 38,
648 GSM48_REJECT_INCORRECT_MESSAGE = 95,
649 GSM48_REJECT_INVALID_MANDANTORY_INF = 96,
650 GSM48_REJECT_MSG_TYPE_NOT_IMPLEMENTED = 97,
651 GSM48_REJECT_MSG_TYPE_NOT_COMPATIBLE = 98,
652 GSM48_REJECT_INF_ELEME_NOT_IMPLEMENTED = 99,
653 GSM48_REJECT_CONDTIONAL_IE_ERROR = 100,
654 GSM48_REJECT_MSG_NOT_COMPATIBLE = 101,
655 GSM48_REJECT_PROTOCOL_ERROR = 111,
656
657 /* according to G.6 Additional cause codes for GMM */
658 GSM48_REJECT_GPRS_NOT_ALLOWED = 7,
659 GSM48_REJECT_SERVICES_NOT_ALLOWED = 8,
660 GSM48_REJECT_MS_IDENTITY_NOT_DERVIVABLE = 9,
661 GSM48_REJECT_IMPLICITLY_DETACHED = 10,
662 GSM48_REJECT_GPRS_NOT_ALLOWED_IN_PLMN = 14,
663 GSM48_REJECT_MSC_TMP_NOT_REACHABLE = 16,
664};
665
666enum chreq_type {
667 CHREQ_T_EMERG_CALL,
668 CHREQ_T_CALL_REEST_TCH_F,
669 CHREQ_T_CALL_REEST_TCH_H,
670 CHREQ_T_CALL_REEST_TCH_H_DBL,
671 CHREQ_T_SDCCH,
672 CHREQ_T_TCH_F,
673 CHREQ_T_VOICE_CALL_TCH_H,
674 CHREQ_T_DATA_CALL_TCH_H,
675 CHREQ_T_LOCATION_UPD,
676 CHREQ_T_PAG_R_ANY_NECI0,
677 CHREQ_T_PAG_R_ANY_NECI1,
678 CHREQ_T_PAG_R_TCH_F,
679 CHREQ_T_PAG_R_TCH_FH,
680 CHREQ_T_LMU,
681 CHREQ_T_RESERVED_SDCCH,
682 CHREQ_T_RESERVED_IGNORE,
683};
684
685/* Chapter 11.3 */
686#define GSM48_T301 180, 0
687#define GSM48_T303 30, 0
688#define GSM48_T305 30, 0
689#define GSM48_T306 30, 0
690#define GSM48_T308 10, 0
691#define GSM48_T310 180, 0
692#define GSM48_T313 30, 0
693#define GSM48_T323 30, 0
694#define GSM48_T331 30, 0
695#define GSM48_T333 30, 0
696#define GSM48_T334 25, 0 /* min 15 */
697#define GSM48_T338 30, 0
698
699/* Chapter 5.1.2.2 */
700#define GSM_CSTATE_NULL 0
701#define GSM_CSTATE_INITIATED 1
Andreas Eversberg1ef041f2010-04-09 07:52:12 +0200702#define GSM_CSTATE_MM_CONNECTION_PEND 2 /* see 10.5.4.6 */
Harald Welteec8b4502010-02-20 20:34:29 +0100703#define GSM_CSTATE_MO_CALL_PROC 3
704#define GSM_CSTATE_CALL_DELIVERED 4
705#define GSM_CSTATE_CALL_PRESENT 6
706#define GSM_CSTATE_CALL_RECEIVED 7
707#define GSM_CSTATE_CONNECT_REQUEST 8
708#define GSM_CSTATE_MO_TERM_CALL_CONF 9
709#define GSM_CSTATE_ACTIVE 10
710#define GSM_CSTATE_DISCONNECT_REQ 12
711#define GSM_CSTATE_DISCONNECT_IND 12
712#define GSM_CSTATE_RELEASE_REQ 19
713#define GSM_CSTATE_MO_ORIG_MODIFY 26
714#define GSM_CSTATE_MO_TERM_MODIFY 27
715#define GSM_CSTATE_CONNECT_IND 28
716
717#define SBIT(a) (1 << a)
718#define ALL_STATES 0xffffffff
719
720/* Table 10.5.3/3GPP TS 04.08: Location Area Identification information element */
721#define GSM_LAC_RESERVED_DETACHED 0x0
722#define GSM_LAC_RESERVED_ALL_BTS 0xfffe
723
724/* GSM 04.08 Bearer Capability: Information Transfer Capability */
725enum gsm48_bcap_itcap {
726 GSM48_BCAP_ITCAP_SPEECH = 0,
727 GSM48_BCAP_ITCAP_UNR_DIG_INF = 1,
728 GSM48_BCAP_ITCAP_3k1_AUDIO = 2,
729 GSM48_BCAP_ITCAP_FAX_G3 = 3,
730 GSM48_BCAP_ITCAP_OTHER = 5,
731 GSM48_BCAP_ITCAP_RESERVED = 7,
732};
733
734/* GSM 04.08 Bearer Capability: Transfer Mode */
735enum gsm48_bcap_tmod {
736 GSM48_BCAP_TMOD_CIRCUIT = 0,
737 GSM48_BCAP_TMOD_PACKET = 1,
738};
739
740/* GSM 04.08 Bearer Capability: Coding Standard */
741enum gsm48_bcap_coding {
742 GSM48_BCAP_CODING_GSM_STD = 0,
743};
744
745/* GSM 04.08 Bearer Capability: Radio Channel Requirements */
746enum gsm48_bcap_rrq {
747 GSM48_BCAP_RRQ_FR_ONLY = 1,
748 GSM48_BCAP_RRQ_DUAL_HR = 2,
749 GSM48_BCAP_RRQ_DUAL_FR = 3,
750};
751
Harald Welteec8b4502010-02-20 20:34:29 +0100752#define GSM48_TMSI_LEN 5
753#define GSM48_MID_TMSI_LEN (GSM48_TMSI_LEN + 2)
754#define GSM48_MI_SIZE 32
755
Harald Weltea1c4f762010-05-01 11:59:42 +0200756/* Chapter 10.4.4.15 */
757struct gsm48_ra_id {
758 uint8_t digits[3]; /* MCC + MNC BCD digits */
759 uint16_t lac; /* Location Area Code */
760 uint8_t rac; /* Routing Area Code */
761} __attribute__ ((packed));
762
763
Harald Welteec8b4502010-02-20 20:34:29 +0100764
765#endif /* PROTO_GSM_04_08_H */