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