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