blob: f10d8219006a7f584adc7923bfec54e5fc6fe7aa [file] [log] [blame]
Harald Welte52b1f982008-12-23 20:25:15 +00001#ifndef _GSM_04_08_H
2#define _GSM_04_08_H
3
4/* GSM TS 04.08 definitions */
5
6/* Chapter 10.5.2.5 */
7struct gsm48_chan_desc {
8 u_int8_t chan_nr;
9 union {
10 struct {
11 u_int8_t maio_high:4,
12 h:1,
13 tsc:3;
14 u_int8_t hsn:6,
15 maio_low:2;
16 } h1;
17 struct {
18 u_int8_t arfcn_high:2,
19 spare:2,
20 h:1,
21 tsc:3;
22 u_int8_t arfcn_low;
23 } h0;
24 };
25};
26
27/* Chapter 10.5.2.30 */
28struct gsm48_req_ref {
29 u_int8_t ra;
30 u_int8_t t3_high:3,
31 t1_:5;
32 u_int8_t t2:5,
33 t3_low:3;
34};
35
36/* Chapter 9.1.18 */
37struct gsm48_imm_ass {
38 u_int8_t l2_plen;
39 u_int8_t proto_discr;
40 u_int8_t msg_type;
41 u_int8_t page_mode;
42 struct gsm48_chan_desc chan_desc;
43 struct gsm48_req_ref req_ref;
44 u_int8_t timing_advance;
45 u_int8_t mob_alloc_len;
46 u_int8_t mob_alloc[0];
47};
48
Harald Welte4b634542008-12-27 01:55:51 +000049/* Chapter 10.5.1.3 */
Harald Welte52b1f982008-12-23 20:25:15 +000050struct gsm48_loc_area_id {
51 u_int8_t digits[3]; /* BCD! */
52 u_int16_t lac;
53} __attribute__ ((packed));
54
55/* Section 9.2.15 */
56struct gsm48_loc_upd_req {
57 u_int8_t type:4,
58 key_seq:4;
59 struct gsm48_loc_area_id lai;
60 u_int8_t classmark1;
Harald Welte52b1f982008-12-23 20:25:15 +000061 u_int8_t mi_len;
62 u_int8_t mi[0];
63} __attribute__ ((packed));
64
65/* Section 10.1 */
66struct gsm48_hdr {
67 u_int8_t proto_discr;
68 u_int8_t msg_type;
69 u_int8_t data[0];
70} __attribute__ ((packed));
71
Harald Weltebcae43f2008-12-27 21:45:37 +000072/* Section 10.2 + GSM 04.07 12.2.3.1.1 */
73#define GSM48_PDISC_GROUP_CC 0x00
74#define GSM48_PDISC_BCAST_CC 0x01
75#define GSM48_PDISC_PDSS1 0x02
Harald Welte4b634542008-12-27 01:55:51 +000076#define GSM48_PDISC_CC 0x03
Harald Weltebcae43f2008-12-27 21:45:37 +000077#define GSM48_PDISC_PDSS2 0x04
Harald Welte52b1f982008-12-23 20:25:15 +000078#define GSM48_PDISC_MM 0x05
79#define GSM48_PDISC_RR 0x06
80#define GSM48_PDISC_MM_GPRS 0x08
Harald Weltebcae43f2008-12-27 21:45:37 +000081#define GSM48_PDISC_SMS 0x09
82#define GSM48_PDISC_SM_GPRS 0x0a
83#define GSM48_PDISC_NC_SS 0x0b
84#define GSM48_PDISC_LOC 0x0c
Harald Welte52b1f982008-12-23 20:25:15 +000085
86/* Section 10.4 */
87#define GSM48_MT_RR_INIT_REQ 0x3c
88#define GSM48_MT_RR_ADD_ASS 0x3b
89#define GSM48_MT_RR_IMM_ASS 0x3f
90#define GSM48_MT_RR_IMM_ASS_EXT 0x39
91#define GSM48_MT_RR_IMM_ASS_REJ 0x3a
92
93#define GSM48_MT_RR_CIPH_M_CMD 0x35
94#define GSM48_MT_RR_CIPH_M_COMPL 0x32
95
96#define GSM48_MT_RR_CFG_CHG_CMD 0x30
97#define GSM48_MT_RR_CFG_CHG_ACK 0x31
98#define GSM48_MT_RR_CFG_CHG_REJ 0x33
99
100#define GSM48_MT_RR_ASS_CMD 0x2e
101#define GSM48_MT_RR_ASS_COMPL 0x29
102#define GSM48_MT_RR_ASS_FAIL 0x2f
103#define GSM48_MT_RR_HANDO_CMD 0x2b
104#define GSM48_MT_RR_HANDO_COMPL 0x2c
105#define GSM48_MT_RR_HANDO_FAIL 0x28
106#define GSM48_MT_RR_HANDO_INFO 0x2d
107
108#define GSM48_MT_RR_CELL_CHG_ORDER 0x08
109#define GSM48_MT_RR_PDCH_ASS_CMD 0x23
110
111#define GSM48_MT_RR_CHAN_REL 0x0d
112#define GSM48_MT_RR_PART_REL 0x0a
113#define GSM48_MT_RR_PART_REL_COMP 0x0f
114
115#define GSM48_MT_RR_PAG_REQ_1 0x21
116#define GSM48_MT_RR_PAG_REQ_2 0x22
117#define GSM48_MT_RR_PAG_REQ_3 0x24
118#define GSM48_MT_RR_PAG_RESP 0x27
119#define GSM48_MT_RR_NOTIF_NCH 0x20
120#define GSM48_MT_RR_NOTIF_FACCH 0x25
121#define GSM48_MT_RR_NOTIF_RESP 0x26
122
123#define GSM48_MT_RR_SYSINFO_8 0x18
124#define GSM48_MT_RR_SYSINFO_1 0x19
125#define GSM48_MT_RR_SYSINFO_2 0x1a
126#define GSM48_MT_RR_SYSINFO_3 0x1b
127#define GSM48_MT_RR_SYSINFO_4 0x1c
128#define GSM48_MT_RR_SYSINFO_5 0x1d
129#define GSM48_MT_RR_SYSINFO_6 0x1e
130#define GSM48_MT_RR_SYSINFO_7 0x1f
131
132#define GSM48_MT_RR_SYSINFO_2bis 0x02
133#define GSM48_MT_RR_SYSINFO_2ter 0x03
134#define GSM48_MT_RR_SYSINFO_5bis 0x05
135#define GSM48_MT_RR_SYSINFO_5ter 0x06
136#define GSM48_MT_RR_SYSINFO_9 0x04
137#define GSM48_MT_RR_SYSINFO_13 0x00
138
139#define GSM48_MT_RR_SYSINFO_16 0x3d
140#define GSM48_MT_RR_SYSINFO_17 0x3e
141
142#define GSM48_MT_RR_CHAN_MODE_MODIF 0x10
143#define GSM48_MT_RR_STATUS 0x12
144#define GSM48_MT_RR_CHAN_MODE_MODIF_ACK 0x17
145#define GSM48_MT_RR_FREQ_REDEF 0x14
146#define GSM48_MT_RR_MEAS_REP 0x15
147#define GSM48_MT_RR_CLSM_CHG 0x16
148#define GSM48_MT_RR_CLSM_ENQ 0x13
149#define GSM48_MT_RR_EXT_MEAS_REP 0x36
150#define GSM48_MT_RR_EXT_MEAS_REP_ORD 0x37
151#define GSM48_MT_RR_GPRS_SUSP_REQ 0x34
152
153#define GSM48_MT_RR_VGCS_UPL_GRANT 0x08
154#define GSM48_MT_RR_UPLINK_RELEASE 0x0e
155#define GSM48_MT_RR_UPLINK_FREE 0x0c
156#define GSM48_MT_RR_UPLINK_BUSY 0x2a
157#define GSM48_MT_RR_TALKER_IND 0x11
158
159#define GSM48_MT_RR_APP_INFO 0x38
160
161/* Table 10.2/3GPP TS 04.08 */
162#define GSM48_MT_MM_IMSI_DETACH_IND 0x01
163#define GSM48_MT_MM_LOC_UPD_ACCEPT 0x02
164#define GSM48_MT_MM_LOC_UPD_REJECT 0x04
165#define GSM48_MT_MM_LOC_UPD_REQUEST 0x08
166
167#define GSM48_MT_MM_AUTH_REJ 0x11
168#define GSM48_MT_MM_AUTH_REQ 0x12
169#define GSM48_MT_MM_AUTH_RESP 0x14
170#define GSM48_MT_MM_ID_REQ 0x18
171#define GSM48_MT_MM_ID_RESP 0x19
172#define GSM48_MT_MM_TMSI_REALL_CMD 0x1a
173#define GSM48_MT_MM_TMSI_REALL_COMPL 0x1b
174
175#define GSM48_MT_MM_CM_SERV_ACC 0x21
176#define GSM48_MT_MM_CM_SERV_REJ 0x22
177#define GSM48_MT_MM_CM_SERV_ABORT 0x23
178#define GSM48_MT_MM_CM_SERV_REQ 0x24
179#define GSM48_MT_MM_CM_SERV_PROMPT 0x25
180#define GSM48_MT_MM_CM_REEST_REQ 0x28
181#define GSM48_MT_MM_ABORT 0x29
182
183#define GSM48_MT_MM_NULL 0x30
184#define GSM48_MT_MM_STATUS 0x31
185#define GSM48_MT_MM_INFO 0x32
186
187/* Table 10.3/3GPP TS 04.08 */
188#define GSM48_MT_CC_ALERTING 0x01
189#define GSM48_MT_CC_CALL_CONF 0x08
190#define GSM48_MT_CC_CALL_PROC 0x02
191#define GSM48_MT_CC_CONNECT 0x07
192#define GSM48_MT_CC_CONNECT_ACK 0x0f
193#define GSM48_MT_CC_EMERG_SETUP 0x0e
194#define GSM48_MT_CC_PROGRESS 0x03
195#define GSM48_MT_CC_ESTAB 0x04
196#define GSM48_MT_CC_ESTAB_CONF 0x06
197#define GSM48_MT_CC_RECALL 0x0b
198#define GSM48_MT_CC_START_CC 0x09
199#define GSM48_MT_CC_SETUP 0x05
200
201#define GSM48_MT_CC_MODIFY 0x17
202#define GSM48_MT_CC_MODIFY_COMPL 0x1f
203#define GSM48_MT_CC_MODIFY_REJECT 0x13
204#define GSM48_MT_CC_USER_INFO 0x10
205#define GSM48_MT_CC_HOLD 0x18
206#define GSM48_MT_CC_HOLD_ACK 0x19
207#define GSM48_MT_CC_HOLD_REJ 0x1a
208#define GSM48_MT_CC_RETR 0x1c
209#define GSM48_MT_CC_RETR_ACK 0x1d
210#define GSM48_MT_CC_RETR_REJ 0x1e
211
212#define GSM48_MT_CC_DISCONNECT 0x25
213#define GSM48_MT_CC_RELEASE 0x2d
214#define GSM48_MT_CC_RELEASE_COMPL 0xea
215
216#define GSM48_MT_CC_CONG_CTRL 0x39
217#define GSM48_MT_CC_NOTIFY 0x3e
218#define GSM48_MT_CC_STATUS 0x3d
219#define GSM48_MT_CC_STATUS_ENQ 0x34
220#define GSM48_MT_CC_START_DTMF 0x35
221#define GSM48_MT_CC_STOP_DTMF 0x31
222#define GSM48_MT_CC_STOP_DTMF_ACK 0x32
223#define GSM48_MT_CC_START_DTMF_ACK 0x36
224#define GSM48_MT_CC_START_DTMF_REJ 0x37
225#define GSM48_MT_CC_FACILITY 0x3a
226
227/* FIXME: Table 10.4 / 10.4a (GPRS) */
228
229/* Section 10.5.2.26, Table 10.5.64 */
230#define GSM48_PM_MASK 0x03
231#define GSM48_PM_NORMAL 0x00
232#define GSM48_PM_EXTENDED 0x01
233#define GSM48_PM_REORG 0x02
234#define GSM48_PM_SAME 0x03
235
236/* Table 10.5.4 */
237#define GSM_MI_TYPE_MASK 0x07
238#define GSM_MI_TYPE_NONE 0x00
239#define GSM_MI_TYPE_IMSI 0x01
240#define GSM_MI_TYPE_IMEI 0x02
241#define GSM_MI_TYPE_IMEISV 0x03
242#define GSM_MI_TYPE_TMSI 0x04
243#define GSM_MI_ODD 0x08
244
Harald Welte4b634542008-12-27 01:55:51 +0000245#define GSM48_IE_MOBILE_ID 0x17
246
247/* Section 10.5.4.11 / Table 10.5.122 */
248#define GSM48_CAUSE_CS_GSM 0x60
249
250enum gsm48_cause_loc {
251 GSM48_CAUSE_LOC_USER = 0x00,
252 GSM48_CAUSE_LOC_PRN_S_LU = 0x01,
253 GSM48_CAUSE_LOC_PUN_S_LU = 0x02,
254 GSM48_CAUSE_LOC_TRANS_NET = 0x03,
255 GSM48_CAUSE_LOC_PUN_S_RU = 0x04,
256 GSM48_CAUSE_LOC_PRN_S_RU = 0x05,
257 /* not defined */
258 GSM48_CAUSE_LOC_INN_NET = 0x07,
259 GSM48_CAUSE_LOC_NET_BEYOND = 0x0a,
260};
261
Harald Welte8470bf22008-12-25 23:28:35 +0000262struct msgb;
263struct gsm_bts;
264
265int gsm0408_rcvmsg(struct msgb *msg);
266enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra);
267
268
Harald Welte52b1f982008-12-23 20:25:15 +0000269#endif