Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 1 | /* 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 | |
| 26 | struct 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 */ |
| 33 | struct 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 */ |
| 43 | struct 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 |
Harald Welte | 7509926 | 2009-02-16 21:12:08 +0000 | [diff] [blame] | 57 | #define ABIS_RSL_MDISC_IPACCESS 0x7e |
Harald Welte | 4a543e8 | 2009-02-28 13:17:55 +0000 | [diff] [blame] | 58 | #define ABIS_RSL_MDISC_TRANSP 0x01 |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 59 | |
| 60 | #define ABIS_RSL_MDISC_IS_TRANSP(x) (x & 0x01) |
| 61 | |
Holger Freyther | 590d66a | 2008-12-30 19:13:13 +0000 | [diff] [blame] | 62 | /* Chapter 9.1 */ |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 63 | enum abis_rsl_msgtype { |
| 64 | /* Radio Link Layer Management */ |
| 65 | RSL_MT_DATA_REQ = 0x01, |
| 66 | RSL_MT_DATA_IND, |
| 67 | RSL_MT_ERROR_IND, |
| 68 | RSL_MT_EST_REQ, |
| 69 | RSL_MT_EST_CONF, |
| 70 | RSL_MT_EST_IND, |
| 71 | RSL_MT_REL_REQ, |
| 72 | RSL_MT_REL_CONF, |
| 73 | RSL_MT_REL_IND, |
| 74 | RSL_MT_UNIT_DATA_REQ, |
| 75 | RSL_MT_UNIT_DATA_IND, /* 0x0b */ |
| 76 | |
| 77 | /* Common Channel Management / TRX Management */ |
| 78 | RSL_MT_BCCH_INFO = 0x11, |
| 79 | RSL_MT_CCCH_LOAD_IND, |
| 80 | RSL_MT_CHAN_RQD, |
| 81 | RSL_MT_DELETE_IND, |
| 82 | RSL_MT_PAGING_CMD, |
| 83 | RSL_MT_IMMEDIATE_ASSIGN_CMD, |
| 84 | RSL_MT_SMS_BC_REQ, |
| 85 | /* empty */ |
| 86 | RSL_MT_RF_RES_IND = 0x19, |
| 87 | RSL_MT_SACCH_FILL, |
| 88 | RSL_MT_OVERLOAD, |
| 89 | RSL_MT_ERROR_REPORT, |
| 90 | RSL_MT_SMS_BC_CMD, |
| 91 | RSL_MT_CBCH_LOAD_IND, |
| 92 | RSL_MT_NOT_CMD, /* 0x1f */ |
| 93 | |
| 94 | /* Dedicate Channel Management */ |
| 95 | RSL_MT_CHAN_ACTIV = 0x21, |
| 96 | RSL_MT_CHAN_ACTIV_ACK, |
| 97 | RSL_MT_CHAN_ACTIV_NACK, |
| 98 | RSL_MT_CONN_FAIL, |
| 99 | RSL_MT_DEACTIVATE_SACCH, |
| 100 | RSL_MT_ENCR_CMD, |
| 101 | RSL_MT_HANDO_DET, |
| 102 | RSL_MT_MEAS_RES, |
| 103 | RSL_MT_MODE_MODIFY_REQ, |
| 104 | RSL_MT_MODE_MODIFY_ACK, |
| 105 | RSL_MT_MODE_MODIFY_NACK, |
| 106 | RSL_MT_PHY_CONTEXT_REQ, |
| 107 | RSL_MT_PHY_CONTEXT_CONF, |
| 108 | RSL_MT_RF_CHAN_REL, |
| 109 | RSL_MT_MS_POWER_CONTROL, |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 110 | RSL_MT_BS_POWER_CONTROL, /* 0x30 */ |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 111 | RSL_MT_PREPROC_CONFIG, |
| 112 | RSL_MT_PREPROC_MEAS_RES, |
| 113 | RSL_MT_RF_CHAN_REL_ACK, |
| 114 | RSL_MT_SACCH_INFO_MODIFY, |
| 115 | RSL_MT_TALKER_DET, |
| 116 | RSL_MT_LISTENER_DET, |
| 117 | RSL_MT_REMOTE_CODEC_CONF_REP, |
| 118 | RSL_MT_RTD_REP, |
| 119 | RSL_MT_PRE_HANDO_NOTIF, |
| 120 | RSL_MT_MR_CODEC_MOD_REQ, |
| 121 | RSL_MT_MR_CODEC_MOD_ACK, |
| 122 | RSL_MT_MR_CODEC_MOD_NACK, |
| 123 | RSL_MT_MR_CODEC_MOD_PER, |
| 124 | RSL_MT_TFO_REP, |
| 125 | RSL_MT_TFO_MOD_REQ, /* 0x3f */ |
Harald Welte | a1f0ac7 | 2009-07-12 21:59:04 +0200 | [diff] [blame] | 126 | RSL_MT_LOCATION_INFO = 0x41, |
Harald Welte | 7509926 | 2009-02-16 21:12:08 +0000 | [diff] [blame] | 127 | |
| 128 | /* ip.access specific RSL message types */ |
Harald Welte | a1f0ac7 | 2009-07-12 21:59:04 +0200 | [diff] [blame] | 129 | RSL_MT_IPAC_DIR_RETR_ENQ = 0x40, |
| 130 | RSL_MT_IPAC_PDCH_ACT = 0x48, |
| 131 | RSL_MT_IPAC_PDCH_ACT_ACK, |
| 132 | RSL_MT_IPAC_PDCH_ACT_NACK, |
| 133 | RSL_MT_IPAC_PDCH_DEACT = 0x4b, |
| 134 | RSL_MT_IPAC_PDCH_DEACT_ACK, |
| 135 | RSL_MT_IPAC_PDCH_DEACT_NACK, |
| 136 | RSL_MT_IPAC_CONNECT_MUX = 0x50, |
| 137 | RSL_MT_IPAC_CONNECT_MUX_ACK, |
| 138 | RSL_MT_IPAC_CONNECT_MUX_NACK, |
| 139 | RSL_MT_IPAC_BIND_MUX = 0x53, |
| 140 | RSL_MT_IPAC_BIND_MUX_ACK, |
| 141 | RSL_MT_IPAC_BIND_MUX_NACK, |
| 142 | RSL_MT_IPAC_DISC_MUX = 0x56, |
| 143 | RSL_MT_IPAC_DISC_MUX_ACK, |
| 144 | RSL_MT_IPAC_DISC_MUX_NACK, |
Holger Hans Peter Freyther | 231163d | 2009-11-18 21:06:12 +0100 | [diff] [blame] | 145 | RSL_MT_IPAC_CRCX = 0x70, /* Bind to local BTS RTP port */ |
| 146 | RSL_MT_IPAC_CRCX_ACK, |
| 147 | RSL_MT_IPAC_CRCX_NACK, |
| 148 | RSL_MT_IPAC_MDCX = 0x73, |
| 149 | RSL_MT_IPAC_MDCX_ACK, |
| 150 | RSL_MT_IPAC_MDCX_NACK, |
| 151 | RSL_MT_IPAC_DLCX_IND = 0x76, |
| 152 | RSL_MT_IPAC_DLCX = 0x77, |
| 153 | RSL_MT_IPAC_DLCX_ACK, |
| 154 | RSL_MT_IPAC_DLCX_NACK, |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 155 | }; |
| 156 | |
Harald Welte | 67fa91b | 2009-08-10 09:51:40 +0200 | [diff] [blame] | 157 | /* Siemens vendor-specific */ |
| 158 | enum abis_rsl_msgtype_siemens { |
| 159 | RSL_MT_SIEMENS_MRPCI = 0x41, |
Harald Welte | 4321fee | 2009-08-10 17:40:43 +0200 | [diff] [blame] | 160 | RSL_MT_SIEMENS_INTRAC_HO_COND_IND = 0x42, |
| 161 | RSL_MT_SIEMENS_INTERC_HO_COND_IND = 0x43, |
| 162 | RSL_MT_SIEMENS_FORCED_HO_REQ = 0x44, |
| 163 | RSL_MT_SIEMENS_PREF_AREA_REQ = 0x45, |
| 164 | RSL_MT_SIEMENS_PREF_AREA = 0x46, |
| 165 | RSL_MT_SIEMENS_START_TRACE = 0x47, |
| 166 | RSL_MT_SIEMENS_START_TRACE_ACK = 0x48, |
| 167 | RSL_MT_SIEMENS_STOP_TRACE = 0x49, |
| 168 | RSL_MT_SIEMENS_TRMR = 0x4a, |
| 169 | RSL_MT_SIEMENS_HO_FAIL_IND = 0x4b, |
| 170 | RSL_MT_SIEMENS_STOP_TRACE_ACK = 0x4c, |
| 171 | RSL_MT_SIEMENS_UPLF = 0x4d, |
| 172 | RSL_MT_SIEMENS_UPLB = 0x4e, |
| 173 | RSL_MT_SIEMENS_SET_SYS_INFO_10 = 0x4f, |
| 174 | RSL_MT_SIEMENS_MODIF_COND_IND = 0x50, |
Harald Welte | 67fa91b | 2009-08-10 09:51:40 +0200 | [diff] [blame] | 175 | }; |
| 176 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 177 | /* Chapter 9.3 */ |
| 178 | enum abis_rsl_ie { |
| 179 | RSL_IE_CHAN_NR = 0x01, |
| 180 | RSL_IE_LINK_IDENT, |
| 181 | RSL_IE_ACT_TYPE, |
| 182 | RSL_IE_BS_POWER, |
| 183 | RSL_IE_CHAN_IDENT, |
| 184 | RSL_IE_CHAN_MODE, |
| 185 | RSL_IE_ENCR_INFO, |
| 186 | RSL_IE_FRAME_NUMBER, |
| 187 | RSL_IE_HANDO_REF, |
| 188 | RSL_IE_L1_INFO, |
| 189 | RSL_IE_L3_INFO, |
| 190 | RSL_IE_MS_IDENTITY, |
| 191 | RSL_IE_MS_POWER, |
| 192 | RSL_IE_PAGING_GROUP, |
| 193 | RSL_IE_PAGING_LOAD, |
| 194 | RSL_IE_PYHS_CONTEXT = 0x10, |
| 195 | RSL_IE_ACCESS_DELAY, |
| 196 | RSL_IE_RACH_LOAD, |
| 197 | RSL_IE_REQ_REFERENCE, |
| 198 | RSL_IE_RELEASE_MODE, |
| 199 | RSL_IE_RESOURCE_INFO, |
| 200 | RSL_IE_RLM_CAUSE, |
| 201 | RSL_IE_STARTNG_TIME, |
| 202 | RSL_IE_TIMING_ADVANCE, |
| 203 | RSL_IE_UPLINK_MEAS, |
| 204 | RSL_IE_CAUSE, |
| 205 | RSL_IE_MEAS_RES_NR, |
| 206 | RSL_IE_MSG_ID, |
| 207 | /* reserved */ |
| 208 | RSL_IE_SYSINFO_TYPE = 0x1e, |
| 209 | RSL_IE_MS_POWER_PARAM, |
| 210 | RSL_IE_BS_POWER_PARAM, |
| 211 | RSL_IE_PREPROC_PARAM, |
| 212 | RSL_IE_PREPROC_MEAS, |
| 213 | RSL_IE_IMM_ASS_INFO, /* Phase 1 (3.6.0), later Full below */ |
| 214 | RSL_IE_SMSCB_INFO = 0x24, |
| 215 | RSL_IE_MS_TIMING_OFFSET, |
| 216 | RSL_IE_ERR_MSG, |
| 217 | RSL_IE_FULL_BCCH_INFO, |
| 218 | RSL_IE_CHAN_NEEDED, |
| 219 | RSL_IE_CB_CMD_TYPE, |
| 220 | RSL_IE_SMSCB_MSG, |
| 221 | RSL_IE_FULL_IMM_ASS_INFO, |
| 222 | RSL_IE_SACCH_INFO, |
| 223 | RSL_IE_CBCH_LOAD_INFO, |
| 224 | RSL_IE_SMSCB_CHAN_INDICATOR, |
| 225 | RSL_IE_GROUP_CALL_REF, |
Harald Welte | 67fa91b | 2009-08-10 09:51:40 +0200 | [diff] [blame] | 226 | RSL_IE_CHAN_DESC = 0x30, |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 227 | RSL_IE_NCH_DRX_INFO, |
| 228 | RSL_IE_CMD_INDICATOR, |
| 229 | RSL_IE_EMLPP_PRIO, |
| 230 | RSL_IE_UIC, |
| 231 | RSL_IE_MAIN_CHAN_REF, |
| 232 | RSL_IE_MR_CONFIG, |
| 233 | RSL_IE_MR_CONTROL, |
| 234 | RSL_IE_SUP_CODEC_TYPES, |
| 235 | RSL_IE_CODEC_CONFIG, |
| 236 | RSL_IE_RTD, |
| 237 | RSL_IE_TFO_STATUS, |
| 238 | RSL_IE_LLP_APDU, |
Harald Welte | 67fa91b | 2009-08-10 09:51:40 +0200 | [diff] [blame] | 239 | /* Siemens vendor-specific */ |
| 240 | RSL_IE_SIEMENS_MRPCI = 0x40, |
Harald Welte | 4321fee | 2009-08-10 17:40:43 +0200 | [diff] [blame] | 241 | RSL_IE_SIEMENS_PREF_AREA_TYPE = 0x43, |
| 242 | RSL_IE_SIEMENS_ININ_CELL_HO_PAR = 0x45, |
| 243 | RSL_IE_SIEMENS_TRACE_REF_NR = 0x46, |
| 244 | RSL_IE_SIEMENS_INT_TRACE_IDX = 0x47, |
| 245 | RSL_IE_SIEMENS_L2_HDR_INFO = 0x48, |
| 246 | RSL_IE_SIEMENS_HIGHEST_RATE = 0x4e, |
| 247 | RSL_IE_SIEMENS_SUGGESTED_RATE = 0x4f, |
Harald Welte | 7509926 | 2009-02-16 21:12:08 +0000 | [diff] [blame] | 248 | |
Harald Welte | 67fa91b | 2009-08-10 09:51:40 +0200 | [diff] [blame] | 249 | /* ip.access */ |
Harald Welte | 86c162d | 2009-07-12 09:45:05 +0200 | [diff] [blame] | 250 | RSL_IE_IPAC_SRTP_CONFIG = 0xe0, |
| 251 | RSL_IE_IPAC_PROXY_UDP = 0xe1, |
| 252 | RSL_IE_IPAC_BSCMPL_TOUT = 0xe2, |
Harald Welte | 7509926 | 2009-02-16 21:12:08 +0000 | [diff] [blame] | 253 | RSL_IE_IPAC_REMOTE_IP = 0xf0, |
| 254 | RSL_IE_IPAC_REMOTE_PORT = 0xf1, |
Harald Welte | 86c162d | 2009-07-12 09:45:05 +0200 | [diff] [blame] | 255 | RSL_IE_IPAC_RTP_PAYLOAD = 0xf2, |
Harald Welte | 7509926 | 2009-02-16 21:12:08 +0000 | [diff] [blame] | 256 | RSL_IE_IPAC_LOCAL_PORT = 0xf3, |
Harald Welte | 86c162d | 2009-07-12 09:45:05 +0200 | [diff] [blame] | 257 | RSL_IE_IPAC_SPEECH_MODE = 0xf4, |
Harald Welte | 7509926 | 2009-02-16 21:12:08 +0000 | [diff] [blame] | 258 | RSL_IE_IPAC_LOCAL_IP = 0xf5, |
Harald Welte | 86c162d | 2009-07-12 09:45:05 +0200 | [diff] [blame] | 259 | RSL_IE_IPAC_CONN_STAT = 0xf6, |
| 260 | RSL_IE_IPAC_HO_C_PARMS = 0xf7, |
| 261 | RSL_IE_IPAC_CONN_ID = 0xf8, |
| 262 | RSL_IE_IPAC_RTP_CSD_FMT = 0xf9, |
| 263 | RSL_IE_IPAC_RTP_JIT_BUF = 0xfa, |
| 264 | RSL_IE_IPAC_RTP_COMPR = 0xfb, |
| 265 | RSL_IE_IPAC_RTP_PAYLOAD2= 0xfc, |
| 266 | RSL_IE_IPAC_RTP_MPLEX = 0xfd, |
| 267 | RSL_IE_IPAC_RTP_MPLEX_ID= 0xfe, |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 268 | }; |
| 269 | |
| 270 | /* Chapter 9.3.1 */ |
| 271 | #define RSL_CHAN_NR_MASK 0xf8 |
| 272 | #define RSL_CHAN_Bm_ACCHs 0x08 |
| 273 | #define RSL_CHAN_Lm_ACCHs 0x10 /* .. 0x18 */ |
| 274 | #define RSL_CHAN_SDCCH4_ACCH 0x20 /* .. 0x38 */ |
| 275 | #define RSL_CHAN_SDCCH8_ACCH 0x40 /* ...0x78 */ |
| 276 | #define RSL_CHAN_BCCH 0x80 |
| 277 | #define RSL_CHAN_RACH 0x88 |
| 278 | #define RSL_CHAN_PCH_AGCH 0x90 |
| 279 | |
| 280 | /* Chapter 9.3.3 */ |
| 281 | #define RSL_ACT_TYPE_INITIAL 0x00 |
| 282 | #define RSL_ACT_TYPE_REACT 0x80 |
| 283 | #define RSL_ACT_INTRA_IMM_ASS 0x00 |
| 284 | #define RSL_ACT_INTRA_NORM_ASS 0x01 |
| 285 | #define RSL_ACT_INTER_ASYNC 0x02 |
| 286 | #define RSL_ACT_INTER_SYNC 0x03 |
| 287 | #define RSL_ACT_SECOND_ADD 0x04 |
| 288 | #define RSL_ACT_SECOND_MULTI 0x05 |
| 289 | |
| 290 | /* Chapter 9.3.6 */ |
| 291 | struct rsl_ie_chan_mode { |
| 292 | u_int8_t dtx_dtu; |
| 293 | u_int8_t spd_ind; |
| 294 | u_int8_t chan_rt; |
| 295 | u_int8_t chan_rate; |
| 296 | } __attribute__ ((packed)); |
| 297 | #define RSL_CMOD_DTXu 0x01 /* uplink */ |
| 298 | #define RSL_CMOD_DTXd 0x02 /* downlink */ |
Harald Welte | 9943c5b | 2009-07-29 15:41:29 +0200 | [diff] [blame] | 299 | enum rsl_cmod_spd { |
| 300 | RSL_CMOD_SPD_SPEECH = 0x01, |
| 301 | RSL_CMOD_SPD_DATA = 0x02, |
| 302 | RSL_CMOD_SPD_SIGN = 0x03, |
| 303 | }; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 304 | #define RSL_CMOD_CRT_SDCCH 0x01 |
| 305 | #define RSL_CMOD_CRT_TCH_Bm 0x08 /* full-rate */ |
| 306 | #define RSL_CMOD_CRT_TCH_Lm 0x09 /* half-rate */ |
| 307 | /* FIXME: More CRT types */ |
Harald Welte | 9943c5b | 2009-07-29 15:41:29 +0200 | [diff] [blame] | 308 | /* Speech */ |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 309 | #define RSL_CMOD_SP_GSM1 0x01 |
| 310 | #define RSL_CMOD_SP_GSM2 0x11 |
| 311 | #define RSL_CMOD_SP_GSM3 0x21 |
Harald Welte | 9943c5b | 2009-07-29 15:41:29 +0200 | [diff] [blame] | 312 | /* Data */ |
| 313 | #define RSL_CMOD_SP_NT_14k5 0x58 |
| 314 | #define RSL_CMOD_SP_NT_12k0 0x50 |
| 315 | #define RSL_CMOD_SP_NT_6k0 0x51 |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 316 | |
| 317 | /* Chapter 9.3.5 */ |
| 318 | struct rsl_ie_chan_ident { |
| 319 | /* GSM 04.08 10.5.2.5 */ |
| 320 | struct { |
| 321 | u_int8_t iei; |
| 322 | u_int8_t chan_nr; /* enc_chan_nr */ |
| 323 | u_int8_t oct3; |
| 324 | u_int8_t oct4; |
| 325 | } chan_desc; |
| 326 | #if 0 /* spec says we need this but Abissim doesn't use it */ |
| 327 | struct { |
| 328 | u_int8_t tag; |
| 329 | u_int8_t len; |
| 330 | } mobile_alloc; |
| 331 | #endif |
| 332 | } __attribute__ ((packed)); |
| 333 | |
Harald Welte | 4b63454 | 2008-12-27 01:55:51 +0000 | [diff] [blame] | 334 | /* Chapter 9.3.22 */ |
| 335 | #define RLL_CAUSE_T200_EXPIRED 0x01 |
| 336 | #define RLL_CAUSE_REEST_REQ 0x02 |
| 337 | #define RLL_CAUSE_UNSOL_UA_RESP 0x03 |
| 338 | #define RLL_CAUSE_UNSOL_DM_RESP 0x04 |
| 339 | #define RLL_CAUSE_UNSOL_DM_RESP_MF 0x05 |
| 340 | #define RLL_CAUSE_UNSOL_SPRV_RESP 0x06 |
| 341 | #define RLL_CAUSE_SEQ_ERR 0x07 |
| 342 | #define RLL_CAUSE_UFRM_INC_PARAM 0x08 |
| 343 | #define RLL_CAUSE_SFRM_INC_PARAM 0x09 |
| 344 | #define RLL_CAUSE_IFRM_INC_MBITS 0x0a |
| 345 | #define RLL_CAUSE_IFRM_INC_LEN 0x0b |
| 346 | #define RLL_CAUSE_FRM_UNIMPL 0x0c |
| 347 | #define RLL_CAUSE_SABM_MF 0x0d |
| 348 | #define RLL_CAUSE_SABM_INFO_NOTALL 0x0e |
| 349 | |
Harald Welte | 702d870 | 2008-12-26 20:25:35 +0000 | [diff] [blame] | 350 | /* Chapter 9.3.26 */ |
| 351 | #define RSL_ERRCLS_NORMAL 0x00 |
| 352 | #define RSL_ERRCLS_RESOURCE_UNAVAIL 0x20 |
| 353 | #define RSL_ERRCLS_SERVICE_UNAVAIL 0x30 |
| 354 | #define RSL_ERRCLS_SERVICE_UNIMPL 0x40 |
| 355 | #define RSL_ERRCLS_INVAL_MSG 0x50 |
| 356 | #define RSL_ERRCLS_PROTO_ERROR 0x60 |
| 357 | #define RSL_ERRCLS_INTERWORKING 0x70 |
| 358 | |
Harald Welte | 8830e07 | 2009-07-28 17:58:09 +0200 | [diff] [blame] | 359 | /* normal event */ |
Harald Welte | 702d870 | 2008-12-26 20:25:35 +0000 | [diff] [blame] | 360 | #define RSL_ERR_RADIO_IF_FAIL 0x00 |
| 361 | #define RSL_ERR_RADIO_LINK_FAIL 0x01 |
| 362 | #define RSL_ERR_HANDOVER_ACC_FAIL 0x02 |
| 363 | #define RSL_ERR_TALKER_ACC_FAIL 0x03 |
| 364 | #define RSL_ERR_OM_INTERVENTION 0x07 |
Harald Welte | 8830e07 | 2009-07-28 17:58:09 +0200 | [diff] [blame] | 365 | #define RSL_ERR_NORMAL_UNSPEC 0x0f |
Harald Welte | 2da8629 | 2009-08-04 02:31:05 +0200 | [diff] [blame] | 366 | #define RSL_ERR_T_MSRFPCI_EXP 0x18 |
Harald Welte | 8830e07 | 2009-07-28 17:58:09 +0200 | [diff] [blame] | 367 | /* resource unavailable */ |
Harald Welte | 702d870 | 2008-12-26 20:25:35 +0000 | [diff] [blame] | 368 | #define RSL_ERR_EQUIPMENT_FAIL 0x20 |
| 369 | #define RSL_ERR_RR_UNAVAIL 0x21 |
| 370 | #define RSL_ERR_TERR_CH_FAIL 0x22 |
| 371 | #define RSL_ERR_CCCH_OVERLOAD 0x23 |
| 372 | #define RSL_ERR_ACCH_OVERLOAD 0x24 |
| 373 | #define RSL_ERR_PROCESSOR_OVERLOAD 0x25 |
| 374 | #define RSL_ERR_RES_UNAVAIL 0x2f |
Harald Welte | 8830e07 | 2009-07-28 17:58:09 +0200 | [diff] [blame] | 375 | /* service or option not available */ |
Harald Welte | 702d870 | 2008-12-26 20:25:35 +0000 | [diff] [blame] | 376 | #define RSL_ERR_TRANSC_UNAVAIL 0x30 |
| 377 | #define RSL_ERR_SERV_OPT_UNAVAIL 0x3f |
Harald Welte | 8830e07 | 2009-07-28 17:58:09 +0200 | [diff] [blame] | 378 | /* service or option not implemented */ |
Harald Welte | 702d870 | 2008-12-26 20:25:35 +0000 | [diff] [blame] | 379 | #define RSL_ERR_ENCR_UNIMPL 0x40 |
Harald Welte | 8830e07 | 2009-07-28 17:58:09 +0200 | [diff] [blame] | 380 | #define RSL_ERR_SERV_OPT_UNIMPL 0x4f |
| 381 | /* invalid message */ |
Harald Welte | 702d870 | 2008-12-26 20:25:35 +0000 | [diff] [blame] | 382 | #define RSL_ERR_RCH_ALR_ACTV_ALLOC 0x50 |
| 383 | #define RSL_ERR_INVALID_MESSAGE 0x5f |
Harald Welte | 8830e07 | 2009-07-28 17:58:09 +0200 | [diff] [blame] | 384 | /* protocol error */ |
Harald Welte | 702d870 | 2008-12-26 20:25:35 +0000 | [diff] [blame] | 385 | #define RSL_ERR_MSG_DISCR 0x60 |
| 386 | #define RSL_ERR_MSG_TYPE 0x61 |
Harald Welte | 8830e07 | 2009-07-28 17:58:09 +0200 | [diff] [blame] | 387 | #define RSL_ERR_MSG_SEQ 0x62 |
Harald Welte | 702d870 | 2008-12-26 20:25:35 +0000 | [diff] [blame] | 388 | #define RSL_ERR_IE_ERROR 0x63 |
| 389 | #define RSL_ERR_MAND_IE_ERROR 0x64 |
| 390 | #define RSL_ERR_OPT_IE_ERROR 0x65 |
| 391 | #define RSL_ERR_IE_NONEXIST 0x66 |
| 392 | #define RSL_ERR_IE_LENGTH 0x67 |
| 393 | #define RSL_ERR_IE_CONTENT 0x68 |
| 394 | #define RSL_ERR_PROTO 0x6f |
Harald Welte | 8830e07 | 2009-07-28 17:58:09 +0200 | [diff] [blame] | 395 | /* interworking */ |
Harald Welte | 702d870 | 2008-12-26 20:25:35 +0000 | [diff] [blame] | 396 | #define RSL_ERR_INTERWORKING 0x7f |
| 397 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 398 | /* Chapter 9.3.30 */ |
| 399 | #define RSL_SYSTEM_INFO_8 0x00 |
| 400 | #define RSL_SYSTEM_INFO_1 0x01 |
| 401 | #define RSL_SYSTEM_INFO_2 0x02 |
| 402 | #define RSL_SYSTEM_INFO_3 0x03 |
| 403 | #define RSL_SYSTEM_INFO_4 0x04 |
| 404 | #define RSL_SYSTEM_INFO_5 0x05 |
| 405 | #define RSL_SYSTEM_INFO_6 0x06 |
| 406 | #define RSL_SYSTEM_INFO_7 0x07 |
| 407 | #define RSL_SYSTEM_INFO_16 0x08 |
| 408 | #define RSL_SYSTEM_INFO_17 0x09 |
| 409 | #define RSL_SYSTEM_INFO_2bis 0x0a |
| 410 | #define RSL_SYSTEM_INFO_2ter 0x0b |
| 411 | #define RSL_SYSTEM_INFO_5bis 0x0d |
| 412 | #define RSL_SYSTEM_INFO_5ter 0x0e |
| 413 | #define RSL_SYSTEM_INFO_10 0x0f |
| 414 | #define REL_EXT_MEAS_ORDER 0x47 |
| 415 | #define RSL_MEAS_INFO 0x48 |
| 416 | #define RSL_SYSTEM_INFO_13 0x28 |
| 417 | #define RSL_SYSTEM_INFO_2quater 0x29 |
| 418 | #define RSL_SYSTEM_INFO_9 0x2a |
| 419 | #define RSL_SYSTEM_INFO_18 0x2b |
| 420 | #define RSL_SYSTEM_INFO_19 0x2c |
| 421 | #define RSL_SYSTEM_INFO_20 0x2d |
| 422 | |
| 423 | /* Chapter 9.3.40 */ |
| 424 | #define RSL_CHANNEED_ANY 0x00 |
| 425 | #define RSL_CHANNEED_SDCCH 0x01 |
| 426 | #define RSL_CHANNEED_TCH_F 0x02 |
| 427 | #define RSL_CHANNEED_TCH_ForH 0x03 |
| 428 | |
Holger Freyther | b015544 | 2009-02-03 23:24:04 +0000 | [diff] [blame] | 429 | /* Chapter 3.3.2.3 Brocast control channel */ |
| 430 | /* CCCH-CONF, NC is not combined */ |
| 431 | #define RSL_BCCH_CCCH_CONF_1_NC 0x00 |
| 432 | #define RSL_BCCH_CCCH_CONF_1_C 0x01 |
| 433 | #define RSL_BCCH_CCCH_CONF_2_NC 0x02 |
| 434 | #define RSL_BCCH_CCCH_CONF_3_NC 0x04 |
| 435 | #define RSL_BCCH_CCCH_CONF_4_NC 0x06 |
| 436 | |
| 437 | /* BS-PA-MFRMS */ |
| 438 | #define RSL_BS_PA_MFRMS_2 0x00 |
| 439 | #define RSL_BS_PA_MFRMS_3 0x01 |
| 440 | #define RSL_BS_PA_MFRMS_4 0x02 |
| 441 | #define RSL_BS_PA_MFRMS_5 0x03 |
| 442 | #define RSL_BS_PA_MFRMS_6 0x04 |
| 443 | #define RSL_BS_PA_MFRMS_7 0x05 |
| 444 | #define RSL_BS_PA_MFRMS_8 0x06 |
| 445 | #define RSL_BS_PA_MFRMS_9 0x07 |
| 446 | |
Harald Welte | 0427a9f | 2009-07-12 11:17:16 +0200 | [diff] [blame] | 447 | /* RSL_IE_IPAC_RTP_PAYLOAD[2] */ |
| 448 | enum rsl_ipac_rtp_payload { |
| 449 | RSL_IPAC_RTP_GSM = 1, |
| 450 | RSL_IPAC_RTP_EFR, |
| 451 | RSL_IPAC_RTP_AMR, |
| 452 | RSL_IPAC_RTP_CSD, |
| 453 | RSL_IPAC_RTP_MUX, |
| 454 | }; |
| 455 | |
| 456 | /* RSL_IE_IPAC_SPEECH_MODE, lower four bits */ |
| 457 | enum rsl_ipac_speech_mode_s { |
| 458 | RSL_IPAC_SPEECH_GSM_FR = 0, /* GSM FR (Type 1, FS) */ |
| 459 | RSL_IPAC_SPEECH_GSM_EFR = 1, /* GSM EFR (Type 2, FS) */ |
| 460 | RSL_IPAC_SPEECH_GSM_AMR_FR = 2, /* GSM AMR/FR (Type 3, FS) */ |
| 461 | RSL_IPAC_SPEECH_GSM_HR = 3, /* GSM HR (Type 1, HS) */ |
| 462 | RSL_IPAC_SPEECH_GSM_AMR_HR = 5, /* GSM AMR/hr (Type 3, HS) */ |
| 463 | RSL_IPAC_SPEECH_AS_RTP = 0xf, /* As specified by RTP Payload IE */ |
| 464 | }; |
| 465 | /* RSL_IE_IPAC_SPEECH_MODE, upper four bits */ |
| 466 | enum rsl_ipac_speech_mode_m { |
| 467 | RSL_IPAC_SPEECH_M_RXTX = 0, /* Send and Receive */ |
| 468 | RSL_IPAC_SPEECH_M_RX = 1, /* Receive only */ |
| 469 | RSL_IPAC_SPEECH_M_TX = 2, /* Send only */ |
| 470 | }; |
| 471 | |
| 472 | /* RSL_IE_IPAC_RTP_CSD_FMT, lower four bits */ |
| 473 | enum rsl_ipac_rtp_csd_format_d { |
| 474 | RSL_IPAC_RTP_CSD_EXT_TRAU = 0, |
| 475 | RSL_IPAC_RTP_CSD_NON_TRAU = 1, |
| 476 | RSL_IPAC_RTP_CSD_TRAU_BTS = 2, |
| 477 | RSL_IPAC_RTP_CSD_IWF_FREE = 3, |
| 478 | }; |
| 479 | /* RSL_IE_IPAC_RTP_CSD_FMT, upper four bits */ |
| 480 | enum rsl_ipac_rtp_csd_format_ir { |
| 481 | RSL_IPAC_RTP_CSD_IR_8k = 0, |
| 482 | RSL_IPAC_RTP_CSD_IR_16k = 1, |
| 483 | RSL_IPAC_RTP_CSD_IR_32k = 2, |
| 484 | RSL_IPAC_RTP_CSD_IR_64k = 3, |
| 485 | }; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 486 | |
| 487 | #include "msgb.h" |
| 488 | |
Harald Welte | e79769b | 2009-02-07 00:48:17 +0000 | [diff] [blame] | 489 | int rsl_bcch_info(struct gsm_bts_trx *trx, u_int8_t type, |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 490 | const u_int8_t *data, int len); |
Harald Welte | e79769b | 2009-02-07 00:48:17 +0000 | [diff] [blame] | 491 | int rsl_sacch_filling(struct gsm_bts_trx *trx, u_int8_t type, |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 492 | const u_int8_t *data, int len); |
Harald Welte | e79769b | 2009-02-07 00:48:17 +0000 | [diff] [blame] | 493 | int rsl_chan_activate(struct gsm_bts_trx *trx, u_int8_t chan_nr, |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 494 | u_int8_t act_type, |
| 495 | struct rsl_ie_chan_mode *chan_mode, |
| 496 | struct rsl_ie_chan_ident *chan_ident, |
| 497 | u_int8_t bs_power, u_int8_t ms_power, |
| 498 | u_int8_t ta); |
Harald Welte | da78376 | 2009-02-18 03:29:53 +0000 | [diff] [blame] | 499 | int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type, |
Harald Welte | 8d77b95 | 2009-12-17 00:31:10 +0100 | [diff] [blame] | 500 | u_int8_t ta, u_int8_t ho_ref); |
Harald Welte | da78376 | 2009-02-18 03:29:53 +0000 | [diff] [blame] | 501 | int rsl_chan_mode_modify_req(struct gsm_lchan *ts); |
Harald Welte | 08d91a5 | 2009-08-30 15:37:11 +0900 | [diff] [blame] | 502 | int rsl_encryption_cmd(struct msgb *msg); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 503 | int rsl_paging_cmd(struct gsm_bts *bts, u_int8_t paging_group, u_int8_t len, |
| 504 | u_int8_t *ms_ident, u_int8_t chan_needed); |
Holger Freyther | 7448a53 | 2009-01-04 20:18:23 +0000 | [diff] [blame] | 505 | int rsl_paging_cmd_subscr(struct gsm_bts *bts, u_int8_t chan_needed, |
| 506 | struct gsm_subscriber *subscr); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 507 | int rsl_imm_assign_cmd(struct gsm_bts *bts, u_int8_t len, u_int8_t *val); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 508 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 509 | int rsl_data_request(struct msgb *msg, u_int8_t link_id); |
Harald Welte | edcc527 | 2009-08-09 13:47:35 +0200 | [diff] [blame] | 510 | int rsl_establish_request(struct gsm_lchan *lchan, u_int8_t link_id); |
Harald Welte | d2dc1de | 2009-08-08 13:15:07 +0200 | [diff] [blame] | 511 | int rsl_relase_request(struct gsm_lchan *lchan, u_int8_t link_id); |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 512 | |
Harald Welte | 67fa91b | 2009-08-10 09:51:40 +0200 | [diff] [blame] | 513 | /* Siemens vendor-specific RSL extensions */ |
| 514 | struct rsl_mrpci { |
| 515 | u_int8_t power_class:3, |
| 516 | vgcs_capable:1, |
| 517 | vbs_capable:1, |
| 518 | gsm_phase:2; |
| 519 | } __attribute__ ((packed)); |
| 520 | |
| 521 | enum rsl_mrpci_pwrclass { |
| 522 | RSL_MRPCI_PWRC_1 = 0, |
| 523 | RSL_MRPCI_PWRC_2 = 1, |
| 524 | RSL_MRPCI_PWRC_3 = 2, |
| 525 | RSL_MRPCI_PWRC_4 = 3, |
| 526 | RSL_MRPCI_PWRC_5 = 4, |
| 527 | }; |
| 528 | enum rsl_mrpci_phase { |
| 529 | RSL_MRPCI_PHASE_1 = 0, |
| 530 | /* reserved */ |
| 531 | RSL_MRPCI_PHASE_2 = 2, |
| 532 | RSL_MRPCI_PHASE_2PLUS = 3, |
| 533 | }; |
| 534 | |
Harald Welte | 31c4893 | 2009-08-10 10:07:33 +0200 | [diff] [blame] | 535 | int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci); |
Harald Welte | 67fa91b | 2009-08-10 09:51:40 +0200 | [diff] [blame] | 536 | |
Harald Welte | 7509926 | 2009-02-16 21:12:08 +0000 | [diff] [blame] | 537 | /* ip.access specfic RSL extensions */ |
Holger Hans Peter Freyther | 231163d | 2009-11-18 21:06:12 +0100 | [diff] [blame] | 538 | int rsl_ipacc_crcx(struct gsm_lchan *lchan); |
| 539 | int rsl_ipacc_mdcx(struct gsm_lchan *lchan, u_int32_t ip, |
Harald Welte | 5e3d91b | 2009-12-19 16:42:06 +0100 | [diff] [blame] | 540 | u_int16_t port, u_int8_t rtp_payload2); |
Harald Welte | a72273e | 2009-12-20 16:51:09 +0100 | [diff] [blame^] | 541 | int rsl_ipacc_mdcx_to_rtpsock(struct gsm_lchan *lchan); |
Harald Welte | 9c880c9 | 2009-10-24 10:29:22 +0200 | [diff] [blame] | 542 | int rsl_ipacc_pdch_activate(struct gsm_lchan *lchan); |
Harald Welte | 7509926 | 2009-02-16 21:12:08 +0000 | [diff] [blame] | 543 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 544 | int abis_rsl_rcvmsg(struct msgb *msg); |
| 545 | |
Holger Freyther | 2976c40 | 2009-02-04 01:09:20 +0000 | [diff] [blame] | 546 | unsigned int get_paging_group(u_int64_t imsi, unsigned int bs_cc_chans, |
| 547 | int n_pag_blocks); |
| 548 | unsigned int n_pag_blocks(int bs_ccch_sdcch_comb, unsigned int bs_ag_blks_res); |
Holger Freyther | 3aa8d6c | 2009-02-04 02:14:45 +0000 | [diff] [blame] | 549 | u_int64_t str_to_imsi(const char *imsi_str); |
Harald Welte | 2476609 | 2009-12-09 19:18:32 +0100 | [diff] [blame] | 550 | u_int8_t lchan2chan_nr(const struct gsm_lchan *lchan); |
Holger Hans Peter Freyther | 34e9749 | 2009-08-10 07:54:02 +0200 | [diff] [blame] | 551 | int rsl_release_request(struct gsm_lchan *lchan, u_int8_t link_id); |
Holger Freyther | 2976c40 | 2009-02-04 01:09:20 +0000 | [diff] [blame] | 552 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 553 | /* to be provided by external code */ |
| 554 | int abis_rsl_sendmsg(struct msgb *msg); |
Harald Welte | ae0f236 | 2009-07-19 18:36:49 +0200 | [diff] [blame] | 555 | int rsl_deact_sacch(struct gsm_lchan *lchan); |
Holger Freyther | 67b4b9a | 2009-01-01 03:46:11 +0000 | [diff] [blame] | 556 | int rsl_chan_release(struct gsm_lchan *lchan); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 557 | |
Holger Freyther | b015544 | 2009-02-03 23:24:04 +0000 | [diff] [blame] | 558 | /* BCCH related code */ |
| 559 | int rsl_ccch_conf_to_bs_cc_chans(int ccch_conf); |
| 560 | int rsl_ccch_conf_to_bs_ccch_sdcch_comb(int ccch_conf); |
| 561 | int rsl_number_of_paging_subchannels(struct gsm_bts *bts); |
| 562 | |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 563 | int rsl_chan_bs_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int db); |
| 564 | int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int dbm); |
| 565 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 566 | #endif /* RSL_MT_H */ |
| 567 | |