blob: 9413f657794ad3c45eac0cbf9b2983f1dbc64941 [file] [log] [blame]
Harald Welte52b1f982008-12-23 20:25:15 +00001/* GSM Radio Signalling Link messages on the A-bis interface
2 * 3GPP TS 08.58 version 8.6.0 Release 1999 / ETSI TS 100 596 V8.6.0 */
3
4/* (C) 2008 by Harald Welte <laforge@gnumonks.org>
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 */
22
23#ifndef _RSL_H
24#define _RSL_H
25
26struct abis_rsl_common_hdr {
27 u_int8_t msg_discr;
28 u_int8_t msg_type;
29 u_int8_t data[0];
30} __attribute__ ((packed));
31
32/* Chapter 8.3 */
33struct abis_rsl_rll_hdr {
34 struct abis_rsl_common_hdr c;
35 u_int8_t ie_chan;
36 u_int8_t chan_nr;
37 u_int8_t ie_link_id;
38 u_int8_t link_id;
39 u_int8_t data[0];
40} __attribute__ ((packed));
41
42/* Chapter 8.3 and 8.4 */
43struct abis_rsl_dchan_hdr {
44 struct abis_rsl_common_hdr c;
45 u_int8_t ie_chan;
46 u_int8_t chan_nr;
47 u_int8_t data[0];
48} __attribute__ ((packed));
49
50
51/* Chapter 9.1 */
52#define ABIS_RSL_MDISC_RLL 0x02
53#define ABIS_RSL_MDISC_DED_CHAN 0x08
54#define ABIS_RSL_MDISC_COM_CHAN 0x0c
55#define ABIS_RSL_MDISC_TRX 0x10
56#define ABIS_RSL_MDISC_LOC 0x20
57
58#define ABIS_RSL_MDISC_IS_TRANSP(x) (x & 0x01)
59
60/* Chapter 9.2 */
61enum abis_rsl_msgtype {
62 /* Radio Link Layer Management */
63 RSL_MT_DATA_REQ = 0x01,
64 RSL_MT_DATA_IND,
65 RSL_MT_ERROR_IND,
66 RSL_MT_EST_REQ,
67 RSL_MT_EST_CONF,
68 RSL_MT_EST_IND,
69 RSL_MT_REL_REQ,
70 RSL_MT_REL_CONF,
71 RSL_MT_REL_IND,
72 RSL_MT_UNIT_DATA_REQ,
73 RSL_MT_UNIT_DATA_IND, /* 0x0b */
74
75 /* Common Channel Management / TRX Management */
76 RSL_MT_BCCH_INFO = 0x11,
77 RSL_MT_CCCH_LOAD_IND,
78 RSL_MT_CHAN_RQD,
79 RSL_MT_DELETE_IND,
80 RSL_MT_PAGING_CMD,
81 RSL_MT_IMMEDIATE_ASSIGN_CMD,
82 RSL_MT_SMS_BC_REQ,
83 /* empty */
84 RSL_MT_RF_RES_IND = 0x19,
85 RSL_MT_SACCH_FILL,
86 RSL_MT_OVERLOAD,
87 RSL_MT_ERROR_REPORT,
88 RSL_MT_SMS_BC_CMD,
89 RSL_MT_CBCH_LOAD_IND,
90 RSL_MT_NOT_CMD, /* 0x1f */
91
92 /* Dedicate Channel Management */
93 RSL_MT_CHAN_ACTIV = 0x21,
94 RSL_MT_CHAN_ACTIV_ACK,
95 RSL_MT_CHAN_ACTIV_NACK,
96 RSL_MT_CONN_FAIL,
97 RSL_MT_DEACTIVATE_SACCH,
98 RSL_MT_ENCR_CMD,
99 RSL_MT_HANDO_DET,
100 RSL_MT_MEAS_RES,
101 RSL_MT_MODE_MODIFY_REQ,
102 RSL_MT_MODE_MODIFY_ACK,
103 RSL_MT_MODE_MODIFY_NACK,
104 RSL_MT_PHY_CONTEXT_REQ,
105 RSL_MT_PHY_CONTEXT_CONF,
106 RSL_MT_RF_CHAN_REL,
107 RSL_MT_MS_POWER_CONTROL,
108 RSL_MT_BS_POWER_CONTROL,
109 RSL_MT_PREPROC_CONFIG,
110 RSL_MT_PREPROC_MEAS_RES,
111 RSL_MT_RF_CHAN_REL_ACK,
112 RSL_MT_SACCH_INFO_MODIFY,
113 RSL_MT_TALKER_DET,
114 RSL_MT_LISTENER_DET,
115 RSL_MT_REMOTE_CODEC_CONF_REP,
116 RSL_MT_RTD_REP,
117 RSL_MT_PRE_HANDO_NOTIF,
118 RSL_MT_MR_CODEC_MOD_REQ,
119 RSL_MT_MR_CODEC_MOD_ACK,
120 RSL_MT_MR_CODEC_MOD_NACK,
121 RSL_MT_MR_CODEC_MOD_PER,
122 RSL_MT_TFO_REP,
123 RSL_MT_TFO_MOD_REQ, /* 0x3f */
124};
125
126/* Chapter 9.3 */
127enum abis_rsl_ie {
128 RSL_IE_CHAN_NR = 0x01,
129 RSL_IE_LINK_IDENT,
130 RSL_IE_ACT_TYPE,
131 RSL_IE_BS_POWER,
132 RSL_IE_CHAN_IDENT,
133 RSL_IE_CHAN_MODE,
134 RSL_IE_ENCR_INFO,
135 RSL_IE_FRAME_NUMBER,
136 RSL_IE_HANDO_REF,
137 RSL_IE_L1_INFO,
138 RSL_IE_L3_INFO,
139 RSL_IE_MS_IDENTITY,
140 RSL_IE_MS_POWER,
141 RSL_IE_PAGING_GROUP,
142 RSL_IE_PAGING_LOAD,
143 RSL_IE_PYHS_CONTEXT = 0x10,
144 RSL_IE_ACCESS_DELAY,
145 RSL_IE_RACH_LOAD,
146 RSL_IE_REQ_REFERENCE,
147 RSL_IE_RELEASE_MODE,
148 RSL_IE_RESOURCE_INFO,
149 RSL_IE_RLM_CAUSE,
150 RSL_IE_STARTNG_TIME,
151 RSL_IE_TIMING_ADVANCE,
152 RSL_IE_UPLINK_MEAS,
153 RSL_IE_CAUSE,
154 RSL_IE_MEAS_RES_NR,
155 RSL_IE_MSG_ID,
156 /* reserved */
157 RSL_IE_SYSINFO_TYPE = 0x1e,
158 RSL_IE_MS_POWER_PARAM,
159 RSL_IE_BS_POWER_PARAM,
160 RSL_IE_PREPROC_PARAM,
161 RSL_IE_PREPROC_MEAS,
162 RSL_IE_IMM_ASS_INFO, /* Phase 1 (3.6.0), later Full below */
163 RSL_IE_SMSCB_INFO = 0x24,
164 RSL_IE_MS_TIMING_OFFSET,
165 RSL_IE_ERR_MSG,
166 RSL_IE_FULL_BCCH_INFO,
167 RSL_IE_CHAN_NEEDED,
168 RSL_IE_CB_CMD_TYPE,
169 RSL_IE_SMSCB_MSG,
170 RSL_IE_FULL_IMM_ASS_INFO,
171 RSL_IE_SACCH_INFO,
172 RSL_IE_CBCH_LOAD_INFO,
173 RSL_IE_SMSCB_CHAN_INDICATOR,
174 RSL_IE_GROUP_CALL_REF,
175 RSL_IE_CHAN_DESC,
176 RSL_IE_NCH_DRX_INFO,
177 RSL_IE_CMD_INDICATOR,
178 RSL_IE_EMLPP_PRIO,
179 RSL_IE_UIC,
180 RSL_IE_MAIN_CHAN_REF,
181 RSL_IE_MR_CONFIG,
182 RSL_IE_MR_CONTROL,
183 RSL_IE_SUP_CODEC_TYPES,
184 RSL_IE_CODEC_CONFIG,
185 RSL_IE_RTD,
186 RSL_IE_TFO_STATUS,
187 RSL_IE_LLP_APDU,
188};
189
190/* Chapter 9.3.1 */
191#define RSL_CHAN_NR_MASK 0xf8
192#define RSL_CHAN_Bm_ACCHs 0x08
193#define RSL_CHAN_Lm_ACCHs 0x10 /* .. 0x18 */
194#define RSL_CHAN_SDCCH4_ACCH 0x20 /* .. 0x38 */
195#define RSL_CHAN_SDCCH8_ACCH 0x40 /* ...0x78 */
196#define RSL_CHAN_BCCH 0x80
197#define RSL_CHAN_RACH 0x88
198#define RSL_CHAN_PCH_AGCH 0x90
199
200/* Chapter 9.3.3 */
201#define RSL_ACT_TYPE_INITIAL 0x00
202#define RSL_ACT_TYPE_REACT 0x80
203#define RSL_ACT_INTRA_IMM_ASS 0x00
204#define RSL_ACT_INTRA_NORM_ASS 0x01
205#define RSL_ACT_INTER_ASYNC 0x02
206#define RSL_ACT_INTER_SYNC 0x03
207#define RSL_ACT_SECOND_ADD 0x04
208#define RSL_ACT_SECOND_MULTI 0x05
209
210/* Chapter 9.3.6 */
211struct rsl_ie_chan_mode {
212 u_int8_t dtx_dtu;
213 u_int8_t spd_ind;
214 u_int8_t chan_rt;
215 u_int8_t chan_rate;
216} __attribute__ ((packed));
217#define RSL_CMOD_DTXu 0x01 /* uplink */
218#define RSL_CMOD_DTXd 0x02 /* downlink */
219#define RSL_CMOD_SPD_SPEECH 0x01
220#define RSL_CMOD_SPD_DATA 0x02
221#define RSL_CMOD_SPD_SIGN 0x03
222#define RSL_CMOD_CRT_SDCCH 0x01
223#define RSL_CMOD_CRT_TCH_Bm 0x08 /* full-rate */
224#define RSL_CMOD_CRT_TCH_Lm 0x09 /* half-rate */
225/* FIXME: More CRT types */
226#define RSL_CMOD_SP_GSM1 0x01
227#define RSL_CMOD_SP_GSM2 0x11
228#define RSL_CMOD_SP_GSM3 0x21
229
230/* Chapter 9.3.5 */
231struct rsl_ie_chan_ident {
232 /* GSM 04.08 10.5.2.5 */
233 struct {
234 u_int8_t iei;
235 u_int8_t chan_nr; /* enc_chan_nr */
236 u_int8_t oct3;
237 u_int8_t oct4;
238 } chan_desc;
239#if 0 /* spec says we need this but Abissim doesn't use it */
240 struct {
241 u_int8_t tag;
242 u_int8_t len;
243 } mobile_alloc;
244#endif
245} __attribute__ ((packed));
246
247/* Chapter 9.3.30 */
248#define RSL_SYSTEM_INFO_8 0x00
249#define RSL_SYSTEM_INFO_1 0x01
250#define RSL_SYSTEM_INFO_2 0x02
251#define RSL_SYSTEM_INFO_3 0x03
252#define RSL_SYSTEM_INFO_4 0x04
253#define RSL_SYSTEM_INFO_5 0x05
254#define RSL_SYSTEM_INFO_6 0x06
255#define RSL_SYSTEM_INFO_7 0x07
256#define RSL_SYSTEM_INFO_16 0x08
257#define RSL_SYSTEM_INFO_17 0x09
258#define RSL_SYSTEM_INFO_2bis 0x0a
259#define RSL_SYSTEM_INFO_2ter 0x0b
260#define RSL_SYSTEM_INFO_5bis 0x0d
261#define RSL_SYSTEM_INFO_5ter 0x0e
262#define RSL_SYSTEM_INFO_10 0x0f
263#define REL_EXT_MEAS_ORDER 0x47
264#define RSL_MEAS_INFO 0x48
265#define RSL_SYSTEM_INFO_13 0x28
266#define RSL_SYSTEM_INFO_2quater 0x29
267#define RSL_SYSTEM_INFO_9 0x2a
268#define RSL_SYSTEM_INFO_18 0x2b
269#define RSL_SYSTEM_INFO_19 0x2c
270#define RSL_SYSTEM_INFO_20 0x2d
271
272/* Chapter 9.3.40 */
273#define RSL_CHANNEED_ANY 0x00
274#define RSL_CHANNEED_SDCCH 0x01
275#define RSL_CHANNEED_TCH_F 0x02
276#define RSL_CHANNEED_TCH_ForH 0x03
277
278
279#include "msgb.h"
280
281int rsl_bcch_info(struct gsm_bts *bts, u_int8_t type,
282 const u_int8_t *data, int len);
283int rsl_sacch_filling(struct gsm_bts *bts, u_int8_t type,
284 const u_int8_t *data, int len);
285int rsl_chan_activate(struct gsm_bts *bts, u_int8_t chan_nr,
286 u_int8_t act_type,
287 struct rsl_ie_chan_mode *chan_mode,
288 struct rsl_ie_chan_ident *chan_ident,
289 u_int8_t bs_power, u_int8_t ms_power,
290 u_int8_t ta);
291int rsl_chan_activate_tch_f(struct gsm_bts_trx_ts *ts);
292int rsl_chan_activate_sdcch(struct gsm_bts_trx_ts *ts);
293int rsl_chan_release(struct gsm_bts_trx_ts *ts, u_int8_t chan_nr);
294int rsl_paging_cmd(struct gsm_bts *bts, u_int8_t paging_group, u_int8_t len,
295 u_int8_t *ms_ident, u_int8_t chan_needed);
296int rsl_paging_cmd_imsi(struct gsm_bts *bts, u_int8_t chan_needed, const char *imsi_str);
297int rsl_imm_assign_cmd(struct gsm_bts *bts, u_int8_t len, u_int8_t *val);
298int rsl_data_request(struct gsm_bts *bts, struct msgb *msg);
299
300int abis_rsl_rx(struct msgb *msg);
301
302#endif /* RSL_MT_H */
303