blob: 0c2fcf282dc182e6554829191b4486c44a5a53b0 [file] [log] [blame]
Sylvain Munaut12ba7782014-06-16 10:13:40 +02001#pragma once
Harald Welteec8b4502010-02-20 20:34:29 +01002
3#include <stdint.h>
Maxfe65fa72016-05-10 17:17:05 +02004#include <stdbool.h>
Harald Welteec8b4502010-02-20 20:34:29 +01005
Maxfb348ee2016-03-30 21:14:53 +02006#include <osmocom/core/utils.h>
Ruben Undheim720ac4a2016-05-27 22:03:59 +02007#include <osmocom/core/endian.h>
8
Maxfb348ee2016-03-30 21:14:53 +02009
Harald Welteec8b4502010-02-20 20:34:29 +010010/* GSM TS 04.08 definitions */
11struct gsm_lchan;
12
Andreas Eversberg014cb872010-07-12 09:11:00 +020013/* Chapter 10.5.1.5 */
Harald Welteec8b4502010-02-20 20:34:29 +010014struct gsm48_classmark1 {
Andreas Eversberg014cb872010-07-12 09:11:00 +020015 uint8_t pwr_lev:3,
Harald Welteec8b4502010-02-20 20:34:29 +010016 a5_1:1,
Andreas Eversberg014cb872010-07-12 09:11:00 +020017 es_ind:1,
18 rev_lev:2,
19 spare:1;
20} __attribute__ ((packed));
21
22/* Chapter 10.5.1.6 */
23struct gsm48_classmark2 {
24 uint8_t pwr_lev:3,
25 a5_1:1,
26 es_ind:1,
27 rev_lev:2,
28 spare:1;
29 uint8_t fc:1,
30 vgcs:1,
31 vbs:1,
32 sm_cap:1,
33 ss_scr:2,
34 ps_cap:1,
35 spare2:1;
36 uint8_t a5_2:1,
37 a5_3:1,
38 cmsp:1,
39 solsa:1,
40 spare3:1,
41 lcsva_cap:1,
42 spare4:1,
43 cm3:1;
44} __attribute__ ((packed));
45
46/* Chapter 10.5.2.1b.3 */
Ruben Undheim720ac4a2016-05-27 22:03:59 +020047#if OSMO_IS_LITTLE_ENDIAN == 1
Andreas Eversberg014cb872010-07-12 09:11:00 +020048struct gsm48_range_1024 {
49 uint8_t w1_hi:2,
50 f0:1,
51 form_id:5;
52 uint8_t w1_lo;
53 uint8_t w2_hi;
54 uint8_t w3_hi:7,
55 w2_lo:1;
56 uint8_t w4_hi:6,
57 w3_lo:2;
58 uint8_t w5_hi:6,
59 w4_lo:2;
60 uint8_t w6_hi:6,
61 w5_lo:2;
62 uint8_t w7_hi:6,
63 w6_lo:2;
64 uint8_t w8_hi:6,
65 w7_lo:2;
66 uint8_t w9:7,
67 w8_lo:1;
68 uint8_t w11_hi:1,
69 w10:7;
70 uint8_t w12_hi:2,
71 w11_lo:6;
72 uint8_t w13_hi:3,
73 w12_lo:5;
74 uint8_t w14_hi:4,
75 w13_lo:4;
76 uint8_t w15_hi:5,
77 w14_lo:3;
78 uint8_t w16:6,
79 w15_lo:2;
80} __attribute__ ((packed));
Ruben Undheim720ac4a2016-05-27 22:03:59 +020081#else
82struct gsm48_range_1024 {
83 uint8_t form_id:5,
84 f0:1,
85 w1_hi:2;
86 uint8_t w1_lo;
87 uint8_t w2_hi;
88 uint8_t w2_lo:1,
89 w3_hi:7;
90 uint8_t w3_lo:2,
91 w4_hi:6;
92 uint8_t w4_lo:2,
93 w5_hi:6;
94 uint8_t w5_lo:2,
95 w6_hi:6;
96 uint8_t w6_lo:2,
97 w7_hi:6;
98 uint8_t w7_lo:2,
99 w8_hi:6;
100 uint8_t w8_lo:1,
101 w9:7;
102 uint8_t w10:7,
103 w11_hi:1;
104 uint8_t w11_lo:6,
105 w12_hi:2;
106 uint8_t w12_lo:5,
107 w13_hi:3;
108 uint8_t w13_lo:4,
109 w14_hi:4;
110 uint8_t w14_lo:3,
111 w15_hi:5;
112 uint8_t w15_lo:2,
113 w16:6;
114} __attribute__ ((packed));
115#endif
Andreas Eversberg014cb872010-07-12 09:11:00 +0200116
117/* Chapter 10.5.2.1b.4 */
Ruben Undheim720ac4a2016-05-27 22:03:59 +0200118#if OSMO_IS_LITTLE_ENDIAN == 1
Andreas Eversberg014cb872010-07-12 09:11:00 +0200119struct gsm48_range_512 {
120 uint8_t orig_arfcn_hi:1,
121 form_id:7;
122 uint8_t orig_arfcn_mid;
123 uint8_t w1_hi:7,
124 orig_arfcn_lo:1;
125 uint8_t w2_hi:6,
126 w1_lo:2;
127 uint8_t w3_hi:6,
128 w2_lo:2;
129 uint8_t w4_hi:6,
130 w3_lo:2;
131 uint8_t w5:7,
132 w4_lo:1;
133 uint8_t w7_hi:1,
134 w6:7;
135 uint8_t w8_hi:2,
136 w7_lo:6;
137 uint8_t w9_hi:4,
138 w8_lo:4;
139 uint8_t w10:6,
140 w9_lo:2;
141 uint8_t w12_hi:2,
142 w11:6;
143 uint8_t w13_hi:4,
144 w12_lo:4;
145 uint8_t w14:6,
146 w13_lo:2;
147 uint8_t w16_hi:2,
148 w15:6;
149 uint8_t w17:5,
150 w16_lo:3;
151} __attribute__ ((packed));
Ruben Undheim720ac4a2016-05-27 22:03:59 +0200152#else
153struct gsm48_range_512 {
154 uint8_t form_id:7,
155 orig_arfcn_hi:1;
156 uint8_t orig_arfcn_mid;
157 uint8_t orig_arfcn_lo:1,
158 w1_hi:7;
159 uint8_t w1_lo:2,
160 w2_hi:6;
161 uint8_t w2_lo:2,
162 w3_hi:6;
163 uint8_t w3_lo:2,
164 w4_hi:6;
165 uint8_t w4_lo:1,
166 w5:7;
167 uint8_t w6:7,
168 w7_hi:1;
169 uint8_t w7_lo:6,
170 w8_hi:2;
171 uint8_t w8_lo:4,
172 w9_hi:4;
173 uint8_t w9_lo:2,
174 w10:6;
175 uint8_t w11:6,
176 w12_hi:2;
177 uint8_t w12_lo:4,
178 w13_hi:4;
179 uint8_t w13_lo:2,
180 w14:6;
181 uint8_t w15:6,
182 w16_hi:2;
183 uint8_t w16_lo:3,
184 w17:5;
185} __attribute__ ((packed));
186#endif
Andreas Eversberg014cb872010-07-12 09:11:00 +0200187
188/* Chapter 10.5.2.1b.5 */
Ruben Undheim720ac4a2016-05-27 22:03:59 +0200189#if OSMO_IS_LITTLE_ENDIAN == 1
Andreas Eversberg014cb872010-07-12 09:11:00 +0200190struct gsm48_range_256 {
191 uint8_t orig_arfcn_hi:1,
192 form_id:7;
193 uint8_t orig_arfcn_mid;
194 uint8_t w1_hi:7,
195 orig_arfcn_lo:1;
196 uint8_t w2:7,
197 w1_lo:1;
198 uint8_t w4_hi:1,
199 w3:7;
200 uint8_t w5_hi:3,
201 w4_lo:5;
202 uint8_t w6_hi:5,
203 w5_lo:3;
204 uint8_t w8_hi:1,
205 w7:6,
206 w6_lo:1;
207 uint8_t w9_hi:4,
208 w8_lo:4;
209 uint8_t w11_hi:2,
210 w10:5,
211 w9_lo:1;
212 uint8_t w12:5,
213 w11_lo:3;
214 uint8_t w14_hi:3,
215 w13:5;
216 uint8_t w16_hi:1,
217 w15:5,
218 w14_lo:2;
219 uint8_t w18_hi:1,
220 w17:4,
221 w16_lo:3;
222 uint8_t w20_hi:1,
223 w19:4,
224 w18_lo:3;
225 uint8_t spare:1,
226 w21:4,
227 w20_lo:3;
228} __attribute__ ((packed));
Ruben Undheim720ac4a2016-05-27 22:03:59 +0200229#else
230struct gsm48_range_256 {
231 uint8_t form_id:7,
232 orig_arfcn_hi:1;
233 uint8_t orig_arfcn_mid;
234 uint8_t orig_arfcn_lo:1,
235 w1_hi:7;
236 uint8_t w1_lo:1,
237 w2:7;
238 uint8_t w3:7,
239 w4_hi:1;
240 uint8_t w4_lo:5,
241 w5_hi:3;
242 uint8_t w5_lo:3,
243 w6_hi:5;
244 uint8_t w6_lo:1,
245 w7:6,
246 w8_hi:1;
247 uint8_t w8_lo:4,
248 w9_hi:4;
249 uint8_t w9_lo:1,
250 w10:5,
251 w11_hi:2;
252 uint8_t w11_lo:3,
253 w12:5;
254 uint8_t w13:5,
255 w14_hi:3;
256 uint8_t w14_lo:2,
257 w15:5,
258 w16_hi:1;
259 uint8_t w16_lo:3,
260 w17:4,
261 w18_hi:1;
262 uint8_t w18_lo:3,
263 w19:4,
264 w20_hi:1;
265 uint8_t w20_lo:3,
266 w21:4,
267 spare:1;
268} __attribute__ ((packed));
269#endif
Andreas Eversberg014cb872010-07-12 09:11:00 +0200270
271/* Chapter 10.5.2.1b.6 */
Ruben Undheim720ac4a2016-05-27 22:03:59 +0200272#if OSMO_IS_LITTLE_ENDIAN == 1
Andreas Eversberg014cb872010-07-12 09:11:00 +0200273struct gsm48_range_128 {
274 uint8_t orig_arfcn_hi:1,
275 form_id:7;
276 uint8_t orig_arfcn_mid;
277 uint8_t w1:7,
278 orig_arfcn_lo:1;
279 uint8_t w3_hi:2,
280 w2:6;
281 uint8_t w4_hi:4,
282 w3_lo:4;
283 uint8_t w6_hi:2,
284 w5:5,
285 w4_lo:1;
286 uint8_t w7:5,
287 w6_lo:3;
288 uint8_t w9:4,
289 w8:4;
290 uint8_t w11:4,
291 w10:4;
292 uint8_t w13:4,
293 w12:4;
294 uint8_t w15:4,
295 w14:4;
296 uint8_t w18_hi:2,
297 w17:3,
298 w16:3;
299 uint8_t w21_hi:1,
300 w20:3,
301 w19:3,
302 w18_lo:1;
303 uint8_t w23:3,
304 w22:3,
305 w21_lo:2;
306 uint8_t w26_hi:2,
307 w25:3,
308 w24:3;
309 uint8_t spare:1,
310 w28:3,
311 w27:3,
312 w26_lo:1;
313} __attribute__ ((packed));
Ruben Undheim720ac4a2016-05-27 22:03:59 +0200314#else
315struct gsm48_range_128 {
316 uint8_t form_id:7,
317 orig_arfcn_hi:1;
318 uint8_t orig_arfcn_mid;
319 uint8_t orig_arfcn_lo:1,
320 w1:7;
321 uint8_t w2:6,
322 w3_hi:2;
323 uint8_t w3_lo:4,
324 w4_hi:4;
325 uint8_t w4_lo:1,
326 w5:5,
327 w6_hi:2;
328 uint8_t w6_lo:3,
329 w7:5;
330 uint8_t w8:4,
331 w9:4;
332 uint8_t w10:4,
333 w11:4;
334 uint8_t w12:4,
335 w13:4;
336 uint8_t w14:4,
337 w15:4;
338 uint8_t w16:3,
339 w17:3,
340 w18_hi:2;
341 uint8_t w18_lo:1,
342 w19:3,
343 w20:3,
344 w21_hi:1;
345 uint8_t w21_lo:2,
346 w22:3,
347 w23:3;
348 uint8_t w24:3,
349 w25:3,
350 w26_hi:2;
351 uint8_t w26_lo:1,
352 w27:3,
353 w28:3,
354 spare:1;
355} __attribute__ ((packed));
356#endif
Andreas Eversberg014cb872010-07-12 09:11:00 +0200357
358/* Chapter 10.5.2.1b.7 */
359struct gsm48_var_bit {
360 uint8_t orig_arfcn_hi:1,
361 form_id:7;
362 uint8_t orig_arfcn_mid;
363 uint8_t rrfcn1_7:7,
364 orig_arfcn_lo:1;
365 uint8_t rrfcn8_111[13];
Harald Welteec8b4502010-02-20 20:34:29 +0100366} __attribute__ ((packed));
367
368/* Chapter 10.5.2.5 */
369struct gsm48_chan_desc {
370 uint8_t chan_nr;
371 union {
372 struct {
373 uint8_t maio_high:4,
374 h:1,
375 tsc:3;
376 uint8_t hsn:6,
377 maio_low:2;
Andreas Eversberg4b332d72012-02-07 20:02:17 +0100378 } __attribute__ ((packed)) h1;
Harald Welteec8b4502010-02-20 20:34:29 +0100379 struct {
380 uint8_t arfcn_high:2,
381 spare:2,
382 h:1,
383 tsc:3;
384 uint8_t arfcn_low;
Andreas Eversberg4b332d72012-02-07 20:02:17 +0100385 } __attribute__ ((packed)) h0;
386 } __attribute__ ((packed));
Harald Welteec8b4502010-02-20 20:34:29 +0100387} __attribute__ ((packed));
388
Andreas Eversberg014cb872010-07-12 09:11:00 +0200389/* Chapter 10.5.2.20 */
390struct gsm48_meas_res {
391 uint8_t rxlev_full:6,
392 dtx_used:1,
393 ba_used:1;
394 uint8_t rxlev_sub:6,
395 meas_valid:1,
396 spare:1;
397 uint8_t no_nc_n_hi:1,
398 rxqual_sub:3,
399 rxqual_full:3,
400 spare2:1;
401 uint8_t rxlev_nc1:6,
402 no_nc_n_lo:2;
403 uint8_t bsic_nc1_hi:3,
404 bcch_f_nc1:5;
405 uint8_t rxlev_nc2_hi:5,
406 bsic_nc1_lo:3;
407 uint8_t bsic_nc2_hi:2,
408 bcch_f_nc2:5,
409 rxlev_nc2_lo:1;
410 uint8_t rxlev_nc3_hi:4,
411 bsic_nc2_lo:4;
412 uint8_t bsic_nc3_hi:1,
413 bcch_f_nc3:5,
414 rxlev_nc3_lo:2;
415 uint8_t rxlev_nc4_hi:3,
416 bsic_nc3_lo:5;
417 uint8_t bcch_f_nc4:5,
418 rxlev_nc4_lo:3;
419 uint8_t rxlev_nc5_hi:2,
420 bsic_nc4:6;
421 uint8_t bcch_f_nc5_hi:4,
422 rxlev_nc5_lo:4;
423 uint8_t rxlev_nc6_hi:1,
424 bsic_nc5:6,
425 bcch_f_nc5_lo:1;
426 uint8_t bcch_f_nc6_hi:3,
427 rxlev_nc6_lo:5;
428 uint8_t bsic_nc6:6,
429 bcch_f_nc6_lo:2;
430} __attribute__ ((packed));
431
Harald Welteec8b4502010-02-20 20:34:29 +0100432/* Chapter 10.5.2.21aa */
433struct gsm48_multi_rate_conf {
434 uint8_t smod : 2,
435 spare: 1,
436 icmi : 1,
437 nscb : 1,
438 ver : 3;
439 uint8_t m4_75 : 1,
440 m5_15 : 1,
441 m5_90 : 1,
442 m6_70 : 1,
443 m7_40 : 1,
444 m7_95 : 1,
445 m10_2 : 1,
446 m12_2 : 1;
447} __attribute__((packed));
448
Andreas Eversberg014cb872010-07-12 09:11:00 +0200449/* Chapter 10.5.2.28(a) */
450struct gsm48_power_cmd {
451 uint8_t power_level:5,
452 spare:2,
453 atc:1;
454} __attribute__((packed));
455
456/* Chapter 10.5.2.29 */
457struct gsm48_rach_control {
458 uint8_t re :1,
459 cell_bar :1,
460 tx_integer :4,
461 max_trans :2;
462 uint8_t t2;
463 uint8_t t3;
464} __attribute__ ((packed));
465
466
Harald Welteec8b4502010-02-20 20:34:29 +0100467/* Chapter 10.5.2.30 */
468struct gsm48_req_ref {
469 uint8_t ra;
470 uint8_t t3_high:3,
Andreas Eversberg93364fc2010-06-25 02:50:06 +0200471 t1:5;
Harald Welteec8b4502010-02-20 20:34:29 +0100472 uint8_t t2:5,
473 t3_low:3;
474} __attribute__ ((packed));
475
Andreas Eversberg014cb872010-07-12 09:11:00 +0200476/* Chapter 10.5.2.38 */
477struct gsm48_start_time {
478 uint8_t t3_high:3,
479 t1:5;
480 uint8_t t2:5,
481 t3_low:3;
482} __attribute__ ((packed));
483
484/* Chapter 10.5.2.39 */
485struct gsm48_sync_ind {
486 uint8_t si:2,
487 rot:1,
488 nci:1,
489 sync_ie:4;
490} __attribute__((packed));
491
Harald Welteec8b4502010-02-20 20:34:29 +0100492/*
493 * Chapter 9.1.5/9.1.6
494 *
495 * For 9.1.6 the chan_desc has the meaning of 10.5.2.5a
496 */
497struct gsm48_chan_mode_modify {
498 struct gsm48_chan_desc chan_desc;
499 uint8_t mode;
500} __attribute__ ((packed));
501
502enum gsm48_chan_mode {
503 GSM48_CMODE_SIGN = 0x00,
504 GSM48_CMODE_SPEECH_V1 = 0x01,
505 GSM48_CMODE_SPEECH_EFR = 0x21,
506 GSM48_CMODE_SPEECH_AMR = 0x41,
507 GSM48_CMODE_DATA_14k5 = 0x0f,
508 GSM48_CMODE_DATA_12k0 = 0x03,
509 GSM48_CMODE_DATA_6k0 = 0x0b,
Bhaskar31e844b2013-05-16 17:06:35 +0530510 GSM48_CMODE_DATA_3k6 = 0x13,
Harald Welteec8b4502010-02-20 20:34:29 +0100511};
512
Maxfb348ee2016-03-30 21:14:53 +0200513extern const struct value_string gsm48_chan_mode_names[];
514
Harald Welteec8b4502010-02-20 20:34:29 +0100515/* Chapter 9.1.2 */
516struct gsm48_ass_cmd {
517 /* Semantic is from 10.5.2.5a */
518 struct gsm48_chan_desc chan_desc;
519 uint8_t power_command;
520 uint8_t data[0];
521} __attribute__((packed));
522
Andreas Eversbergfa832012010-09-01 23:37:07 +0200523/* Chapter 9.1.13 */
524struct gsm48_frq_redef {
525 /* Semantic is from 10.5.2.5a */
526 struct gsm48_chan_desc chan_desc;
527 uint8_t mob_alloc_len;
528 uint8_t mob_alloc[0];
529} __attribute__((packed));
530
Harald Welteec8b4502010-02-20 20:34:29 +0100531/* Chapter 10.5.2.2 */
532struct gsm48_cell_desc {
533 uint8_t bcc:3,
534 ncc:3,
535 arfcn_hi:2;
536 uint8_t arfcn_lo;
537} __attribute__((packed));
538
539/* Chapter 9.1.15 */
540struct gsm48_ho_cmd {
541 struct gsm48_cell_desc cell_desc;
542 struct gsm48_chan_desc chan_desc;
543 uint8_t ho_ref;
544 uint8_t power_command;
545 uint8_t data[0];
546} __attribute__((packed));
547
548/* Chapter 9.1.18 */
549struct gsm48_imm_ass {
550 uint8_t l2_plen;
551 uint8_t proto_discr;
552 uint8_t msg_type;
553 uint8_t page_mode;
554 struct gsm48_chan_desc chan_desc;
555 struct gsm48_req_ref req_ref;
556 uint8_t timing_advance;
557 uint8_t mob_alloc_len;
558 uint8_t mob_alloc[0];
559} __attribute__ ((packed));
560
Holger Hans Peter Freyther5dcef3c2010-05-15 22:35:25 +0800561/* Chapter 9.1.25 */
562struct gsm48_pag_resp {
563 uint8_t spare:4,
564 key_seq:4;
565 uint32_t classmark2;
566 uint8_t mi_len;
567 uint8_t mi[0];
568} __attribute__ ((packed));
569
Harald Welteec8b4502010-02-20 20:34:29 +0100570/* Chapter 10.5.1.3 */
571struct gsm48_loc_area_id {
572 uint8_t digits[3]; /* BCD! */
573 uint16_t lac;
574} __attribute__ ((packed));
575
576/* Section 9.2.2 */
577struct gsm48_auth_req {
578 uint8_t key_seq:4,
579 spare:4;
580 uint8_t rand[16];
581} __attribute__ ((packed));
582
Sylvain Munautd005eab2010-06-10 13:30:50 +0200583/* Section 9.2.3 */
584struct gsm48_auth_resp {
585 uint8_t sres[4];
586} __attribute__ ((packed));
587
Harald Welteec8b4502010-02-20 20:34:29 +0100588/* Section 9.2.15 */
589struct gsm48_loc_upd_req {
590 uint8_t type:4,
591 key_seq:4;
592 struct gsm48_loc_area_id lai;
593 struct gsm48_classmark1 classmark1;
594 uint8_t mi_len;
595 uint8_t mi[0];
596} __attribute__ ((packed));
597
598/* Section 10.1 */
599struct gsm48_hdr {
600 uint8_t proto_discr;
601 uint8_t msg_type;
602 uint8_t data[0];
603} __attribute__ ((packed));
604
605/* Section 9.1.3x System information Type header */
606struct gsm48_system_information_type_header {
607 uint8_t l2_plen;
608 uint8_t rr_protocol_discriminator :4,
609 skip_indicator:4;
610 uint8_t system_information;
611} __attribute__ ((packed));
612
Harald Welteec8b4502010-02-20 20:34:29 +0100613/* Section 10.5.2.4 Cell Selection Parameters */
614struct gsm48_cell_sel_par {
615 uint8_t ms_txpwr_max_ccch:5, /* GSM 05.08 MS-TXPWR-MAX-CCCH */
616 cell_resel_hyst:3; /* GSM 05.08 CELL-RESELECT-HYSTERESIS */
617 uint8_t rxlev_acc_min:6, /* GSM 05.08 RXLEV-ACCESS-MIN */
618 neci:1,
619 acs:1;
620} __attribute__ ((packed));
621
622/* Section 10.5.2.11 Control Channel Description , Figure 10.5.33 */
623struct gsm48_control_channel_descr {
624 uint8_t ccch_conf :3,
625 bs_ag_blks_res :3,
626 att :1,
627 spare1 :1;
628 uint8_t bs_pa_mfrms : 3,
629 spare2 :5;
630 uint8_t t3212;
631} __attribute__ ((packed));
632
Maxfe65fa72016-05-10 17:17:05 +0200633enum gsm48_dtx_mode {
634 GSM48_DTX_MAY_BE_USED,
635 GSM48_DTX_SHALL_BE_USED,
636 GSM48_DTX_SHALL_NOT_BE_USED
637};
638
639/* Cell Options for SI6, SACCH (10.5.2.3a.2) or SI3, BCCH (Table 10.5.2.3.1),
640 3GPP TS 44.018 */
Harald Welteec8b4502010-02-20 20:34:29 +0100641struct gsm48_cell_options {
642 uint8_t radio_link_timeout:4,
643 dtx:2,
644 pwrc:1,
Maxfe65fa72016-05-10 17:17:05 +0200645 /* either DN-IND or top bit of DTX IND */
646 d:1;
Harald Welteec8b4502010-02-20 20:34:29 +0100647} __attribute__ ((packed));
648
649/* Section 9.2.9 CM service request */
650struct gsm48_service_request {
651 uint8_t cm_service_type : 4,
652 cipher_key_seq : 4;
653 /* length + 3 bytes */
654 uint32_t classmark;
655 uint8_t mi_len;
656 uint8_t mi[0];
657 /* optional priority level */
658} __attribute__ ((packed));
659
660/* Section 9.1.31 System information Type 1 */
661struct gsm48_system_information_type_1 {
662 struct gsm48_system_information_type_header header;
663 uint8_t cell_channel_description[16];
664 struct gsm48_rach_control rach_control;
665 uint8_t rest_octets[0]; /* NCH position on the CCCH */
666} __attribute__ ((packed));
667
668/* Section 9.1.32 System information Type 2 */
669struct gsm48_system_information_type_2 {
670 struct gsm48_system_information_type_header header;
671 uint8_t bcch_frequency_list[16];
672 uint8_t ncc_permitted;
673 struct gsm48_rach_control rach_control;
674} __attribute__ ((packed));
675
Andreas Eversberg014cb872010-07-12 09:11:00 +0200676/* Section 9.1.33 System information Type 2bis */
677struct gsm48_system_information_type_2bis {
678 struct gsm48_system_information_type_header header;
679 uint8_t bcch_frequency_list[16];
680 struct gsm48_rach_control rach_control;
681 uint8_t rest_octets[0];
682} __attribute__ ((packed));
683
684/* Section 9.1.34 System information Type 2ter */
685struct gsm48_system_information_type_2ter {
686 struct gsm48_system_information_type_header header;
687 uint8_t ext_bcch_frequency_list[16];
688 uint8_t rest_octets[0];
689} __attribute__ ((packed));
690
Maxe859aec2016-03-11 12:24:04 +0100691/* Section 9.1.34a System information Type 2quater */
692struct gsm48_system_information_type_2quater {
693 struct gsm48_system_information_type_header header;
694 uint8_t rest_octets[0];
695} __attribute__ ((packed));
696
Harald Welteec8b4502010-02-20 20:34:29 +0100697/* Section 9.1.35 System information Type 3 */
698struct gsm48_system_information_type_3 {
699 struct gsm48_system_information_type_header header;
700 uint16_t cell_identity;
701 struct gsm48_loc_area_id lai;
702 struct gsm48_control_channel_descr control_channel_desc;
703 struct gsm48_cell_options cell_options;
704 struct gsm48_cell_sel_par cell_sel_par;
705 struct gsm48_rach_control rach_control;
706 uint8_t rest_octets[0];
707} __attribute__ ((packed));
708
709/* Section 9.1.36 System information Type 4 */
710struct gsm48_system_information_type_4 {
711 struct gsm48_system_information_type_header header;
712 struct gsm48_loc_area_id lai;
713 struct gsm48_cell_sel_par cell_sel_par;
714 struct gsm48_rach_control rach_control;
715 /* optional CBCH conditional CBCH... followed by
716 mandantory SI 4 Reset Octets
717 */
718 uint8_t data[0];
719} __attribute__ ((packed));
720
721/* Section 9.1.37 System information Type 5 */
722struct gsm48_system_information_type_5 {
723 uint8_t rr_protocol_discriminator :4,
724 skip_indicator:4;
725 uint8_t system_information;
726 uint8_t bcch_frequency_list[16];
727} __attribute__ ((packed));
728
Andreas Eversberg014cb872010-07-12 09:11:00 +0200729/* Section 9.1.38 System information Type 5bis */
730struct gsm48_system_information_type_5bis {
731 uint8_t rr_protocol_discriminator :4,
732 skip_indicator:4;
733 uint8_t system_information;
734 uint8_t bcch_frequency_list[16];
735} __attribute__ ((packed));
736
737/* Section 9.1.39 System information Type 5ter */
738struct gsm48_system_information_type_5ter {
739 uint8_t rr_protocol_discriminator :4,
740 skip_indicator:4;
741 uint8_t system_information;
742 uint8_t bcch_frequency_list[16];
743} __attribute__ ((packed));
744
Harald Welteec8b4502010-02-20 20:34:29 +0100745/* Section 9.1.40 System information Type 6 */
746struct gsm48_system_information_type_6 {
747 uint8_t rr_protocol_discriminator :4,
748 skip_indicator:4;
749 uint8_t system_information;
750 uint16_t cell_identity;
751 struct gsm48_loc_area_id lai;
752 struct gsm48_cell_options cell_options;
753 uint8_t ncc_permitted;
754 uint8_t rest_octets[0];
755} __attribute__ ((packed));
756
757/* Section 9.1.43a System Information type 13 */
758struct gsm48_system_information_type_13 {
759 struct gsm48_system_information_type_header header;
760 uint8_t rest_octets[0];
761} __attribute__ ((packed));
762
763/* Section 9.2.12 IMSI Detach Indication */
764struct gsm48_imsi_detach_ind {
765 struct gsm48_classmark1 classmark1;
766 uint8_t mi_len;
767 uint8_t mi[0];
768} __attribute__ ((packed));
769
Andreas Eversberg014cb872010-07-12 09:11:00 +0200770/* Section 9.1.1 */
771struct gsm48_add_ass {
772 /* Semantic is from 10.5.2.5 */
773 struct gsm48_chan_desc chan_desc;
774 uint8_t data[0];
775} __attribute__((packed));
776
777/* Section 9.1.3 */
778struct gsm48_ass_cpl {
779 uint8_t rr_cause;
780} __attribute__((packed));
781
782/* Section 9.1.4 */
783struct gsm48_ass_fail {
784 uint8_t rr_cause;
785} __attribute__((packed));
786
Andreas Eversbergfa832012010-09-01 23:37:07 +0200787/* Section 9.1.3 */
788struct gsm48_ho_cpl {
789 uint8_t rr_cause;
790 uint8_t data[0];
791} __attribute__((packed));
792
793/* Section 9.1.4 */
794struct gsm48_ho_fail {
795 uint8_t rr_cause;
796} __attribute__((packed));
797
Andreas Eversberg014cb872010-07-12 09:11:00 +0200798/* Section 9.1.7 */
799struct gsm48_chan_rel {
800 uint8_t rr_cause;
801 uint8_t data[0];
802} __attribute__((packed));
803
804/* Section 9.1.9 */
805struct gsm48_cip_mode_cmd {
806 uint8_t sc:1,
807 alg_id:3,
Sylvain Munaut77b6f6c2010-09-17 13:55:45 +0200808 cr:1,
809 spare:3;
Andreas Eversberg014cb872010-07-12 09:11:00 +0200810} __attribute__((packed));
811
812/* Section 9.1.11 */
813struct gsm48_cm_change {
814 uint8_t cm2_len;
815 struct gsm48_classmark2 cm2;
816 uint8_t data[0];
817} __attribute__((packed));
818
819/* Section 9.1.19 */
820struct gsm48_imm_ass_ext {
821 uint8_t l2_plen;
822 uint8_t proto_discr;
823 uint8_t msg_type;
824 uint8_t page_mode;
825 struct gsm48_chan_desc chan_desc1;
826 struct gsm48_req_ref req_ref1;
827 uint8_t timing_advance1;
828 struct gsm48_chan_desc chan_desc2;
829 struct gsm48_req_ref req_ref2;
830 uint8_t timing_advance2;
831 uint8_t mob_alloc_len;
832 uint8_t mob_alloc[0];
833} __attribute__ ((packed));
834
835/* Section 9.1.20 */
836struct gsm48_imm_ass_rej {
837 uint8_t l2_plen;
838 uint8_t proto_discr;
839 uint8_t msg_type;
840 uint8_t page_mode;
841 struct gsm48_req_ref req_ref1;
842 uint8_t wait_ind1;
843 struct gsm48_req_ref req_ref2;
844 uint8_t wait_ind2;
845 struct gsm48_req_ref req_ref3;
846 uint8_t wait_ind3;
847 struct gsm48_req_ref req_ref4;
848 uint8_t wait_ind4;
849 uint8_t rest[0];
850} __attribute__ ((packed));
851
852/* Section 9.1.22 */
853struct gsm48_paging1 {
854 uint8_t l2_plen;
855 uint8_t proto_discr;
856 uint8_t msg_type;
857 uint8_t pag_mode:2,
858 spare:2,
859 cneed1:2,
860 cneed2:2;
861 uint8_t data[0];
862} __attribute__((packed));
863
864/* Section 9.1.23 */
865struct gsm48_paging2 {
866 uint8_t l2_plen;
867 uint8_t proto_discr;
868 uint8_t msg_type;
869 uint8_t pag_mode:2,
870 spare:2,
871 cneed1:2,
872 cneed2:2;
873 uint32_t tmsi1;
874 uint32_t tmsi2;
875 uint8_t data[0];
876} __attribute__((packed));
877
878/* Section 9.1.24 */
879struct gsm48_paging3 {
880 uint8_t l2_plen;
881 uint8_t proto_discr;
882 uint8_t msg_type;
883 uint8_t pag_mode:2,
884 spare:2,
885 cneed1:2,
886 cneed2:2;
887 uint32_t tmsi1;
888 uint32_t tmsi2;
889 uint32_t tmsi3;
890 uint32_t tmsi4;
891 uint8_t cneed3:2,
892 cneed4:2,
893 spare2:4;
894 uint8_t rest[0];
895} __attribute__((packed));
896
897/* Section 9.1.25 */
898struct gsm48_pag_rsp {
899 uint8_t key_seq:3,
900 spare:5;
901 uint8_t cm2_len;
902 struct gsm48_classmark2 cm2;
903 uint8_t data[0];
904} __attribute__((packed));
905
906/* Section 9.1.29 */
907struct gsm48_rr_status {
908 uint8_t rr_cause;
909} __attribute__((packed));
910
Harald Welteec8b4502010-02-20 20:34:29 +0100911/* Section 10.2 + GSM 04.07 12.2.3.1.1 */
912#define GSM48_PDISC_GROUP_CC 0x00
913#define GSM48_PDISC_BCAST_CC 0x01
914#define GSM48_PDISC_PDSS1 0x02
915#define GSM48_PDISC_CC 0x03
916#define GSM48_PDISC_PDSS2 0x04
917#define GSM48_PDISC_MM 0x05
918#define GSM48_PDISC_RR 0x06
919#define GSM48_PDISC_MM_GPRS 0x08
920#define GSM48_PDISC_SMS 0x09
921#define GSM48_PDISC_SM_GPRS 0x0a
922#define GSM48_PDISC_NC_SS 0x0b
923#define GSM48_PDISC_LOC 0x0c
Neels Hofmeyr282e9082016-03-14 16:06:46 +0100924#define GSM48_PDISC_EXTEND 0x0e
Harald Welteec8b4502010-02-20 20:34:29 +0100925#define GSM48_PDISC_MASK 0x0f
926#define GSM48_PDISC_USSD 0x11
927
Neels Hofmeyr282e9082016-03-14 16:06:46 +0100928static inline uint8_t gsm48_hdr_pdisc(const struct gsm48_hdr *hdr)
929{
930 /*
931 * 3GPP TS 24.007 version 12.0.0 Release 12,
932 * 11.2.3.1.1 Protocol discriminator
933 */
934 uint8_t pdisc = hdr->proto_discr & GSM48_PDISC_MASK;
935 if (pdisc == GSM48_PDISC_EXTEND)
936 return hdr->proto_discr;
937 return pdisc;
938}
939
Neels Hofmeyrda7bf4d2016-03-14 16:06:48 +0100940static inline uint8_t gsm48_hdr_trans_id(const struct gsm48_hdr *hdr)
941{
942 /*
943 * 3GPP TS 24.007 version 12.0.0 Release 12,
944 * 11.2.3.1.3 Transaction identifier
945 */
946 return (hdr->proto_discr & 0xf0) >> 4;
947}
948
949static inline uint8_t gsm48_hdr_trans_id_flip_ti(const struct gsm48_hdr *hdr)
950{
951 return gsm48_hdr_trans_id(hdr) ^ 0x08;
952}
953
954static inline uint8_t gsm48_hdr_trans_id_no_ti(const struct gsm48_hdr *hdr)
955{
956 return gsm48_hdr_trans_id(hdr) & 0x07;
957}
958
Neels Hofmeyr282e9082016-03-14 16:06:46 +0100959static inline uint8_t gsm48_hdr_msg_type_r98(const struct gsm48_hdr *hdr)
960{
961 /*
962 * 3GPP TS 24.007 version 12.0.0 Release 12,
963 * 11.2.3.2.1 Message type octet (when accessing Release 98 and older
964 * networks only)
965 */
966 switch (gsm48_hdr_pdisc(hdr)) {
967 case GSM48_PDISC_MM:
968 case GSM48_PDISC_CC:
969 case GSM48_PDISC_NC_SS:
970 case GSM48_PDISC_GROUP_CC:
971 case GSM48_PDISC_BCAST_CC:
972 case GSM48_PDISC_LOC:
973 return hdr->msg_type & 0xbf;
974 default:
975 return hdr->msg_type;
976 }
977}
978
979static inline uint8_t gsm48_hdr_msg_type_r99(const struct gsm48_hdr *hdr)
980{
981 /*
982 * 3GPP TS 24.007 version 12.0.0 Release 12,
983 * 11.2.3.2.2 Message type octet (when accessing Release 99 and newer
984 * networks)
985 */
986 switch (gsm48_hdr_pdisc(hdr)) {
987 case GSM48_PDISC_MM:
988 case GSM48_PDISC_CC:
989 return hdr->msg_type & 0x3f;
990 case GSM48_PDISC_NC_SS:
991 case GSM48_PDISC_GROUP_CC:
992 case GSM48_PDISC_BCAST_CC:
993 case GSM48_PDISC_LOC:
994 return hdr->msg_type & 0xbf;
995 default:
996 return hdr->msg_type;
997 }
998}
999
Maxfe65fa72016-05-10 17:17:05 +02001000void gsm48_set_dtx(struct gsm48_cell_options *op, enum gsm48_dtx_mode full,
1001 enum gsm48_dtx_mode half, bool is_bcch);
1002
Neels Hofmeyrc656fae2016-03-14 16:06:47 +01001003#define gsm48_hdr_msg_type gsm48_hdr_msg_type_r99
Neels Hofmeyr282e9082016-03-14 16:06:46 +01001004
Harald Welteec8b4502010-02-20 20:34:29 +01001005/* Section 10.4 */
1006#define GSM48_MT_RR_INIT_REQ 0x3c
1007#define GSM48_MT_RR_ADD_ASS 0x3b
1008#define GSM48_MT_RR_IMM_ASS 0x3f
1009#define GSM48_MT_RR_IMM_ASS_EXT 0x39
1010#define GSM48_MT_RR_IMM_ASS_REJ 0x3a
1011
1012#define GSM48_MT_RR_CIPH_M_CMD 0x35
1013#define GSM48_MT_RR_CIPH_M_COMPL 0x32
1014
1015#define GSM48_MT_RR_CFG_CHG_CMD 0x30
1016#define GSM48_MT_RR_CFG_CHG_ACK 0x31
1017#define GSM48_MT_RR_CFG_CHG_REJ 0x33
1018
1019#define GSM48_MT_RR_ASS_CMD 0x2e
1020#define GSM48_MT_RR_ASS_COMPL 0x29
1021#define GSM48_MT_RR_ASS_FAIL 0x2f
1022#define GSM48_MT_RR_HANDO_CMD 0x2b
1023#define GSM48_MT_RR_HANDO_COMPL 0x2c
1024#define GSM48_MT_RR_HANDO_FAIL 0x28
1025#define GSM48_MT_RR_HANDO_INFO 0x2d
1026
1027#define GSM48_MT_RR_CELL_CHG_ORDER 0x08
1028#define GSM48_MT_RR_PDCH_ASS_CMD 0x23
1029
1030#define GSM48_MT_RR_CHAN_REL 0x0d
1031#define GSM48_MT_RR_PART_REL 0x0a
1032#define GSM48_MT_RR_PART_REL_COMP 0x0f
1033
1034#define GSM48_MT_RR_PAG_REQ_1 0x21
1035#define GSM48_MT_RR_PAG_REQ_2 0x22
1036#define GSM48_MT_RR_PAG_REQ_3 0x24
1037#define GSM48_MT_RR_PAG_RESP 0x27
1038#define GSM48_MT_RR_NOTIF_NCH 0x20
1039#define GSM48_MT_RR_NOTIF_FACCH 0x25
1040#define GSM48_MT_RR_NOTIF_RESP 0x26
1041
1042#define GSM48_MT_RR_SYSINFO_8 0x18
1043#define GSM48_MT_RR_SYSINFO_1 0x19
1044#define GSM48_MT_RR_SYSINFO_2 0x1a
1045#define GSM48_MT_RR_SYSINFO_3 0x1b
1046#define GSM48_MT_RR_SYSINFO_4 0x1c
1047#define GSM48_MT_RR_SYSINFO_5 0x1d
1048#define GSM48_MT_RR_SYSINFO_6 0x1e
1049#define GSM48_MT_RR_SYSINFO_7 0x1f
1050
1051#define GSM48_MT_RR_SYSINFO_2bis 0x02
1052#define GSM48_MT_RR_SYSINFO_2ter 0x03
Maxe859aec2016-03-11 12:24:04 +01001053#define GSM48_MT_RR_SYSINFO_2quater 0x07
Harald Welteec8b4502010-02-20 20:34:29 +01001054#define GSM48_MT_RR_SYSINFO_5bis 0x05
1055#define GSM48_MT_RR_SYSINFO_5ter 0x06
1056#define GSM48_MT_RR_SYSINFO_9 0x04
1057#define GSM48_MT_RR_SYSINFO_13 0x00
1058
1059#define GSM48_MT_RR_SYSINFO_16 0x3d
1060#define GSM48_MT_RR_SYSINFO_17 0x3e
1061
1062#define GSM48_MT_RR_CHAN_MODE_MODIF 0x10
1063#define GSM48_MT_RR_STATUS 0x12
1064#define GSM48_MT_RR_CHAN_MODE_MODIF_ACK 0x17
1065#define GSM48_MT_RR_FREQ_REDEF 0x14
1066#define GSM48_MT_RR_MEAS_REP 0x15
1067#define GSM48_MT_RR_CLSM_CHG 0x16
1068#define GSM48_MT_RR_CLSM_ENQ 0x13
1069#define GSM48_MT_RR_EXT_MEAS_REP 0x36
1070#define GSM48_MT_RR_EXT_MEAS_REP_ORD 0x37
1071#define GSM48_MT_RR_GPRS_SUSP_REQ 0x34
1072
Bhaskare6b45d82013-05-16 17:11:51 +05301073#define GSM48_MT_RR_VGCS_UPL_GRANT 0x09
Harald Welteec8b4502010-02-20 20:34:29 +01001074#define GSM48_MT_RR_UPLINK_RELEASE 0x0e
1075#define GSM48_MT_RR_UPLINK_FREE 0x0c
1076#define GSM48_MT_RR_UPLINK_BUSY 0x2a
1077#define GSM48_MT_RR_TALKER_IND 0x11
1078
1079#define GSM48_MT_RR_APP_INFO 0x38
1080
1081/* Table 10.2/3GPP TS 04.08 */
1082#define GSM48_MT_MM_IMSI_DETACH_IND 0x01
1083#define GSM48_MT_MM_LOC_UPD_ACCEPT 0x02
1084#define GSM48_MT_MM_LOC_UPD_REJECT 0x04
1085#define GSM48_MT_MM_LOC_UPD_REQUEST 0x08
1086
1087#define GSM48_MT_MM_AUTH_REJ 0x11
1088#define GSM48_MT_MM_AUTH_REQ 0x12
1089#define GSM48_MT_MM_AUTH_RESP 0x14
1090#define GSM48_MT_MM_ID_REQ 0x18
1091#define GSM48_MT_MM_ID_RESP 0x19
1092#define GSM48_MT_MM_TMSI_REALL_CMD 0x1a
1093#define GSM48_MT_MM_TMSI_REALL_COMPL 0x1b
1094
1095#define GSM48_MT_MM_CM_SERV_ACC 0x21
1096#define GSM48_MT_MM_CM_SERV_REJ 0x22
1097#define GSM48_MT_MM_CM_SERV_ABORT 0x23
1098#define GSM48_MT_MM_CM_SERV_REQ 0x24
1099#define GSM48_MT_MM_CM_SERV_PROMPT 0x25
1100#define GSM48_MT_MM_CM_REEST_REQ 0x28
1101#define GSM48_MT_MM_ABORT 0x29
1102
1103#define GSM48_MT_MM_NULL 0x30
1104#define GSM48_MT_MM_STATUS 0x31
1105#define GSM48_MT_MM_INFO 0x32
1106
1107/* Table 10.3/3GPP TS 04.08 */
1108#define GSM48_MT_CC_ALERTING 0x01
1109#define GSM48_MT_CC_CALL_CONF 0x08
1110#define GSM48_MT_CC_CALL_PROC 0x02
1111#define GSM48_MT_CC_CONNECT 0x07
1112#define GSM48_MT_CC_CONNECT_ACK 0x0f
1113#define GSM48_MT_CC_EMERG_SETUP 0x0e
1114#define GSM48_MT_CC_PROGRESS 0x03
1115#define GSM48_MT_CC_ESTAB 0x04
1116#define GSM48_MT_CC_ESTAB_CONF 0x06
1117#define GSM48_MT_CC_RECALL 0x0b
1118#define GSM48_MT_CC_START_CC 0x09
1119#define GSM48_MT_CC_SETUP 0x05
1120
1121#define GSM48_MT_CC_MODIFY 0x17
1122#define GSM48_MT_CC_MODIFY_COMPL 0x1f
1123#define GSM48_MT_CC_MODIFY_REJECT 0x13
1124#define GSM48_MT_CC_USER_INFO 0x10
1125#define GSM48_MT_CC_HOLD 0x18
1126#define GSM48_MT_CC_HOLD_ACK 0x19
1127#define GSM48_MT_CC_HOLD_REJ 0x1a
1128#define GSM48_MT_CC_RETR 0x1c
1129#define GSM48_MT_CC_RETR_ACK 0x1d
1130#define GSM48_MT_CC_RETR_REJ 0x1e
1131
1132#define GSM48_MT_CC_DISCONNECT 0x25
1133#define GSM48_MT_CC_RELEASE 0x2d
1134#define GSM48_MT_CC_RELEASE_COMPL 0x2a
1135
1136#define GSM48_MT_CC_CONG_CTRL 0x39
1137#define GSM48_MT_CC_NOTIFY 0x3e
1138#define GSM48_MT_CC_STATUS 0x3d
1139#define GSM48_MT_CC_STATUS_ENQ 0x34
1140#define GSM48_MT_CC_START_DTMF 0x35
1141#define GSM48_MT_CC_STOP_DTMF 0x31
1142#define GSM48_MT_CC_STOP_DTMF_ACK 0x32
1143#define GSM48_MT_CC_START_DTMF_ACK 0x36
1144#define GSM48_MT_CC_START_DTMF_REJ 0x37
1145#define GSM48_MT_CC_FACILITY 0x3a
1146
1147/* FIXME: Table 10.4 / 10.4a (GPRS) */
1148
Andreas Eversberg014cb872010-07-12 09:11:00 +02001149/* Section 10.5.3.3 CM service type */
1150#define GSM48_CMSERV_MO_CALL_PACKET 1
1151#define GSM48_CMSERV_EMERGENCY 2
1152#define GSM48_CMSERV_SMS 4
1153#define GSM48_CMSERV_SUP_SERV 8
1154#define GSM48_CMSERV_VGCS 9
1155#define GSM48_CMSERV_VBS 10
1156#define GSM48_CMSERV_LOC_SERV 11
1157
Harald Welteec8b4502010-02-20 20:34:29 +01001158/* Section 10.5.2.26, Table 10.5.64 */
1159#define GSM48_PM_MASK 0x03
1160#define GSM48_PM_NORMAL 0x00
1161#define GSM48_PM_EXTENDED 0x01
1162#define GSM48_PM_REORG 0x02
1163#define GSM48_PM_SAME 0x03
1164
1165/* Chapter 10.5.3.5 / Table 10.5.93 */
1166#define GSM48_LUPD_NORMAL 0x0
1167#define GSM48_LUPD_PERIODIC 0x1
1168#define GSM48_LUPD_IMSI_ATT 0x2
1169#define GSM48_LUPD_RESERVED 0x3
1170
1171/* Table 10.5.4 */
1172#define GSM_MI_TYPE_MASK 0x07
1173#define GSM_MI_TYPE_NONE 0x00
1174#define GSM_MI_TYPE_IMSI 0x01
1175#define GSM_MI_TYPE_IMEI 0x02
1176#define GSM_MI_TYPE_IMEISV 0x03
1177#define GSM_MI_TYPE_TMSI 0x04
1178#define GSM_MI_ODD 0x08
1179
Andreas Eversberg014cb872010-07-12 09:11:00 +02001180#define GSM48_IE_MOBILE_ID 0x17 /* 10.5.1.4 */
Harald Welteec8b4502010-02-20 20:34:29 +01001181#define GSM48_IE_NAME_LONG 0x43 /* 10.5.3.5a */
1182#define GSM48_IE_NAME_SHORT 0x45 /* 10.5.3.5a */
1183#define GSM48_IE_UTC 0x46 /* 10.5.3.8 */
1184#define GSM48_IE_NET_TIME_TZ 0x47 /* 10.5.3.9 */
1185#define GSM48_IE_LSA_IDENT 0x48 /* 10.5.3.11 */
Jacob Erlbeck1c3f0882013-09-16 10:29:57 +02001186#define GSM48_IE_NET_DST 0x49 /* 10.5.3.12 [24.008] */
Harald Welteec8b4502010-02-20 20:34:29 +01001187
1188#define GSM48_IE_BEARER_CAP 0x04 /* 10.5.4.5 */
1189#define GSM48_IE_CAUSE 0x08 /* 10.5.4.11 */
1190#define GSM48_IE_CC_CAP 0x15 /* 10.5.4.5a */
1191#define GSM48_IE_ALERT 0x19 /* 10.5.4.26 */
1192#define GSM48_IE_FACILITY 0x1c /* 10.5.4.15 */
1193#define GSM48_IE_PROGR_IND 0x1e /* 10.5.4.21 */
1194#define GSM48_IE_AUX_STATUS 0x24 /* 10.5.4.4 */
1195#define GSM48_IE_NOTIFY 0x27 /* 10.5.4.20 */
1196#define GSM48_IE_KPD_FACILITY 0x2c /* 10.5.4.17 */
1197#define GSM48_IE_SIGNAL 0x34 /* 10.5.4.23 */
1198#define GSM48_IE_CONN_BCD 0x4c /* 10.5.4.13 */
1199#define GSM48_IE_CONN_SUB 0x4d /* 10.5.4.14 */
1200#define GSM48_IE_CALLING_BCD 0x5c /* 10.5.4.9 */
1201#define GSM48_IE_CALLING_SUB 0x5d /* 10.5.4.10 */
1202#define GSM48_IE_CALLED_BCD 0x5e /* 10.5.4.7 */
1203#define GSM48_IE_CALLED_SUB 0x6d /* 10.5.4.8 */
1204#define GSM48_IE_REDIR_BCD 0x74 /* 10.5.4.21a */
1205#define GSM48_IE_REDIR_SUB 0x75 /* 10.5.4.21b */
1206#define GSM48_IE_LOWL_COMPAT 0x7c /* 10.5.4.18 */
1207#define GSM48_IE_HIGHL_COMPAT 0x7d /* 10.5.4.16 */
1208#define GSM48_IE_USER_USER 0x7e /* 10.5.4.25 */
1209#define GSM48_IE_SS_VERS 0x7f /* 10.5.4.24 */
1210#define GSM48_IE_MORE_DATA 0xa0 /* 10.5.4.19 */
1211#define GSM48_IE_CLIR_SUPP 0xa1 /* 10.5.4.11a */
1212#define GSM48_IE_CLIR_INVOC 0xa2 /* 10.5.4.11b */
1213#define GSM48_IE_REV_C_SETUP 0xa3 /* 10.5.4.22a */
1214#define GSM48_IE_REPEAT_CIR 0xd1 /* 10.5.4.22 */
1215#define GSM48_IE_REPEAT_SEQ 0xd3 /* 10.5.4.22 */
1216
1217/* Section 10.5.4.11 / Table 10.5.122 */
1218#define GSM48_CAUSE_CS_GSM 0x60
1219
1220/* Section 9.1.2 / Table 9.3 */
Andreas Eversberg014cb872010-07-12 09:11:00 +02001221/* RR elements */
1222#define GSM48_IE_VGCS_TARGET 0x01
1223//#define GSM48_IE_VGCS_T_MODE_I 0x01
1224#define GSM48_IE_FRQSHORT_AFTER 0x02
1225#define GSM48_IE_MUL_RATE_CFG 0x03 /* 10.5.2.21aa */
1226#define GSM48_IE_FREQ_L_AFTER 0x05
Harald Welteec8b4502010-02-20 20:34:29 +01001227#define GSM48_IE_MSLOT_DESC 0x10
Harald Welteec8b4502010-02-20 20:34:29 +01001228#define GSM48_IE_CHANMODE_2 0x11
Andreas Eversberg014cb872010-07-12 09:11:00 +02001229#define GSM48_IE_FRQSHORT_BEFORE 0x12
1230//#define GSM48_IE_FRQSHORT_BEFOR 0x12
Harald Welteec8b4502010-02-20 20:34:29 +01001231#define GSM48_IE_CHANMODE_3 0x13
1232#define GSM48_IE_CHANMODE_4 0x14
1233#define GSM48_IE_CHANMODE_5 0x15
1234#define GSM48_IE_CHANMODE_6 0x16
1235#define GSM48_IE_CHANMODE_7 0x17
1236#define GSM48_IE_CHANMODE_8 0x18
1237#define GSM48_IE_CHANDESC_2 0x64
Harald Welte639f74b2010-06-15 09:32:14 +02001238#define GSM48_IE_MA_AFTER 0x72
1239#define GSM48_IE_START_TIME 0x7c
1240#define GSM48_IE_FREQ_L_BEFORE 0x19
Andreas Eversberg014cb872010-07-12 09:11:00 +02001241//#define GSM48_IE_FRQLIST_BEFORE 0x19
Harald Welte639f74b2010-06-15 09:32:14 +02001242#define GSM48_IE_CH_DESC_1_BEFORE 0x1c
Andreas Eversberg014cb872010-07-12 09:11:00 +02001243//#define GSM48_IE_CHDES_1_BEFORE 0x1c
Harald Welte639f74b2010-06-15 09:32:14 +02001244#define GSM48_IE_CH_DESC_2_BEFORE 0x1d
Andreas Eversberg014cb872010-07-12 09:11:00 +02001245//#define GSM48_IE_CHDES_2_BEFORE 0x1d
Harald Welte639f74b2010-06-15 09:32:14 +02001246#define GSM48_IE_F_CH_SEQ_BEFORE 0x1e
Andreas Eversberg014cb872010-07-12 09:11:00 +02001247//#define GSM48_IE_FRQSEQ_BEFORE 0x1e
1248#define GSM48_IE_CLASSMARK3 0x20
Harald Welte639f74b2010-06-15 09:32:14 +02001249#define GSM48_IE_MA_BEFORE 0x21
Andreas Eversberg014cb872010-07-12 09:11:00 +02001250#define GSM48_IE_RR_PACKET_UL 0x22
1251#define GSM48_IE_RR_PACKET_DL 0x23
1252#define GSM48_IE_CELL_CH_DESC 0x62
1253#define GSM48_IE_CHANMODE_1 0x63
1254#define GSM48_IE_CHDES_2_AFTER 0x64
1255#define GSM48_IE_MODE_SEC_CH 0x66
1256#define GSM48_IE_F_CH_SEQ_AFTER 0x69
1257#define GSM48_IE_MA_AFTER 0x72
1258#define GSM48_IE_BA_RANGE 0x73
1259#define GSM48_IE_GROUP_CHDES 0x74
1260#define GSM48_IE_BA_LIST_PREF 0x75
1261#define GSM48_IE_MOB_OVSERV_DIF 0x77
1262#define GSM48_IE_REALTIME_DIFF 0x7b
1263#define GSM48_IE_START_TIME 0x7c
1264#define GSM48_IE_TIMING_ADVANCE 0x7d
1265#define GSM48_IE_GROUP_CIP_SEQ 0x80
1266#define GSM48_IE_CIP_MODE_SET 0x90
1267#define GSM48_IE_GPRS_RESUMPT 0xc0
1268#define GSM48_IE_SYNC_IND 0xd0
1269/* System Information 4 (types are equal IEs above) */
1270#define GSM48_IE_CBCH_CHAN_DESC 0x64
1271#define GSM48_IE_CBCH_MOB_AL 0x72
Harald Welte639f74b2010-06-15 09:32:14 +02001272
Andreas Eversberg014cb872010-07-12 09:11:00 +02001273/* Additional MM elements */
1274#define GSM48_IE_LOCATION_AREA 0x13
1275#define GSM48_IE_PRIORITY_LEV 0x80
1276#define GSM48_IE_FOLLOW_ON_PROC 0xa1
1277#define GSM48_IE_CTS_PERMISSION 0xa2
Harald Welteec8b4502010-02-20 20:34:29 +01001278
1279/* Section 10.5.4.23 / Table 10.5.130 */
1280enum gsm48_signal_val {
1281 GSM48_SIGNAL_DIALTONE = 0x00,
1282 GSM48_SIGNAL_RINGBACK = 0x01,
1283 GSM48_SIGNAL_INTERCEPT = 0x02,
1284 GSM48_SIGNAL_NET_CONG = 0x03,
1285 GSM48_SIGNAL_BUSY = 0x04,
1286 GSM48_SIGNAL_CONFIRM = 0x05,
1287 GSM48_SIGNAL_ANSWER = 0x06,
1288 GSM48_SIGNAL_CALL_WAIT = 0x07,
1289 GSM48_SIGNAL_OFF_HOOK = 0x08,
1290 GSM48_SIGNAL_OFF = 0x3f,
1291 GSM48_SIGNAL_ALERT_OFF = 0x4f,
1292};
1293
1294enum gsm48_cause_loc {
1295 GSM48_CAUSE_LOC_USER = 0x00,
1296 GSM48_CAUSE_LOC_PRN_S_LU = 0x01,
1297 GSM48_CAUSE_LOC_PUN_S_LU = 0x02,
1298 GSM48_CAUSE_LOC_TRANS_NET = 0x03,
1299 GSM48_CAUSE_LOC_PUN_S_RU = 0x04,
1300 GSM48_CAUSE_LOC_PRN_S_RU = 0x05,
1301 /* not defined */
1302 GSM48_CAUSE_LOC_INN_NET = 0x07,
1303 GSM48_CAUSE_LOC_NET_BEYOND = 0x0a,
1304};
1305
1306/* Section 10.5.2.31 RR Cause / Table 10.5.70 */
1307enum gsm48_rr_cause {
1308 GSM48_RR_CAUSE_NORMAL = 0x00,
1309 GSM48_RR_CAUSE_ABNORMAL_UNSPEC = 0x01,
1310 GSM48_RR_CAUSE_ABNORMAL_UNACCT = 0x02,
1311 GSM48_RR_CAUSE_ABNORMAL_TIMER = 0x03,
1312 GSM48_RR_CAUSE_ABNORMAL_NOACT = 0x04,
1313 GSM48_RR_CAUSE_PREMPTIVE_REL = 0x05,
Andreas Eversbergc8cac642013-06-19 20:58:59 +02001314 GSM48_RR_CAUSE_HNDOVER_IMP = 0x08,
1315 GSM48_RR_CAUSE_CHAN_MODE_UNACCT = 0x09,
1316 GSM48_RR_CAUSE_FREQ_NOT_IMPL = 0x0a,
Harald Welteec8b4502010-02-20 20:34:29 +01001317 GSM48_RR_CAUSE_CALL_CLEARED = 0x41,
1318 GSM48_RR_CAUSE_SEMANT_INCORR = 0x5f,
1319 GSM48_RR_CAUSE_INVALID_MAND_INF = 0x60,
1320 GSM48_RR_CAUSE_MSG_TYPE_N = 0x61,
1321 GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT= 0x62,
1322 GSM48_RR_CAUSE_COND_IE_ERROR = 0x64,
1323 GSM48_RR_CAUSE_NO_CELL_ALLOC_A = 0x65,
1324 GSM48_RR_CAUSE_PROT_ERROR_UNSPC = 0x6f,
1325};
1326
1327/* Section 10.5.4.11 CC Cause / Table 10.5.123 */
1328enum gsm48_cc_cause {
1329 GSM48_CC_CAUSE_UNASSIGNED_NR = 1,
1330 GSM48_CC_CAUSE_NO_ROUTE = 3,
1331 GSM48_CC_CAUSE_CHAN_UNACCEPT = 6,
1332 GSM48_CC_CAUSE_OP_DET_BARRING = 8,
1333 GSM48_CC_CAUSE_NORM_CALL_CLEAR = 16,
1334 GSM48_CC_CAUSE_USER_BUSY = 17,
1335 GSM48_CC_CAUSE_USER_NOTRESPOND = 18,
1336 GSM48_CC_CAUSE_USER_ALERTING_NA = 19,
1337 GSM48_CC_CAUSE_CALL_REJECTED = 21,
1338 GSM48_CC_CAUSE_NUMBER_CHANGED = 22,
1339 GSM48_CC_CAUSE_PRE_EMPTION = 25,
1340 GSM48_CC_CAUSE_NONSE_USER_CLR = 26,
1341 GSM48_CC_CAUSE_DEST_OOO = 27,
1342 GSM48_CC_CAUSE_INV_NR_FORMAT = 28,
1343 GSM48_CC_CAUSE_FACILITY_REJ = 29,
1344 GSM48_CC_CAUSE_RESP_STATUS_INQ = 30,
1345 GSM48_CC_CAUSE_NORMAL_UNSPEC = 31,
1346 GSM48_CC_CAUSE_NO_CIRCUIT_CHAN = 34,
1347 GSM48_CC_CAUSE_NETWORK_OOO = 38,
1348 GSM48_CC_CAUSE_TEMP_FAILURE = 41,
1349 GSM48_CC_CAUSE_SWITCH_CONG = 42,
1350 GSM48_CC_CAUSE_ACC_INF_DISCARD = 43,
1351 GSM48_CC_CAUSE_REQ_CHAN_UNAVAIL = 44,
1352 GSM48_CC_CAUSE_RESOURCE_UNAVAIL = 47,
1353 GSM48_CC_CAUSE_QOS_UNAVAIL = 49,
1354 GSM48_CC_CAUSE_REQ_FAC_NOT_SUBSC= 50,
1355 GSM48_CC_CAUSE_INC_BARRED_CUG = 55,
1356 GSM48_CC_CAUSE_BEARER_CAP_UNAUTH= 57,
1357 GSM48_CC_CAUSE_BEARER_CA_UNAVAIL= 58,
1358 GSM48_CC_CAUSE_SERV_OPT_UNAVAIL = 63,
1359 GSM48_CC_CAUSE_BEARERSERV_UNIMPL= 65,
1360 GSM48_CC_CAUSE_ACM_GE_ACM_MAX = 68,
1361 GSM48_CC_CAUSE_REQ_FAC_NOTIMPL = 69,
1362 GSM48_CC_CAUSE_RESTR_BCAP_AVAIL = 70,
1363 GSM48_CC_CAUSE_SERV_OPT_UNIMPL = 79,
1364 GSM48_CC_CAUSE_INVAL_TRANS_ID = 81,
1365 GSM48_CC_CAUSE_USER_NOT_IN_CUG = 87,
1366 GSM48_CC_CAUSE_INCOMPAT_DEST = 88,
1367 GSM48_CC_CAUSE_INVAL_TRANS_NET = 91,
1368 GSM48_CC_CAUSE_SEMANTIC_INCORR = 95,
1369 GSM48_CC_CAUSE_INVAL_MAND_INF = 96,
1370 GSM48_CC_CAUSE_MSGTYPE_NOTEXIST = 97,
1371 GSM48_CC_CAUSE_MSGTYPE_INCOMPAT = 98,
1372 GSM48_CC_CAUSE_IE_NOTEXIST = 99,
1373 GSM48_CC_CAUSE_COND_IE_ERR = 100,
1374 GSM48_CC_CAUSE_MSG_INCOMP_STATE = 101,
1375 GSM48_CC_CAUSE_RECOVERY_TIMER = 102,
1376 GSM48_CC_CAUSE_PROTO_ERR = 111,
1377 GSM48_CC_CAUSE_INTERWORKING = 127,
1378};
1379
1380/* Annex G, GSM specific cause values for mobility management */
1381enum gsm48_reject_value {
1382 GSM48_REJECT_IMSI_UNKNOWN_IN_HLR = 2,
1383 GSM48_REJECT_ILLEGAL_MS = 3,
1384 GSM48_REJECT_IMSI_UNKNOWN_IN_VLR = 4,
1385 GSM48_REJECT_IMEI_NOT_ACCEPTED = 5,
1386 GSM48_REJECT_ILLEGAL_ME = 6,
1387 GSM48_REJECT_PLMN_NOT_ALLOWED = 11,
1388 GSM48_REJECT_LOC_NOT_ALLOWED = 12,
1389 GSM48_REJECT_ROAMING_NOT_ALLOWED = 13,
1390 GSM48_REJECT_NETWORK_FAILURE = 17,
1391 GSM48_REJECT_CONGESTION = 22,
1392 GSM48_REJECT_SRV_OPT_NOT_SUPPORTED = 32,
1393 GSM48_REJECT_RQD_SRV_OPT_NOT_SUPPORTED = 33,
1394 GSM48_REJECT_SRV_OPT_TMP_OUT_OF_ORDER = 34,
1395 GSM48_REJECT_CALL_CAN_NOT_BE_IDENTIFIED = 38,
1396 GSM48_REJECT_INCORRECT_MESSAGE = 95,
1397 GSM48_REJECT_INVALID_MANDANTORY_INF = 96,
1398 GSM48_REJECT_MSG_TYPE_NOT_IMPLEMENTED = 97,
1399 GSM48_REJECT_MSG_TYPE_NOT_COMPATIBLE = 98,
1400 GSM48_REJECT_INF_ELEME_NOT_IMPLEMENTED = 99,
1401 GSM48_REJECT_CONDTIONAL_IE_ERROR = 100,
1402 GSM48_REJECT_MSG_NOT_COMPATIBLE = 101,
1403 GSM48_REJECT_PROTOCOL_ERROR = 111,
1404
1405 /* according to G.6 Additional cause codes for GMM */
1406 GSM48_REJECT_GPRS_NOT_ALLOWED = 7,
1407 GSM48_REJECT_SERVICES_NOT_ALLOWED = 8,
1408 GSM48_REJECT_MS_IDENTITY_NOT_DERVIVABLE = 9,
1409 GSM48_REJECT_IMPLICITLY_DETACHED = 10,
1410 GSM48_REJECT_GPRS_NOT_ALLOWED_IN_PLMN = 14,
1411 GSM48_REJECT_MSC_TMP_NOT_REACHABLE = 16,
1412};
1413
1414enum chreq_type {
1415 CHREQ_T_EMERG_CALL,
1416 CHREQ_T_CALL_REEST_TCH_F,
1417 CHREQ_T_CALL_REEST_TCH_H,
1418 CHREQ_T_CALL_REEST_TCH_H_DBL,
1419 CHREQ_T_SDCCH,
1420 CHREQ_T_TCH_F,
1421 CHREQ_T_VOICE_CALL_TCH_H,
1422 CHREQ_T_DATA_CALL_TCH_H,
1423 CHREQ_T_LOCATION_UPD,
1424 CHREQ_T_PAG_R_ANY_NECI0,
1425 CHREQ_T_PAG_R_ANY_NECI1,
1426 CHREQ_T_PAG_R_TCH_F,
1427 CHREQ_T_PAG_R_TCH_FH,
1428 CHREQ_T_LMU,
1429 CHREQ_T_RESERVED_SDCCH,
1430 CHREQ_T_RESERVED_IGNORE,
1431};
1432
1433/* Chapter 11.3 */
1434#define GSM48_T301 180, 0
1435#define GSM48_T303 30, 0
1436#define GSM48_T305 30, 0
1437#define GSM48_T306 30, 0
1438#define GSM48_T308 10, 0
1439#define GSM48_T310 180, 0
1440#define GSM48_T313 30, 0
1441#define GSM48_T323 30, 0
1442#define GSM48_T331 30, 0
1443#define GSM48_T333 30, 0
1444#define GSM48_T334 25, 0 /* min 15 */
1445#define GSM48_T338 30, 0
Andreas Eversberg014cb872010-07-12 09:11:00 +02001446#define GSM48_T303_MS 30, 0
1447#define GSM48_T305_MS 30, 0
1448#define GSM48_T308_MS 30, 0
1449#define GSM48_T310_MS 30, 0
1450#define GSM48_T313_MS 30, 0
1451#define GSM48_T323_MS 30, 0
1452#define GSM48_T332_MS 30, 0
1453#define GSM48_T335_MS 30, 0
Harald Welteec8b4502010-02-20 20:34:29 +01001454
1455/* Chapter 5.1.2.2 */
1456#define GSM_CSTATE_NULL 0
1457#define GSM_CSTATE_INITIATED 1
Andreas Eversberg1ef041f2010-04-09 07:52:12 +02001458#define GSM_CSTATE_MM_CONNECTION_PEND 2 /* see 10.5.4.6 */
Harald Welteec8b4502010-02-20 20:34:29 +01001459#define GSM_CSTATE_MO_CALL_PROC 3
1460#define GSM_CSTATE_CALL_DELIVERED 4
1461#define GSM_CSTATE_CALL_PRESENT 6
1462#define GSM_CSTATE_CALL_RECEIVED 7
1463#define GSM_CSTATE_CONNECT_REQUEST 8
1464#define GSM_CSTATE_MO_TERM_CALL_CONF 9
1465#define GSM_CSTATE_ACTIVE 10
1466#define GSM_CSTATE_DISCONNECT_REQ 12
1467#define GSM_CSTATE_DISCONNECT_IND 12
1468#define GSM_CSTATE_RELEASE_REQ 19
1469#define GSM_CSTATE_MO_ORIG_MODIFY 26
1470#define GSM_CSTATE_MO_TERM_MODIFY 27
1471#define GSM_CSTATE_CONNECT_IND 28
1472
1473#define SBIT(a) (1 << a)
1474#define ALL_STATES 0xffffffff
1475
1476/* Table 10.5.3/3GPP TS 04.08: Location Area Identification information element */
1477#define GSM_LAC_RESERVED_DETACHED 0x0
1478#define GSM_LAC_RESERVED_ALL_BTS 0xfffe
1479
1480/* GSM 04.08 Bearer Capability: Information Transfer Capability */
1481enum gsm48_bcap_itcap {
1482 GSM48_BCAP_ITCAP_SPEECH = 0,
1483 GSM48_BCAP_ITCAP_UNR_DIG_INF = 1,
1484 GSM48_BCAP_ITCAP_3k1_AUDIO = 2,
1485 GSM48_BCAP_ITCAP_FAX_G3 = 3,
1486 GSM48_BCAP_ITCAP_OTHER = 5,
1487 GSM48_BCAP_ITCAP_RESERVED = 7,
1488};
1489
1490/* GSM 04.08 Bearer Capability: Transfer Mode */
1491enum gsm48_bcap_tmod {
1492 GSM48_BCAP_TMOD_CIRCUIT = 0,
1493 GSM48_BCAP_TMOD_PACKET = 1,
1494};
1495
1496/* GSM 04.08 Bearer Capability: Coding Standard */
1497enum gsm48_bcap_coding {
1498 GSM48_BCAP_CODING_GSM_STD = 0,
1499};
1500
1501/* GSM 04.08 Bearer Capability: Radio Channel Requirements */
1502enum gsm48_bcap_rrq {
1503 GSM48_BCAP_RRQ_FR_ONLY = 1,
1504 GSM48_BCAP_RRQ_DUAL_HR = 2,
1505 GSM48_BCAP_RRQ_DUAL_FR = 3,
1506};
1507
Harald Weltec8a0b932012-08-24 21:27:26 +02001508/* GSM 04.08 Bearer Capability: Rate Adaption */
1509enum gsm48_bcap_ra {
1510 GSM48_BCAP_RA_NONE = 0,
1511 GSM48_BCAP_RA_V110_X30 = 1,
1512 GSM48_BCAP_RA_X31 = 2,
1513 GSM48_BCAP_RA_OTHER = 3,
1514};
1515
1516/* GSM 04.08 Bearer Capability: Signalling access protocol */
1517enum gsm48_bcap_sig_access {
1518 GSM48_BCAP_SA_I440_I450 = 1,
1519 GSM48_BCAP_SA_X21 = 2,
1520 GSM48_BCAP_SA_X28_DP_IN = 3,
1521 GSM48_BCAP_SA_X28_DP_UN = 4,
1522 GSM48_BCAP_SA_X28_NDP = 5,
1523 GSM48_BCAP_SA_X32 = 6,
1524};
1525
1526/* GSM 04.08 Bearer Capability: User Rate */
1527enum gsm48_bcap_user_rate {
1528 GSM48_BCAP_UR_300 = 1,
1529 GSM48_BCAP_UR_1200 = 2,
1530 GSM48_BCAP_UR_2400 = 3,
1531 GSM48_BCAP_UR_4800 = 4,
1532 GSM48_BCAP_UR_9600 = 5,
1533 GSM48_BCAP_UR_12000 = 6,
1534 GSM48_BCAP_UR_1200_75 = 7,
1535};
1536
1537/* GSM 04.08 Bearer Capability: Parity */
1538enum gsm48_bcap_parity {
1539 GSM48_BCAP_PAR_ODD = 0,
1540 GSM48_BCAP_PAR_EVEN = 2,
1541 GSM48_BCAP_PAR_NONE = 3,
1542 GSM48_BCAP_PAR_ZERO = 4,
1543 GSM48_BCAP_PAR_ONE = 5,
1544};
1545
1546/* GSM 04.08 Bearer Capability: Intermediate Rate */
1547enum gsm48_bcap_interm_rate {
1548 GSM48_BCAP_IR_8k = 2,
1549 GSM48_BCAP_IR_16k = 3,
1550};
1551
1552/* GSM 04.08 Bearer Capability: Transparency */
1553enum gsm48_bcap_transp {
1554 GSM48_BCAP_TR_TRANSP = 0,
1555 GSM48_BCAP_TR_RLP = 1,
1556 GSM48_BCAP_TR_TR_PREF = 2,
1557 GSM48_BCAP_TR_RLP_PREF = 3,
1558};
1559
1560/* GSM 04.08 Bearer Capability: Modem Type */
1561enum gsm48_bcap_modem_type {
1562 GSM48_BCAP_MT_NONE = 0,
1563 GSM48_BCAP_MT_V21 = 1,
1564 GSM48_BCAP_MT_V22 = 2,
1565 GSM48_BCAP_MT_V22bis = 3,
1566 GSM48_BCAP_MT_V23 = 4,
1567 GSM48_BCAP_MT_V26ter = 5,
1568 GSM48_BCAP_MT_V32 = 6,
1569 GSM48_BCAP_MT_UNDEF = 7,
1570 GSM48_BCAP_MT_AUTO_1 = 8,
1571};
1572
Harald Welte30a8ec42012-08-24 23:00:05 +02001573/* GSM 04.08 Bearer Capability: Speech Version Indication */
1574enum gsm48_bcap_speech_ver {
1575 GSM48_BCAP_SV_FR = 0,
1576 GSM48_BCAP_SV_HR = 1,
1577 GSM48_BCAP_SV_EFR = 2,
1578 GSM48_BCAP_SV_AMR_F = 4,
1579 GSM48_BCAP_SV_AMR_H = 5,
1580};
1581
Harald Welteec8b4502010-02-20 20:34:29 +01001582#define GSM48_TMSI_LEN 5
1583#define GSM48_MID_TMSI_LEN (GSM48_TMSI_LEN + 2)
1584#define GSM48_MI_SIZE 32
1585
Harald Weltea1c4f762010-05-01 11:59:42 +02001586/* Chapter 10.4.4.15 */
1587struct gsm48_ra_id {
1588 uint8_t digits[3]; /* MCC + MNC BCD digits */
1589 uint16_t lac; /* Location Area Code */
1590 uint8_t rac; /* Routing Area Code */
1591} __attribute__ ((packed));
1592
Harald Welteb5503132011-05-24 15:01:53 +02001593#define GSM48_CELL_CHAN_DESC_SIZE 16
Harald Weltea1c4f762010-05-01 11:59:42 +02001594
Harald Welteb5503132011-05-24 15:01:53 +02001595#define GSM_MACBLOCK_LEN 23
1596#define GSM_MACBLOCK_PADDING 0x2b