blob: 80a455dd893209b63d5b6389b55f0f0360607001 [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
Andreas Eversberg014cb872010-07-12 09:11:00 +02009/* Chapter 10.5.1.5 */
Harald Welteec8b4502010-02-20 20:34:29 +010010struct gsm48_classmark1 {
Andreas Eversberg014cb872010-07-12 09:11:00 +020011 uint8_t pwr_lev:3,
Harald Welteec8b4502010-02-20 20:34:29 +010012 a5_1:1,
Andreas Eversberg014cb872010-07-12 09:11:00 +020013 es_ind:1,
14 rev_lev:2,
15 spare:1;
16} __attribute__ ((packed));
17
18/* Chapter 10.5.1.6 */
19struct gsm48_classmark2 {
20 uint8_t pwr_lev:3,
21 a5_1:1,
22 es_ind:1,
23 rev_lev:2,
24 spare:1;
25 uint8_t fc:1,
26 vgcs:1,
27 vbs:1,
28 sm_cap:1,
29 ss_scr:2,
30 ps_cap:1,
31 spare2:1;
32 uint8_t a5_2:1,
33 a5_3:1,
34 cmsp:1,
35 solsa:1,
36 spare3:1,
37 lcsva_cap:1,
38 spare4:1,
39 cm3:1;
40} __attribute__ ((packed));
41
42/* Chapter 10.5.2.1b.3 */
43struct gsm48_range_1024 {
44 uint8_t w1_hi:2,
45 f0:1,
46 form_id:5;
47 uint8_t w1_lo;
48 uint8_t w2_hi;
49 uint8_t w3_hi:7,
50 w2_lo:1;
51 uint8_t w4_hi:6,
52 w3_lo:2;
53 uint8_t w5_hi:6,
54 w4_lo:2;
55 uint8_t w6_hi:6,
56 w5_lo:2;
57 uint8_t w7_hi:6,
58 w6_lo:2;
59 uint8_t w8_hi:6,
60 w7_lo:2;
61 uint8_t w9:7,
62 w8_lo:1;
63 uint8_t w11_hi:1,
64 w10:7;
65 uint8_t w12_hi:2,
66 w11_lo:6;
67 uint8_t w13_hi:3,
68 w12_lo:5;
69 uint8_t w14_hi:4,
70 w13_lo:4;
71 uint8_t w15_hi:5,
72 w14_lo:3;
73 uint8_t w16:6,
74 w15_lo:2;
75} __attribute__ ((packed));
76
77/* Chapter 10.5.2.1b.4 */
78struct gsm48_range_512 {
79 uint8_t orig_arfcn_hi:1,
80 form_id:7;
81 uint8_t orig_arfcn_mid;
82 uint8_t w1_hi:7,
83 orig_arfcn_lo:1;
84 uint8_t w2_hi:6,
85 w1_lo:2;
86 uint8_t w3_hi:6,
87 w2_lo:2;
88 uint8_t w4_hi:6,
89 w3_lo:2;
90 uint8_t w5:7,
91 w4_lo:1;
92 uint8_t w7_hi:1,
93 w6:7;
94 uint8_t w8_hi:2,
95 w7_lo:6;
96 uint8_t w9_hi:4,
97 w8_lo:4;
98 uint8_t w10:6,
99 w9_lo:2;
100 uint8_t w12_hi:2,
101 w11:6;
102 uint8_t w13_hi:4,
103 w12_lo:4;
104 uint8_t w14:6,
105 w13_lo:2;
106 uint8_t w16_hi:2,
107 w15:6;
108 uint8_t w17:5,
109 w16_lo:3;
110} __attribute__ ((packed));
111
112/* Chapter 10.5.2.1b.5 */
113struct gsm48_range_256 {
114 uint8_t orig_arfcn_hi:1,
115 form_id:7;
116 uint8_t orig_arfcn_mid;
117 uint8_t w1_hi:7,
118 orig_arfcn_lo:1;
119 uint8_t w2:7,
120 w1_lo:1;
121 uint8_t w4_hi:1,
122 w3:7;
123 uint8_t w5_hi:3,
124 w4_lo:5;
125 uint8_t w6_hi:5,
126 w5_lo:3;
127 uint8_t w8_hi:1,
128 w7:6,
129 w6_lo:1;
130 uint8_t w9_hi:4,
131 w8_lo:4;
132 uint8_t w11_hi:2,
133 w10:5,
134 w9_lo:1;
135 uint8_t w12:5,
136 w11_lo:3;
137 uint8_t w14_hi:3,
138 w13:5;
139 uint8_t w16_hi:1,
140 w15:5,
141 w14_lo:2;
142 uint8_t w18_hi:1,
143 w17:4,
144 w16_lo:3;
145 uint8_t w20_hi:1,
146 w19:4,
147 w18_lo:3;
148 uint8_t spare:1,
149 w21:4,
150 w20_lo:3;
151} __attribute__ ((packed));
152
153/* Chapter 10.5.2.1b.6 */
154struct gsm48_range_128 {
155 uint8_t orig_arfcn_hi:1,
156 form_id:7;
157 uint8_t orig_arfcn_mid;
158 uint8_t w1:7,
159 orig_arfcn_lo:1;
160 uint8_t w3_hi:2,
161 w2:6;
162 uint8_t w4_hi:4,
163 w3_lo:4;
164 uint8_t w6_hi:2,
165 w5:5,
166 w4_lo:1;
167 uint8_t w7:5,
168 w6_lo:3;
169 uint8_t w9:4,
170 w8:4;
171 uint8_t w11:4,
172 w10:4;
173 uint8_t w13:4,
174 w12:4;
175 uint8_t w15:4,
176 w14:4;
177 uint8_t w18_hi:2,
178 w17:3,
179 w16:3;
180 uint8_t w21_hi:1,
181 w20:3,
182 w19:3,
183 w18_lo:1;
184 uint8_t w23:3,
185 w22:3,
186 w21_lo:2;
187 uint8_t w26_hi:2,
188 w25:3,
189 w24:3;
190 uint8_t spare:1,
191 w28:3,
192 w27:3,
193 w26_lo:1;
194} __attribute__ ((packed));
195
196/* Chapter 10.5.2.1b.7 */
197struct gsm48_var_bit {
198 uint8_t orig_arfcn_hi:1,
199 form_id:7;
200 uint8_t orig_arfcn_mid;
201 uint8_t rrfcn1_7:7,
202 orig_arfcn_lo:1;
203 uint8_t rrfcn8_111[13];
Harald Welteec8b4502010-02-20 20:34:29 +0100204} __attribute__ ((packed));
205
206/* Chapter 10.5.2.5 */
207struct gsm48_chan_desc {
208 uint8_t chan_nr;
209 union {
210 struct {
211 uint8_t maio_high:4,
212 h:1,
213 tsc:3;
214 uint8_t hsn:6,
215 maio_low:2;
216 } h1;
217 struct {
218 uint8_t arfcn_high:2,
219 spare:2,
220 h:1,
221 tsc:3;
222 uint8_t arfcn_low;
223 } h0;
224 };
225} __attribute__ ((packed));
226
Andreas Eversberg014cb872010-07-12 09:11:00 +0200227/* Chapter 10.5.2.20 */
228struct gsm48_meas_res {
229 uint8_t rxlev_full:6,
230 dtx_used:1,
231 ba_used:1;
232 uint8_t rxlev_sub:6,
233 meas_valid:1,
234 spare:1;
235 uint8_t no_nc_n_hi:1,
236 rxqual_sub:3,
237 rxqual_full:3,
238 spare2:1;
239 uint8_t rxlev_nc1:6,
240 no_nc_n_lo:2;
241 uint8_t bsic_nc1_hi:3,
242 bcch_f_nc1:5;
243 uint8_t rxlev_nc2_hi:5,
244 bsic_nc1_lo:3;
245 uint8_t bsic_nc2_hi:2,
246 bcch_f_nc2:5,
247 rxlev_nc2_lo:1;
248 uint8_t rxlev_nc3_hi:4,
249 bsic_nc2_lo:4;
250 uint8_t bsic_nc3_hi:1,
251 bcch_f_nc3:5,
252 rxlev_nc3_lo:2;
253 uint8_t rxlev_nc4_hi:3,
254 bsic_nc3_lo:5;
255 uint8_t bcch_f_nc4:5,
256 rxlev_nc4_lo:3;
257 uint8_t rxlev_nc5_hi:2,
258 bsic_nc4:6;
259 uint8_t bcch_f_nc5_hi:4,
260 rxlev_nc5_lo:4;
261 uint8_t rxlev_nc6_hi:1,
262 bsic_nc5:6,
263 bcch_f_nc5_lo:1;
264 uint8_t bcch_f_nc6_hi:3,
265 rxlev_nc6_lo:5;
266 uint8_t bsic_nc6:6,
267 bcch_f_nc6_lo:2;
268} __attribute__ ((packed));
269
Harald Welteec8b4502010-02-20 20:34:29 +0100270/* Chapter 10.5.2.21aa */
271struct gsm48_multi_rate_conf {
272 uint8_t smod : 2,
273 spare: 1,
274 icmi : 1,
275 nscb : 1,
276 ver : 3;
277 uint8_t m4_75 : 1,
278 m5_15 : 1,
279 m5_90 : 1,
280 m6_70 : 1,
281 m7_40 : 1,
282 m7_95 : 1,
283 m10_2 : 1,
284 m12_2 : 1;
285} __attribute__((packed));
286
Andreas Eversberg014cb872010-07-12 09:11:00 +0200287/* Chapter 10.5.2.28(a) */
288struct gsm48_power_cmd {
289 uint8_t power_level:5,
290 spare:2,
291 atc:1;
292} __attribute__((packed));
293
294/* Chapter 10.5.2.29 */
295struct gsm48_rach_control {
296 uint8_t re :1,
297 cell_bar :1,
298 tx_integer :4,
299 max_trans :2;
300 uint8_t t2;
301 uint8_t t3;
302} __attribute__ ((packed));
303
304
Harald Welteec8b4502010-02-20 20:34:29 +0100305/* Chapter 10.5.2.30 */
306struct gsm48_req_ref {
307 uint8_t ra;
308 uint8_t t3_high:3,
Andreas Eversberg93364fc2010-06-25 02:50:06 +0200309 t1:5;
Harald Welteec8b4502010-02-20 20:34:29 +0100310 uint8_t t2:5,
311 t3_low:3;
312} __attribute__ ((packed));
313
Andreas Eversberg014cb872010-07-12 09:11:00 +0200314/* Chapter 10.5.2.38 */
315struct gsm48_start_time {
316 uint8_t t3_high:3,
317 t1:5;
318 uint8_t t2:5,
319 t3_low:3;
320} __attribute__ ((packed));
321
322/* Chapter 10.5.2.39 */
323struct gsm48_sync_ind {
324 uint8_t si:2,
325 rot:1,
326 nci:1,
327 sync_ie:4;
328} __attribute__((packed));
329
Harald Welteec8b4502010-02-20 20:34:29 +0100330/*
331 * Chapter 9.1.5/9.1.6
332 *
333 * For 9.1.6 the chan_desc has the meaning of 10.5.2.5a
334 */
335struct gsm48_chan_mode_modify {
336 struct gsm48_chan_desc chan_desc;
337 uint8_t mode;
338} __attribute__ ((packed));
339
340enum gsm48_chan_mode {
341 GSM48_CMODE_SIGN = 0x00,
342 GSM48_CMODE_SPEECH_V1 = 0x01,
343 GSM48_CMODE_SPEECH_EFR = 0x21,
344 GSM48_CMODE_SPEECH_AMR = 0x41,
345 GSM48_CMODE_DATA_14k5 = 0x0f,
346 GSM48_CMODE_DATA_12k0 = 0x03,
347 GSM48_CMODE_DATA_6k0 = 0x0b,
348 GSM48_CMODE_DATA_3k6 = 0x23,
349};
350
351/* Chapter 9.1.2 */
352struct gsm48_ass_cmd {
353 /* Semantic is from 10.5.2.5a */
354 struct gsm48_chan_desc chan_desc;
355 uint8_t power_command;
356 uint8_t data[0];
357} __attribute__((packed));
358
359/* Chapter 10.5.2.2 */
360struct gsm48_cell_desc {
361 uint8_t bcc:3,
362 ncc:3,
363 arfcn_hi:2;
364 uint8_t arfcn_lo;
365} __attribute__((packed));
366
367/* Chapter 9.1.15 */
368struct gsm48_ho_cmd {
369 struct gsm48_cell_desc cell_desc;
370 struct gsm48_chan_desc chan_desc;
371 uint8_t ho_ref;
372 uint8_t power_command;
373 uint8_t data[0];
374} __attribute__((packed));
375
376/* Chapter 9.1.18 */
377struct gsm48_imm_ass {
378 uint8_t l2_plen;
379 uint8_t proto_discr;
380 uint8_t msg_type;
381 uint8_t page_mode;
382 struct gsm48_chan_desc chan_desc;
383 struct gsm48_req_ref req_ref;
384 uint8_t timing_advance;
385 uint8_t mob_alloc_len;
386 uint8_t mob_alloc[0];
387} __attribute__ ((packed));
388
Holger Hans Peter Freyther5dcef3c2010-05-15 22:35:25 +0800389/* Chapter 9.1.25 */
390struct gsm48_pag_resp {
391 uint8_t spare:4,
392 key_seq:4;
393 uint32_t classmark2;
394 uint8_t mi_len;
395 uint8_t mi[0];
396} __attribute__ ((packed));
397
Harald Welteec8b4502010-02-20 20:34:29 +0100398/* Chapter 10.5.1.3 */
399struct gsm48_loc_area_id {
400 uint8_t digits[3]; /* BCD! */
401 uint16_t lac;
402} __attribute__ ((packed));
403
404/* Section 9.2.2 */
405struct gsm48_auth_req {
406 uint8_t key_seq:4,
407 spare:4;
408 uint8_t rand[16];
409} __attribute__ ((packed));
410
Sylvain Munautd005eab2010-06-10 13:30:50 +0200411/* Section 9.2.3 */
412struct gsm48_auth_resp {
413 uint8_t sres[4];
414} __attribute__ ((packed));
415
Harald Welteec8b4502010-02-20 20:34:29 +0100416/* Section 9.2.15 */
417struct gsm48_loc_upd_req {
418 uint8_t type:4,
419 key_seq:4;
420 struct gsm48_loc_area_id lai;
421 struct gsm48_classmark1 classmark1;
422 uint8_t mi_len;
423 uint8_t mi[0];
424} __attribute__ ((packed));
425
426/* Section 10.1 */
427struct gsm48_hdr {
428 uint8_t proto_discr;
429 uint8_t msg_type;
430 uint8_t data[0];
431} __attribute__ ((packed));
432
433/* Section 9.1.3x System information Type header */
434struct gsm48_system_information_type_header {
435 uint8_t l2_plen;
436 uint8_t rr_protocol_discriminator :4,
437 skip_indicator:4;
438 uint8_t system_information;
439} __attribute__ ((packed));
440
Harald Welteec8b4502010-02-20 20:34:29 +0100441/* Section 10.5.2.4 Cell Selection Parameters */
442struct gsm48_cell_sel_par {
443 uint8_t ms_txpwr_max_ccch:5, /* GSM 05.08 MS-TXPWR-MAX-CCCH */
444 cell_resel_hyst:3; /* GSM 05.08 CELL-RESELECT-HYSTERESIS */
445 uint8_t rxlev_acc_min:6, /* GSM 05.08 RXLEV-ACCESS-MIN */
446 neci:1,
447 acs:1;
448} __attribute__ ((packed));
449
450/* Section 10.5.2.11 Control Channel Description , Figure 10.5.33 */
451struct gsm48_control_channel_descr {
452 uint8_t ccch_conf :3,
453 bs_ag_blks_res :3,
454 att :1,
455 spare1 :1;
456 uint8_t bs_pa_mfrms : 3,
457 spare2 :5;
458 uint8_t t3212;
459} __attribute__ ((packed));
460
461struct gsm48_cell_options {
462 uint8_t radio_link_timeout:4,
463 dtx:2,
464 pwrc:1,
465 spare:1;
466} __attribute__ ((packed));
467
468/* Section 9.2.9 CM service request */
469struct gsm48_service_request {
470 uint8_t cm_service_type : 4,
471 cipher_key_seq : 4;
472 /* length + 3 bytes */
473 uint32_t classmark;
474 uint8_t mi_len;
475 uint8_t mi[0];
476 /* optional priority level */
477} __attribute__ ((packed));
478
479/* Section 9.1.31 System information Type 1 */
480struct gsm48_system_information_type_1 {
481 struct gsm48_system_information_type_header header;
482 uint8_t cell_channel_description[16];
483 struct gsm48_rach_control rach_control;
484 uint8_t rest_octets[0]; /* NCH position on the CCCH */
485} __attribute__ ((packed));
486
487/* Section 9.1.32 System information Type 2 */
488struct gsm48_system_information_type_2 {
489 struct gsm48_system_information_type_header header;
490 uint8_t bcch_frequency_list[16];
491 uint8_t ncc_permitted;
492 struct gsm48_rach_control rach_control;
493} __attribute__ ((packed));
494
Andreas Eversberg014cb872010-07-12 09:11:00 +0200495/* Section 9.1.33 System information Type 2bis */
496struct gsm48_system_information_type_2bis {
497 struct gsm48_system_information_type_header header;
498 uint8_t bcch_frequency_list[16];
499 struct gsm48_rach_control rach_control;
500 uint8_t rest_octets[0];
501} __attribute__ ((packed));
502
503/* Section 9.1.34 System information Type 2ter */
504struct gsm48_system_information_type_2ter {
505 struct gsm48_system_information_type_header header;
506 uint8_t ext_bcch_frequency_list[16];
507 uint8_t rest_octets[0];
508} __attribute__ ((packed));
509
Harald Welteec8b4502010-02-20 20:34:29 +0100510/* Section 9.1.35 System information Type 3 */
511struct gsm48_system_information_type_3 {
512 struct gsm48_system_information_type_header header;
513 uint16_t cell_identity;
514 struct gsm48_loc_area_id lai;
515 struct gsm48_control_channel_descr control_channel_desc;
516 struct gsm48_cell_options cell_options;
517 struct gsm48_cell_sel_par cell_sel_par;
518 struct gsm48_rach_control rach_control;
519 uint8_t rest_octets[0];
520} __attribute__ ((packed));
521
522/* Section 9.1.36 System information Type 4 */
523struct gsm48_system_information_type_4 {
524 struct gsm48_system_information_type_header header;
525 struct gsm48_loc_area_id lai;
526 struct gsm48_cell_sel_par cell_sel_par;
527 struct gsm48_rach_control rach_control;
528 /* optional CBCH conditional CBCH... followed by
529 mandantory SI 4 Reset Octets
530 */
531 uint8_t data[0];
532} __attribute__ ((packed));
533
534/* Section 9.1.37 System information Type 5 */
535struct gsm48_system_information_type_5 {
536 uint8_t rr_protocol_discriminator :4,
537 skip_indicator:4;
538 uint8_t system_information;
539 uint8_t bcch_frequency_list[16];
540} __attribute__ ((packed));
541
Andreas Eversberg014cb872010-07-12 09:11:00 +0200542/* Section 9.1.38 System information Type 5bis */
543struct gsm48_system_information_type_5bis {
544 uint8_t rr_protocol_discriminator :4,
545 skip_indicator:4;
546 uint8_t system_information;
547 uint8_t bcch_frequency_list[16];
548} __attribute__ ((packed));
549
550/* Section 9.1.39 System information Type 5ter */
551struct gsm48_system_information_type_5ter {
552 uint8_t rr_protocol_discriminator :4,
553 skip_indicator:4;
554 uint8_t system_information;
555 uint8_t bcch_frequency_list[16];
556} __attribute__ ((packed));
557
Harald Welteec8b4502010-02-20 20:34:29 +0100558/* Section 9.1.40 System information Type 6 */
559struct gsm48_system_information_type_6 {
560 uint8_t rr_protocol_discriminator :4,
561 skip_indicator:4;
562 uint8_t system_information;
563 uint16_t cell_identity;
564 struct gsm48_loc_area_id lai;
565 struct gsm48_cell_options cell_options;
566 uint8_t ncc_permitted;
567 uint8_t rest_octets[0];
568} __attribute__ ((packed));
569
570/* Section 9.1.43a System Information type 13 */
571struct gsm48_system_information_type_13 {
572 struct gsm48_system_information_type_header header;
573 uint8_t rest_octets[0];
574} __attribute__ ((packed));
575
576/* Section 9.2.12 IMSI Detach Indication */
577struct gsm48_imsi_detach_ind {
578 struct gsm48_classmark1 classmark1;
579 uint8_t mi_len;
580 uint8_t mi[0];
581} __attribute__ ((packed));
582
Andreas Eversberg014cb872010-07-12 09:11:00 +0200583/* Section 9.1.1 */
584struct gsm48_add_ass {
585 /* Semantic is from 10.5.2.5 */
586 struct gsm48_chan_desc chan_desc;
587 uint8_t data[0];
588} __attribute__((packed));
589
590/* Section 9.1.3 */
591struct gsm48_ass_cpl {
592 uint8_t rr_cause;
593} __attribute__((packed));
594
595/* Section 9.1.4 */
596struct gsm48_ass_fail {
597 uint8_t rr_cause;
598} __attribute__((packed));
599
600/* Section 9.1.7 */
601struct gsm48_chan_rel {
602 uint8_t rr_cause;
603 uint8_t data[0];
604} __attribute__((packed));
605
606/* Section 9.1.9 */
607struct gsm48_cip_mode_cmd {
608 uint8_t sc:1,
609 alg_id:3,
610 spare:3,
611 cr:1;
612} __attribute__((packed));
613
614/* Section 9.1.11 */
615struct gsm48_cm_change {
616 uint8_t cm2_len;
617 struct gsm48_classmark2 cm2;
618 uint8_t data[0];
619} __attribute__((packed));
620
621/* Section 9.1.19 */
622struct gsm48_imm_ass_ext {
623 uint8_t l2_plen;
624 uint8_t proto_discr;
625 uint8_t msg_type;
626 uint8_t page_mode;
627 struct gsm48_chan_desc chan_desc1;
628 struct gsm48_req_ref req_ref1;
629 uint8_t timing_advance1;
630 struct gsm48_chan_desc chan_desc2;
631 struct gsm48_req_ref req_ref2;
632 uint8_t timing_advance2;
633 uint8_t mob_alloc_len;
634 uint8_t mob_alloc[0];
635} __attribute__ ((packed));
636
637/* Section 9.1.20 */
638struct gsm48_imm_ass_rej {
639 uint8_t l2_plen;
640 uint8_t proto_discr;
641 uint8_t msg_type;
642 uint8_t page_mode;
643 struct gsm48_req_ref req_ref1;
644 uint8_t wait_ind1;
645 struct gsm48_req_ref req_ref2;
646 uint8_t wait_ind2;
647 struct gsm48_req_ref req_ref3;
648 uint8_t wait_ind3;
649 struct gsm48_req_ref req_ref4;
650 uint8_t wait_ind4;
651 uint8_t rest[0];
652} __attribute__ ((packed));
653
654/* Section 9.1.22 */
655struct gsm48_paging1 {
656 uint8_t l2_plen;
657 uint8_t proto_discr;
658 uint8_t msg_type;
659 uint8_t pag_mode:2,
660 spare:2,
661 cneed1:2,
662 cneed2:2;
663 uint8_t data[0];
664} __attribute__((packed));
665
666/* Section 9.1.23 */
667struct gsm48_paging2 {
668 uint8_t l2_plen;
669 uint8_t proto_discr;
670 uint8_t msg_type;
671 uint8_t pag_mode:2,
672 spare:2,
673 cneed1:2,
674 cneed2:2;
675 uint32_t tmsi1;
676 uint32_t tmsi2;
677 uint8_t data[0];
678} __attribute__((packed));
679
680/* Section 9.1.24 */
681struct gsm48_paging3 {
682 uint8_t l2_plen;
683 uint8_t proto_discr;
684 uint8_t msg_type;
685 uint8_t pag_mode:2,
686 spare:2,
687 cneed1:2,
688 cneed2:2;
689 uint32_t tmsi1;
690 uint32_t tmsi2;
691 uint32_t tmsi3;
692 uint32_t tmsi4;
693 uint8_t cneed3:2,
694 cneed4:2,
695 spare2:4;
696 uint8_t rest[0];
697} __attribute__((packed));
698
699/* Section 9.1.25 */
700struct gsm48_pag_rsp {
701 uint8_t key_seq:3,
702 spare:5;
703 uint8_t cm2_len;
704 struct gsm48_classmark2 cm2;
705 uint8_t data[0];
706} __attribute__((packed));
707
708/* Section 9.1.29 */
709struct gsm48_rr_status {
710 uint8_t rr_cause;
711} __attribute__((packed));
712
Harald Welteec8b4502010-02-20 20:34:29 +0100713/* Section 10.2 + GSM 04.07 12.2.3.1.1 */
714#define GSM48_PDISC_GROUP_CC 0x00
715#define GSM48_PDISC_BCAST_CC 0x01
716#define GSM48_PDISC_PDSS1 0x02
717#define GSM48_PDISC_CC 0x03
718#define GSM48_PDISC_PDSS2 0x04
719#define GSM48_PDISC_MM 0x05
720#define GSM48_PDISC_RR 0x06
721#define GSM48_PDISC_MM_GPRS 0x08
722#define GSM48_PDISC_SMS 0x09
723#define GSM48_PDISC_SM_GPRS 0x0a
724#define GSM48_PDISC_NC_SS 0x0b
725#define GSM48_PDISC_LOC 0x0c
726#define GSM48_PDISC_MASK 0x0f
727#define GSM48_PDISC_USSD 0x11
728
729/* Section 10.4 */
730#define GSM48_MT_RR_INIT_REQ 0x3c
731#define GSM48_MT_RR_ADD_ASS 0x3b
732#define GSM48_MT_RR_IMM_ASS 0x3f
733#define GSM48_MT_RR_IMM_ASS_EXT 0x39
734#define GSM48_MT_RR_IMM_ASS_REJ 0x3a
735
736#define GSM48_MT_RR_CIPH_M_CMD 0x35
737#define GSM48_MT_RR_CIPH_M_COMPL 0x32
738
739#define GSM48_MT_RR_CFG_CHG_CMD 0x30
740#define GSM48_MT_RR_CFG_CHG_ACK 0x31
741#define GSM48_MT_RR_CFG_CHG_REJ 0x33
742
743#define GSM48_MT_RR_ASS_CMD 0x2e
744#define GSM48_MT_RR_ASS_COMPL 0x29
745#define GSM48_MT_RR_ASS_FAIL 0x2f
746#define GSM48_MT_RR_HANDO_CMD 0x2b
747#define GSM48_MT_RR_HANDO_COMPL 0x2c
748#define GSM48_MT_RR_HANDO_FAIL 0x28
749#define GSM48_MT_RR_HANDO_INFO 0x2d
750
751#define GSM48_MT_RR_CELL_CHG_ORDER 0x08
752#define GSM48_MT_RR_PDCH_ASS_CMD 0x23
753
754#define GSM48_MT_RR_CHAN_REL 0x0d
755#define GSM48_MT_RR_PART_REL 0x0a
756#define GSM48_MT_RR_PART_REL_COMP 0x0f
757
758#define GSM48_MT_RR_PAG_REQ_1 0x21
759#define GSM48_MT_RR_PAG_REQ_2 0x22
760#define GSM48_MT_RR_PAG_REQ_3 0x24
761#define GSM48_MT_RR_PAG_RESP 0x27
762#define GSM48_MT_RR_NOTIF_NCH 0x20
763#define GSM48_MT_RR_NOTIF_FACCH 0x25
764#define GSM48_MT_RR_NOTIF_RESP 0x26
765
766#define GSM48_MT_RR_SYSINFO_8 0x18
767#define GSM48_MT_RR_SYSINFO_1 0x19
768#define GSM48_MT_RR_SYSINFO_2 0x1a
769#define GSM48_MT_RR_SYSINFO_3 0x1b
770#define GSM48_MT_RR_SYSINFO_4 0x1c
771#define GSM48_MT_RR_SYSINFO_5 0x1d
772#define GSM48_MT_RR_SYSINFO_6 0x1e
773#define GSM48_MT_RR_SYSINFO_7 0x1f
774
775#define GSM48_MT_RR_SYSINFO_2bis 0x02
776#define GSM48_MT_RR_SYSINFO_2ter 0x03
777#define GSM48_MT_RR_SYSINFO_5bis 0x05
778#define GSM48_MT_RR_SYSINFO_5ter 0x06
779#define GSM48_MT_RR_SYSINFO_9 0x04
780#define GSM48_MT_RR_SYSINFO_13 0x00
781
782#define GSM48_MT_RR_SYSINFO_16 0x3d
783#define GSM48_MT_RR_SYSINFO_17 0x3e
784
785#define GSM48_MT_RR_CHAN_MODE_MODIF 0x10
786#define GSM48_MT_RR_STATUS 0x12
787#define GSM48_MT_RR_CHAN_MODE_MODIF_ACK 0x17
788#define GSM48_MT_RR_FREQ_REDEF 0x14
789#define GSM48_MT_RR_MEAS_REP 0x15
790#define GSM48_MT_RR_CLSM_CHG 0x16
791#define GSM48_MT_RR_CLSM_ENQ 0x13
792#define GSM48_MT_RR_EXT_MEAS_REP 0x36
793#define GSM48_MT_RR_EXT_MEAS_REP_ORD 0x37
794#define GSM48_MT_RR_GPRS_SUSP_REQ 0x34
795
796#define GSM48_MT_RR_VGCS_UPL_GRANT 0x08
797#define GSM48_MT_RR_UPLINK_RELEASE 0x0e
798#define GSM48_MT_RR_UPLINK_FREE 0x0c
799#define GSM48_MT_RR_UPLINK_BUSY 0x2a
800#define GSM48_MT_RR_TALKER_IND 0x11
801
802#define GSM48_MT_RR_APP_INFO 0x38
803
804/* Table 10.2/3GPP TS 04.08 */
805#define GSM48_MT_MM_IMSI_DETACH_IND 0x01
806#define GSM48_MT_MM_LOC_UPD_ACCEPT 0x02
807#define GSM48_MT_MM_LOC_UPD_REJECT 0x04
808#define GSM48_MT_MM_LOC_UPD_REQUEST 0x08
809
810#define GSM48_MT_MM_AUTH_REJ 0x11
811#define GSM48_MT_MM_AUTH_REQ 0x12
812#define GSM48_MT_MM_AUTH_RESP 0x14
813#define GSM48_MT_MM_ID_REQ 0x18
814#define GSM48_MT_MM_ID_RESP 0x19
815#define GSM48_MT_MM_TMSI_REALL_CMD 0x1a
816#define GSM48_MT_MM_TMSI_REALL_COMPL 0x1b
817
818#define GSM48_MT_MM_CM_SERV_ACC 0x21
819#define GSM48_MT_MM_CM_SERV_REJ 0x22
820#define GSM48_MT_MM_CM_SERV_ABORT 0x23
821#define GSM48_MT_MM_CM_SERV_REQ 0x24
822#define GSM48_MT_MM_CM_SERV_PROMPT 0x25
823#define GSM48_MT_MM_CM_REEST_REQ 0x28
824#define GSM48_MT_MM_ABORT 0x29
825
826#define GSM48_MT_MM_NULL 0x30
827#define GSM48_MT_MM_STATUS 0x31
828#define GSM48_MT_MM_INFO 0x32
829
830/* Table 10.3/3GPP TS 04.08 */
831#define GSM48_MT_CC_ALERTING 0x01
832#define GSM48_MT_CC_CALL_CONF 0x08
833#define GSM48_MT_CC_CALL_PROC 0x02
834#define GSM48_MT_CC_CONNECT 0x07
835#define GSM48_MT_CC_CONNECT_ACK 0x0f
836#define GSM48_MT_CC_EMERG_SETUP 0x0e
837#define GSM48_MT_CC_PROGRESS 0x03
838#define GSM48_MT_CC_ESTAB 0x04
839#define GSM48_MT_CC_ESTAB_CONF 0x06
840#define GSM48_MT_CC_RECALL 0x0b
841#define GSM48_MT_CC_START_CC 0x09
842#define GSM48_MT_CC_SETUP 0x05
843
844#define GSM48_MT_CC_MODIFY 0x17
845#define GSM48_MT_CC_MODIFY_COMPL 0x1f
846#define GSM48_MT_CC_MODIFY_REJECT 0x13
847#define GSM48_MT_CC_USER_INFO 0x10
848#define GSM48_MT_CC_HOLD 0x18
849#define GSM48_MT_CC_HOLD_ACK 0x19
850#define GSM48_MT_CC_HOLD_REJ 0x1a
851#define GSM48_MT_CC_RETR 0x1c
852#define GSM48_MT_CC_RETR_ACK 0x1d
853#define GSM48_MT_CC_RETR_REJ 0x1e
854
855#define GSM48_MT_CC_DISCONNECT 0x25
856#define GSM48_MT_CC_RELEASE 0x2d
857#define GSM48_MT_CC_RELEASE_COMPL 0x2a
858
859#define GSM48_MT_CC_CONG_CTRL 0x39
860#define GSM48_MT_CC_NOTIFY 0x3e
861#define GSM48_MT_CC_STATUS 0x3d
862#define GSM48_MT_CC_STATUS_ENQ 0x34
863#define GSM48_MT_CC_START_DTMF 0x35
864#define GSM48_MT_CC_STOP_DTMF 0x31
865#define GSM48_MT_CC_STOP_DTMF_ACK 0x32
866#define GSM48_MT_CC_START_DTMF_ACK 0x36
867#define GSM48_MT_CC_START_DTMF_REJ 0x37
868#define GSM48_MT_CC_FACILITY 0x3a
869
870/* FIXME: Table 10.4 / 10.4a (GPRS) */
871
Andreas Eversberg014cb872010-07-12 09:11:00 +0200872/* Section 10.5.3.3 CM service type */
873#define GSM48_CMSERV_MO_CALL_PACKET 1
874#define GSM48_CMSERV_EMERGENCY 2
875#define GSM48_CMSERV_SMS 4
876#define GSM48_CMSERV_SUP_SERV 8
877#define GSM48_CMSERV_VGCS 9
878#define GSM48_CMSERV_VBS 10
879#define GSM48_CMSERV_LOC_SERV 11
880
Harald Welteec8b4502010-02-20 20:34:29 +0100881/* Section 10.5.2.26, Table 10.5.64 */
882#define GSM48_PM_MASK 0x03
883#define GSM48_PM_NORMAL 0x00
884#define GSM48_PM_EXTENDED 0x01
885#define GSM48_PM_REORG 0x02
886#define GSM48_PM_SAME 0x03
887
888/* Chapter 10.5.3.5 / Table 10.5.93 */
889#define GSM48_LUPD_NORMAL 0x0
890#define GSM48_LUPD_PERIODIC 0x1
891#define GSM48_LUPD_IMSI_ATT 0x2
892#define GSM48_LUPD_RESERVED 0x3
893
894/* Table 10.5.4 */
895#define GSM_MI_TYPE_MASK 0x07
896#define GSM_MI_TYPE_NONE 0x00
897#define GSM_MI_TYPE_IMSI 0x01
898#define GSM_MI_TYPE_IMEI 0x02
899#define GSM_MI_TYPE_IMEISV 0x03
900#define GSM_MI_TYPE_TMSI 0x04
901#define GSM_MI_ODD 0x08
902
Andreas Eversberg014cb872010-07-12 09:11:00 +0200903#define GSM48_IE_MOBILE_ID 0x17 /* 10.5.1.4 */
Harald Welteec8b4502010-02-20 20:34:29 +0100904#define GSM48_IE_NAME_LONG 0x43 /* 10.5.3.5a */
905#define GSM48_IE_NAME_SHORT 0x45 /* 10.5.3.5a */
906#define GSM48_IE_UTC 0x46 /* 10.5.3.8 */
907#define GSM48_IE_NET_TIME_TZ 0x47 /* 10.5.3.9 */
908#define GSM48_IE_LSA_IDENT 0x48 /* 10.5.3.11 */
909
910#define GSM48_IE_BEARER_CAP 0x04 /* 10.5.4.5 */
911#define GSM48_IE_CAUSE 0x08 /* 10.5.4.11 */
912#define GSM48_IE_CC_CAP 0x15 /* 10.5.4.5a */
913#define GSM48_IE_ALERT 0x19 /* 10.5.4.26 */
914#define GSM48_IE_FACILITY 0x1c /* 10.5.4.15 */
915#define GSM48_IE_PROGR_IND 0x1e /* 10.5.4.21 */
916#define GSM48_IE_AUX_STATUS 0x24 /* 10.5.4.4 */
917#define GSM48_IE_NOTIFY 0x27 /* 10.5.4.20 */
918#define GSM48_IE_KPD_FACILITY 0x2c /* 10.5.4.17 */
919#define GSM48_IE_SIGNAL 0x34 /* 10.5.4.23 */
920#define GSM48_IE_CONN_BCD 0x4c /* 10.5.4.13 */
921#define GSM48_IE_CONN_SUB 0x4d /* 10.5.4.14 */
922#define GSM48_IE_CALLING_BCD 0x5c /* 10.5.4.9 */
923#define GSM48_IE_CALLING_SUB 0x5d /* 10.5.4.10 */
924#define GSM48_IE_CALLED_BCD 0x5e /* 10.5.4.7 */
925#define GSM48_IE_CALLED_SUB 0x6d /* 10.5.4.8 */
926#define GSM48_IE_REDIR_BCD 0x74 /* 10.5.4.21a */
927#define GSM48_IE_REDIR_SUB 0x75 /* 10.5.4.21b */
928#define GSM48_IE_LOWL_COMPAT 0x7c /* 10.5.4.18 */
929#define GSM48_IE_HIGHL_COMPAT 0x7d /* 10.5.4.16 */
930#define GSM48_IE_USER_USER 0x7e /* 10.5.4.25 */
931#define GSM48_IE_SS_VERS 0x7f /* 10.5.4.24 */
932#define GSM48_IE_MORE_DATA 0xa0 /* 10.5.4.19 */
933#define GSM48_IE_CLIR_SUPP 0xa1 /* 10.5.4.11a */
934#define GSM48_IE_CLIR_INVOC 0xa2 /* 10.5.4.11b */
935#define GSM48_IE_REV_C_SETUP 0xa3 /* 10.5.4.22a */
936#define GSM48_IE_REPEAT_CIR 0xd1 /* 10.5.4.22 */
937#define GSM48_IE_REPEAT_SEQ 0xd3 /* 10.5.4.22 */
938
939/* Section 10.5.4.11 / Table 10.5.122 */
940#define GSM48_CAUSE_CS_GSM 0x60
941
942/* Section 9.1.2 / Table 9.3 */
Andreas Eversberg014cb872010-07-12 09:11:00 +0200943/* RR elements */
944#define GSM48_IE_VGCS_TARGET 0x01
945//#define GSM48_IE_VGCS_T_MODE_I 0x01
946#define GSM48_IE_FRQSHORT_AFTER 0x02
947#define GSM48_IE_MUL_RATE_CFG 0x03 /* 10.5.2.21aa */
948#define GSM48_IE_FREQ_L_AFTER 0x05
Harald Welteec8b4502010-02-20 20:34:29 +0100949#define GSM48_IE_MSLOT_DESC 0x10
Harald Welteec8b4502010-02-20 20:34:29 +0100950#define GSM48_IE_CHANMODE_2 0x11
Andreas Eversberg014cb872010-07-12 09:11:00 +0200951#define GSM48_IE_FRQSHORT_BEFORE 0x12
952//#define GSM48_IE_FRQSHORT_BEFOR 0x12
Harald Welteec8b4502010-02-20 20:34:29 +0100953#define GSM48_IE_CHANMODE_3 0x13
954#define GSM48_IE_CHANMODE_4 0x14
955#define GSM48_IE_CHANMODE_5 0x15
956#define GSM48_IE_CHANMODE_6 0x16
957#define GSM48_IE_CHANMODE_7 0x17
958#define GSM48_IE_CHANMODE_8 0x18
959#define GSM48_IE_CHANDESC_2 0x64
Harald Welte639f74b2010-06-15 09:32:14 +0200960#define GSM48_IE_MA_AFTER 0x72
961#define GSM48_IE_START_TIME 0x7c
962#define GSM48_IE_FREQ_L_BEFORE 0x19
Andreas Eversberg014cb872010-07-12 09:11:00 +0200963//#define GSM48_IE_FRQLIST_BEFORE 0x19
Harald Welte639f74b2010-06-15 09:32:14 +0200964#define GSM48_IE_CH_DESC_1_BEFORE 0x1c
Andreas Eversberg014cb872010-07-12 09:11:00 +0200965//#define GSM48_IE_CHDES_1_BEFORE 0x1c
Harald Welte639f74b2010-06-15 09:32:14 +0200966#define GSM48_IE_CH_DESC_2_BEFORE 0x1d
Andreas Eversberg014cb872010-07-12 09:11:00 +0200967//#define GSM48_IE_CHDES_2_BEFORE 0x1d
Harald Welte639f74b2010-06-15 09:32:14 +0200968#define GSM48_IE_F_CH_SEQ_BEFORE 0x1e
Andreas Eversberg014cb872010-07-12 09:11:00 +0200969//#define GSM48_IE_FRQSEQ_BEFORE 0x1e
970#define GSM48_IE_CLASSMARK3 0x20
Harald Welte639f74b2010-06-15 09:32:14 +0200971#define GSM48_IE_MA_BEFORE 0x21
Andreas Eversberg014cb872010-07-12 09:11:00 +0200972#define GSM48_IE_RR_PACKET_UL 0x22
973#define GSM48_IE_RR_PACKET_DL 0x23
974#define GSM48_IE_CELL_CH_DESC 0x62
975#define GSM48_IE_CHANMODE_1 0x63
976#define GSM48_IE_CHDES_2_AFTER 0x64
977#define GSM48_IE_MODE_SEC_CH 0x66
978#define GSM48_IE_F_CH_SEQ_AFTER 0x69
979#define GSM48_IE_MA_AFTER 0x72
980#define GSM48_IE_BA_RANGE 0x73
981#define GSM48_IE_GROUP_CHDES 0x74
982#define GSM48_IE_BA_LIST_PREF 0x75
983#define GSM48_IE_MOB_OVSERV_DIF 0x77
984#define GSM48_IE_REALTIME_DIFF 0x7b
985#define GSM48_IE_START_TIME 0x7c
986#define GSM48_IE_TIMING_ADVANCE 0x7d
987#define GSM48_IE_GROUP_CIP_SEQ 0x80
988#define GSM48_IE_CIP_MODE_SET 0x90
989#define GSM48_IE_GPRS_RESUMPT 0xc0
990#define GSM48_IE_SYNC_IND 0xd0
991/* System Information 4 (types are equal IEs above) */
992#define GSM48_IE_CBCH_CHAN_DESC 0x64
993#define GSM48_IE_CBCH_MOB_AL 0x72
Harald Welte639f74b2010-06-15 09:32:14 +0200994
Andreas Eversberg014cb872010-07-12 09:11:00 +0200995/* Additional MM elements */
996#define GSM48_IE_LOCATION_AREA 0x13
997#define GSM48_IE_PRIORITY_LEV 0x80
998#define GSM48_IE_FOLLOW_ON_PROC 0xa1
999#define GSM48_IE_CTS_PERMISSION 0xa2
Harald Welteec8b4502010-02-20 20:34:29 +01001000
1001/* Section 10.5.4.23 / Table 10.5.130 */
1002enum gsm48_signal_val {
1003 GSM48_SIGNAL_DIALTONE = 0x00,
1004 GSM48_SIGNAL_RINGBACK = 0x01,
1005 GSM48_SIGNAL_INTERCEPT = 0x02,
1006 GSM48_SIGNAL_NET_CONG = 0x03,
1007 GSM48_SIGNAL_BUSY = 0x04,
1008 GSM48_SIGNAL_CONFIRM = 0x05,
1009 GSM48_SIGNAL_ANSWER = 0x06,
1010 GSM48_SIGNAL_CALL_WAIT = 0x07,
1011 GSM48_SIGNAL_OFF_HOOK = 0x08,
1012 GSM48_SIGNAL_OFF = 0x3f,
1013 GSM48_SIGNAL_ALERT_OFF = 0x4f,
1014};
1015
1016enum gsm48_cause_loc {
1017 GSM48_CAUSE_LOC_USER = 0x00,
1018 GSM48_CAUSE_LOC_PRN_S_LU = 0x01,
1019 GSM48_CAUSE_LOC_PUN_S_LU = 0x02,
1020 GSM48_CAUSE_LOC_TRANS_NET = 0x03,
1021 GSM48_CAUSE_LOC_PUN_S_RU = 0x04,
1022 GSM48_CAUSE_LOC_PRN_S_RU = 0x05,
1023 /* not defined */
1024 GSM48_CAUSE_LOC_INN_NET = 0x07,
1025 GSM48_CAUSE_LOC_NET_BEYOND = 0x0a,
1026};
1027
1028/* Section 10.5.2.31 RR Cause / Table 10.5.70 */
1029enum gsm48_rr_cause {
1030 GSM48_RR_CAUSE_NORMAL = 0x00,
1031 GSM48_RR_CAUSE_ABNORMAL_UNSPEC = 0x01,
1032 GSM48_RR_CAUSE_ABNORMAL_UNACCT = 0x02,
1033 GSM48_RR_CAUSE_ABNORMAL_TIMER = 0x03,
1034 GSM48_RR_CAUSE_ABNORMAL_NOACT = 0x04,
1035 GSM48_RR_CAUSE_PREMPTIVE_REL = 0x05,
1036 GSM48_RR_CAUSE_HNDOVER_IMP = 0x06,
1037 GSM48_RR_CAUSE_CHAN_MODE_UNACCT = 0x07,
1038 GSM48_RR_CAUSE_FREQ_NOT_IMPL = 0x08,
1039 GSM48_RR_CAUSE_CALL_CLEARED = 0x41,
1040 GSM48_RR_CAUSE_SEMANT_INCORR = 0x5f,
1041 GSM48_RR_CAUSE_INVALID_MAND_INF = 0x60,
1042 GSM48_RR_CAUSE_MSG_TYPE_N = 0x61,
1043 GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT= 0x62,
1044 GSM48_RR_CAUSE_COND_IE_ERROR = 0x64,
1045 GSM48_RR_CAUSE_NO_CELL_ALLOC_A = 0x65,
1046 GSM48_RR_CAUSE_PROT_ERROR_UNSPC = 0x6f,
1047};
1048
1049/* Section 10.5.4.11 CC Cause / Table 10.5.123 */
1050enum gsm48_cc_cause {
1051 GSM48_CC_CAUSE_UNASSIGNED_NR = 1,
1052 GSM48_CC_CAUSE_NO_ROUTE = 3,
1053 GSM48_CC_CAUSE_CHAN_UNACCEPT = 6,
1054 GSM48_CC_CAUSE_OP_DET_BARRING = 8,
1055 GSM48_CC_CAUSE_NORM_CALL_CLEAR = 16,
1056 GSM48_CC_CAUSE_USER_BUSY = 17,
1057 GSM48_CC_CAUSE_USER_NOTRESPOND = 18,
1058 GSM48_CC_CAUSE_USER_ALERTING_NA = 19,
1059 GSM48_CC_CAUSE_CALL_REJECTED = 21,
1060 GSM48_CC_CAUSE_NUMBER_CHANGED = 22,
1061 GSM48_CC_CAUSE_PRE_EMPTION = 25,
1062 GSM48_CC_CAUSE_NONSE_USER_CLR = 26,
1063 GSM48_CC_CAUSE_DEST_OOO = 27,
1064 GSM48_CC_CAUSE_INV_NR_FORMAT = 28,
1065 GSM48_CC_CAUSE_FACILITY_REJ = 29,
1066 GSM48_CC_CAUSE_RESP_STATUS_INQ = 30,
1067 GSM48_CC_CAUSE_NORMAL_UNSPEC = 31,
1068 GSM48_CC_CAUSE_NO_CIRCUIT_CHAN = 34,
1069 GSM48_CC_CAUSE_NETWORK_OOO = 38,
1070 GSM48_CC_CAUSE_TEMP_FAILURE = 41,
1071 GSM48_CC_CAUSE_SWITCH_CONG = 42,
1072 GSM48_CC_CAUSE_ACC_INF_DISCARD = 43,
1073 GSM48_CC_CAUSE_REQ_CHAN_UNAVAIL = 44,
1074 GSM48_CC_CAUSE_RESOURCE_UNAVAIL = 47,
1075 GSM48_CC_CAUSE_QOS_UNAVAIL = 49,
1076 GSM48_CC_CAUSE_REQ_FAC_NOT_SUBSC= 50,
1077 GSM48_CC_CAUSE_INC_BARRED_CUG = 55,
1078 GSM48_CC_CAUSE_BEARER_CAP_UNAUTH= 57,
1079 GSM48_CC_CAUSE_BEARER_CA_UNAVAIL= 58,
1080 GSM48_CC_CAUSE_SERV_OPT_UNAVAIL = 63,
1081 GSM48_CC_CAUSE_BEARERSERV_UNIMPL= 65,
1082 GSM48_CC_CAUSE_ACM_GE_ACM_MAX = 68,
1083 GSM48_CC_CAUSE_REQ_FAC_NOTIMPL = 69,
1084 GSM48_CC_CAUSE_RESTR_BCAP_AVAIL = 70,
1085 GSM48_CC_CAUSE_SERV_OPT_UNIMPL = 79,
1086 GSM48_CC_CAUSE_INVAL_TRANS_ID = 81,
1087 GSM48_CC_CAUSE_USER_NOT_IN_CUG = 87,
1088 GSM48_CC_CAUSE_INCOMPAT_DEST = 88,
1089 GSM48_CC_CAUSE_INVAL_TRANS_NET = 91,
1090 GSM48_CC_CAUSE_SEMANTIC_INCORR = 95,
1091 GSM48_CC_CAUSE_INVAL_MAND_INF = 96,
1092 GSM48_CC_CAUSE_MSGTYPE_NOTEXIST = 97,
1093 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT = 98,
1094 GSM48_CC_CAUSE_IE_NOTEXIST = 99,
1095 GSM48_CC_CAUSE_COND_IE_ERR = 100,
1096 GSM48_CC_CAUSE_MSG_INCOMP_STATE = 101,
1097 GSM48_CC_CAUSE_RECOVERY_TIMER = 102,
1098 GSM48_CC_CAUSE_PROTO_ERR = 111,
1099 GSM48_CC_CAUSE_INTERWORKING = 127,
1100};
1101
1102/* Annex G, GSM specific cause values for mobility management */
1103enum gsm48_reject_value {
1104 GSM48_REJECT_IMSI_UNKNOWN_IN_HLR = 2,
1105 GSM48_REJECT_ILLEGAL_MS = 3,
1106 GSM48_REJECT_IMSI_UNKNOWN_IN_VLR = 4,
1107 GSM48_REJECT_IMEI_NOT_ACCEPTED = 5,
1108 GSM48_REJECT_ILLEGAL_ME = 6,
1109 GSM48_REJECT_PLMN_NOT_ALLOWED = 11,
1110 GSM48_REJECT_LOC_NOT_ALLOWED = 12,
1111 GSM48_REJECT_ROAMING_NOT_ALLOWED = 13,
1112 GSM48_REJECT_NETWORK_FAILURE = 17,
1113 GSM48_REJECT_CONGESTION = 22,
1114 GSM48_REJECT_SRV_OPT_NOT_SUPPORTED = 32,
1115 GSM48_REJECT_RQD_SRV_OPT_NOT_SUPPORTED = 33,
1116 GSM48_REJECT_SRV_OPT_TMP_OUT_OF_ORDER = 34,
1117 GSM48_REJECT_CALL_CAN_NOT_BE_IDENTIFIED = 38,
1118 GSM48_REJECT_INCORRECT_MESSAGE = 95,
1119 GSM48_REJECT_INVALID_MANDANTORY_INF = 96,
1120 GSM48_REJECT_MSG_TYPE_NOT_IMPLEMENTED = 97,
1121 GSM48_REJECT_MSG_TYPE_NOT_COMPATIBLE = 98,
1122 GSM48_REJECT_INF_ELEME_NOT_IMPLEMENTED = 99,
1123 GSM48_REJECT_CONDTIONAL_IE_ERROR = 100,
1124 GSM48_REJECT_MSG_NOT_COMPATIBLE = 101,
1125 GSM48_REJECT_PROTOCOL_ERROR = 111,
1126
1127 /* according to G.6 Additional cause codes for GMM */
1128 GSM48_REJECT_GPRS_NOT_ALLOWED = 7,
1129 GSM48_REJECT_SERVICES_NOT_ALLOWED = 8,
1130 GSM48_REJECT_MS_IDENTITY_NOT_DERVIVABLE = 9,
1131 GSM48_REJECT_IMPLICITLY_DETACHED = 10,
1132 GSM48_REJECT_GPRS_NOT_ALLOWED_IN_PLMN = 14,
1133 GSM48_REJECT_MSC_TMP_NOT_REACHABLE = 16,
1134};
1135
1136enum chreq_type {
1137 CHREQ_T_EMERG_CALL,
1138 CHREQ_T_CALL_REEST_TCH_F,
1139 CHREQ_T_CALL_REEST_TCH_H,
1140 CHREQ_T_CALL_REEST_TCH_H_DBL,
1141 CHREQ_T_SDCCH,
1142 CHREQ_T_TCH_F,
1143 CHREQ_T_VOICE_CALL_TCH_H,
1144 CHREQ_T_DATA_CALL_TCH_H,
1145 CHREQ_T_LOCATION_UPD,
1146 CHREQ_T_PAG_R_ANY_NECI0,
1147 CHREQ_T_PAG_R_ANY_NECI1,
1148 CHREQ_T_PAG_R_TCH_F,
1149 CHREQ_T_PAG_R_TCH_FH,
1150 CHREQ_T_LMU,
1151 CHREQ_T_RESERVED_SDCCH,
1152 CHREQ_T_RESERVED_IGNORE,
1153};
1154
1155/* Chapter 11.3 */
1156#define GSM48_T301 180, 0
1157#define GSM48_T303 30, 0
1158#define GSM48_T305 30, 0
1159#define GSM48_T306 30, 0
1160#define GSM48_T308 10, 0
1161#define GSM48_T310 180, 0
1162#define GSM48_T313 30, 0
1163#define GSM48_T323 30, 0
1164#define GSM48_T331 30, 0
1165#define GSM48_T333 30, 0
1166#define GSM48_T334 25, 0 /* min 15 */
1167#define GSM48_T338 30, 0
Andreas Eversberg014cb872010-07-12 09:11:00 +02001168#define GSM48_T303_MS 30, 0
1169#define GSM48_T305_MS 30, 0
1170#define GSM48_T308_MS 30, 0
1171#define GSM48_T310_MS 30, 0
1172#define GSM48_T313_MS 30, 0
1173#define GSM48_T323_MS 30, 0
1174#define GSM48_T332_MS 30, 0
1175#define GSM48_T335_MS 30, 0
Harald Welteec8b4502010-02-20 20:34:29 +01001176
1177/* Chapter 5.1.2.2 */
1178#define GSM_CSTATE_NULL 0
1179#define GSM_CSTATE_INITIATED 1
Andreas Eversberg1ef041f2010-04-09 07:52:12 +02001180#define GSM_CSTATE_MM_CONNECTION_PEND 2 /* see 10.5.4.6 */
Harald Welteec8b4502010-02-20 20:34:29 +01001181#define GSM_CSTATE_MO_CALL_PROC 3
1182#define GSM_CSTATE_CALL_DELIVERED 4
1183#define GSM_CSTATE_CALL_PRESENT 6
1184#define GSM_CSTATE_CALL_RECEIVED 7
1185#define GSM_CSTATE_CONNECT_REQUEST 8
1186#define GSM_CSTATE_MO_TERM_CALL_CONF 9
1187#define GSM_CSTATE_ACTIVE 10
1188#define GSM_CSTATE_DISCONNECT_REQ 12
1189#define GSM_CSTATE_DISCONNECT_IND 12
1190#define GSM_CSTATE_RELEASE_REQ 19
1191#define GSM_CSTATE_MO_ORIG_MODIFY 26
1192#define GSM_CSTATE_MO_TERM_MODIFY 27
1193#define GSM_CSTATE_CONNECT_IND 28
1194
1195#define SBIT(a) (1 << a)
1196#define ALL_STATES 0xffffffff
1197
1198/* Table 10.5.3/3GPP TS 04.08: Location Area Identification information element */
1199#define GSM_LAC_RESERVED_DETACHED 0x0
1200#define GSM_LAC_RESERVED_ALL_BTS 0xfffe
1201
1202/* GSM 04.08 Bearer Capability: Information Transfer Capability */
1203enum gsm48_bcap_itcap {
1204 GSM48_BCAP_ITCAP_SPEECH = 0,
1205 GSM48_BCAP_ITCAP_UNR_DIG_INF = 1,
1206 GSM48_BCAP_ITCAP_3k1_AUDIO = 2,
1207 GSM48_BCAP_ITCAP_FAX_G3 = 3,
1208 GSM48_BCAP_ITCAP_OTHER = 5,
1209 GSM48_BCAP_ITCAP_RESERVED = 7,
1210};
1211
1212/* GSM 04.08 Bearer Capability: Transfer Mode */
1213enum gsm48_bcap_tmod {
1214 GSM48_BCAP_TMOD_CIRCUIT = 0,
1215 GSM48_BCAP_TMOD_PACKET = 1,
1216};
1217
1218/* GSM 04.08 Bearer Capability: Coding Standard */
1219enum gsm48_bcap_coding {
1220 GSM48_BCAP_CODING_GSM_STD = 0,
1221};
1222
1223/* GSM 04.08 Bearer Capability: Radio Channel Requirements */
1224enum gsm48_bcap_rrq {
1225 GSM48_BCAP_RRQ_FR_ONLY = 1,
1226 GSM48_BCAP_RRQ_DUAL_HR = 2,
1227 GSM48_BCAP_RRQ_DUAL_FR = 3,
1228};
1229
Harald Welteec8b4502010-02-20 20:34:29 +01001230#define GSM48_TMSI_LEN 5
1231#define GSM48_MID_TMSI_LEN (GSM48_TMSI_LEN + 2)
1232#define GSM48_MI_SIZE 32
1233
Harald Weltea1c4f762010-05-01 11:59:42 +02001234/* Chapter 10.4.4.15 */
1235struct gsm48_ra_id {
1236 uint8_t digits[3]; /* MCC + MNC BCD digits */
1237 uint16_t lac; /* Location Area Code */
1238 uint8_t rac; /* Routing Area Code */
1239} __attribute__ ((packed));
1240
1241
Harald Welteec8b4502010-02-20 20:34:29 +01001242
1243#endif /* PROTO_GSM_04_08_H */