Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 1 | #ifndef _GSM_04_08_H |
| 2 | #define _GSM_04_08_H |
| 3 | |
| 4 | /* GSM TS 04.08 definitions */ |
Holger Freyther | 1adb4ff | 2009-02-04 00:04:52 +0000 | [diff] [blame] | 5 | struct gsm_lchan; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 6 | |
| 7 | /* Chapter 10.5.2.5 */ |
| 8 | struct gsm48_chan_desc { |
| 9 | u_int8_t chan_nr; |
| 10 | union { |
| 11 | struct { |
| 12 | u_int8_t maio_high:4, |
| 13 | h:1, |
| 14 | tsc:3; |
| 15 | u_int8_t hsn:6, |
| 16 | maio_low:2; |
| 17 | } h1; |
| 18 | struct { |
| 19 | u_int8_t arfcn_high:2, |
| 20 | spare:2, |
| 21 | h:1, |
| 22 | tsc:3; |
| 23 | u_int8_t arfcn_low; |
| 24 | } h0; |
| 25 | }; |
Harald Welte | b84e2f4 | 2008-12-28 23:42:04 +0000 | [diff] [blame] | 26 | } __attribute__ ((packed)); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 27 | |
| 28 | /* Chapter 10.5.2.30 */ |
| 29 | struct gsm48_req_ref { |
| 30 | u_int8_t ra; |
| 31 | u_int8_t t3_high:3, |
| 32 | t1_:5; |
| 33 | u_int8_t t2:5, |
| 34 | t3_low:3; |
Harald Welte | b84e2f4 | 2008-12-28 23:42:04 +0000 | [diff] [blame] | 35 | } __attribute__ ((packed)); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 36 | |
Harald Welte | 7584aea | 2009-02-11 11:44:12 +0000 | [diff] [blame] | 37 | /* Chapter 9.1.5 */ |
| 38 | struct gsm48_chan_mode_modify { |
| 39 | struct gsm48_chan_desc chan_desc; |
| 40 | u_int8_t mode; |
| 41 | } __attribute__ ((packed)); |
| 42 | |
Harald Welte | 8e4ae95 | 2009-02-18 03:28:01 +0000 | [diff] [blame] | 43 | #define GSM48_CMODE_SIGN 0x00 |
| 44 | #define GSM48_CMODE_SPEECH_V1 0x01 |
| 45 | #define GSM48_CMODE_SPEECH_EFR 0x21 |
| 46 | #define GSM48_CMODE_SPEECH_AMR 0x41 |
| 47 | #define GSM48_CMODE_DATA_14k5 0x0f |
| 48 | #define GSM48_CMODE_DATA_12k0 0x03 |
| 49 | #define GSM48_CMODE_DATA_6k0 0x0b |
| 50 | #define GSM48_CMODE_DATA_3k6 0x23 |
| 51 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 52 | /* Chapter 9.1.18 */ |
| 53 | struct gsm48_imm_ass { |
| 54 | u_int8_t l2_plen; |
| 55 | u_int8_t proto_discr; |
| 56 | u_int8_t msg_type; |
| 57 | u_int8_t page_mode; |
| 58 | struct gsm48_chan_desc chan_desc; |
| 59 | struct gsm48_req_ref req_ref; |
| 60 | u_int8_t timing_advance; |
| 61 | u_int8_t mob_alloc_len; |
| 62 | u_int8_t mob_alloc[0]; |
Harald Welte | b84e2f4 | 2008-12-28 23:42:04 +0000 | [diff] [blame] | 63 | } __attribute__ ((packed)); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 64 | |
Harald Welte | 4b63454 | 2008-12-27 01:55:51 +0000 | [diff] [blame] | 65 | /* Chapter 10.5.1.3 */ |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 66 | struct gsm48_loc_area_id { |
| 67 | u_int8_t digits[3]; /* BCD! */ |
| 68 | u_int16_t lac; |
| 69 | } __attribute__ ((packed)); |
| 70 | |
| 71 | /* Section 9.2.15 */ |
| 72 | struct gsm48_loc_upd_req { |
| 73 | u_int8_t type:4, |
| 74 | key_seq:4; |
| 75 | struct gsm48_loc_area_id lai; |
| 76 | u_int8_t classmark1; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 77 | u_int8_t mi_len; |
| 78 | u_int8_t mi[0]; |
| 79 | } __attribute__ ((packed)); |
| 80 | |
| 81 | /* Section 10.1 */ |
| 82 | struct gsm48_hdr { |
| 83 | u_int8_t proto_discr; |
| 84 | u_int8_t msg_type; |
| 85 | u_int8_t data[0]; |
| 86 | } __attribute__ ((packed)); |
| 87 | |
Holger Freyther | 5e85c8e | 2008-12-28 16:32:39 +0000 | [diff] [blame] | 88 | /* Section 9.1.3x System information Type header */ |
| 89 | struct gsm48_system_information_type_header { |
| 90 | u_int8_t l2_plen; |
| 91 | u_int8_t rr_protocol_discriminator :4, |
| 92 | skip_indicator:4; |
| 93 | u_int8_t system_information; |
| 94 | } __attribute__ ((packed)); |
| 95 | |
Harald Welte | de9226d | 2008-12-29 02:37:23 +0000 | [diff] [blame] | 96 | struct gsm48_rach_control { |
| 97 | u_int8_t re :1, |
| 98 | cell_bar :1, |
| 99 | tx_integer :4, |
| 100 | max_trans :2; |
| 101 | u_int8_t t2; |
| 102 | u_int8_t t3; |
| 103 | } __attribute__ ((packed)); |
| 104 | |
Holger Freyther | 1adb4ff | 2009-02-04 00:04:52 +0000 | [diff] [blame] | 105 | /* Section 10.5.2.11 Control Channel Description , Figure 10.5.33 */ |
| 106 | struct gsm48_control_channel_descr { |
| 107 | u_int8_t ccch_conf :3, |
| 108 | bs_ag_blks_res :3, |
| 109 | att :1, |
| 110 | spare1 :1; |
| 111 | u_int8_t bs_pa_mfrms : 3, |
| 112 | spare2 :5; |
| 113 | u_int8_t t3212; |
| 114 | } __attribute__ ((packed)); |
| 115 | |
Harald Welte | ba4cf16 | 2009-01-10 01:49:35 +0000 | [diff] [blame] | 116 | /* Section 9.2.9 CM service request */ |
| 117 | struct gsm48_service_request { |
| 118 | u_int8_t cm_service_type : 4, |
| 119 | cipher_key_seq : 4; |
| 120 | /* length + 3 bytes */ |
| 121 | u_int32_t classmark; |
| 122 | u_int8_t mi_len; |
| 123 | u_int8_t mi[0]; |
| 124 | /* optional priority level */ |
| 125 | } __attribute__ ((packed)); |
| 126 | |
Holger Freyther | 5e85c8e | 2008-12-28 16:32:39 +0000 | [diff] [blame] | 127 | /* Section 9.1.31 System information Type 1 */ |
| 128 | struct gsm48_system_information_type_1 { |
| 129 | struct gsm48_system_information_type_header header; |
| 130 | u_int8_t cell_channel_description[16]; |
Harald Welte | de9226d | 2008-12-29 02:37:23 +0000 | [diff] [blame] | 131 | struct gsm48_rach_control rach_control; |
Holger Freyther | 5e85c8e | 2008-12-28 16:32:39 +0000 | [diff] [blame] | 132 | u_int8_t s1_reset; |
| 133 | } __attribute__ ((packed)); |
| 134 | |
| 135 | /* Section 9.1.32 System information Type 2 */ |
| 136 | struct gsm48_system_information_type_2 { |
| 137 | struct gsm48_system_information_type_header header; |
| 138 | u_int8_t bcch_frequency_list[16]; |
| 139 | u_int8_t ncc_permitted; |
Harald Welte | de9226d | 2008-12-29 02:37:23 +0000 | [diff] [blame] | 140 | struct gsm48_rach_control rach_control; |
Holger Freyther | 5e85c8e | 2008-12-28 16:32:39 +0000 | [diff] [blame] | 141 | } __attribute__ ((packed)); |
| 142 | |
| 143 | /* Section 9.1.35 System information Type 3 */ |
| 144 | struct gsm48_system_information_type_3 { |
| 145 | struct gsm48_system_information_type_header header; |
| 146 | u_int16_t cell_identity; |
| 147 | struct gsm48_loc_area_id lai; |
Holger Freyther | 1adb4ff | 2009-02-04 00:04:52 +0000 | [diff] [blame] | 148 | struct gsm48_control_channel_descr control_channel_desc; |
Holger Freyther | 5e85c8e | 2008-12-28 16:32:39 +0000 | [diff] [blame] | 149 | u_int8_t cell_options; |
| 150 | u_int8_t cell_selection[2]; |
Harald Welte | de9226d | 2008-12-29 02:37:23 +0000 | [diff] [blame] | 151 | struct gsm48_rach_control rach_control; |
Holger Freyther | 5e85c8e | 2008-12-28 16:32:39 +0000 | [diff] [blame] | 152 | u_int8_t s3_reset_octets[4]; |
| 153 | } __attribute__ ((packed)); |
| 154 | |
| 155 | /* Section 9.1.36 System information Type 4 */ |
| 156 | struct gsm48_system_information_type_4 { |
| 157 | struct gsm48_system_information_type_header header; |
| 158 | struct gsm48_loc_area_id lai; |
| 159 | u_int8_t cell_selection[2]; |
Harald Welte | de9226d | 2008-12-29 02:37:23 +0000 | [diff] [blame] | 160 | struct gsm48_rach_control rach_control; |
Holger Freyther | 5e85c8e | 2008-12-28 16:32:39 +0000 | [diff] [blame] | 161 | /* optional CBCH conditional CBCH... followed by |
| 162 | mandantory SI 4 Reset Octets |
| 163 | */ |
| 164 | u_int8_t data[0]; |
| 165 | } __attribute__ ((packed)); |
| 166 | |
| 167 | /* Section 9.1.37 System information Type 5 */ |
| 168 | struct gsm48_system_information_type_5 { |
| 169 | u_int8_t rr_protocol_discriminator :4, |
| 170 | skip_indicator:4; |
| 171 | u_int8_t system_information; |
| 172 | u_int8_t bcch_frequency_list[16]; |
| 173 | } __attribute__ ((packed)); |
| 174 | |
| 175 | /* Section 9.1.40 System information Type 6 */ |
| 176 | struct gsm48_system_information_type_6 { |
| 177 | u_int8_t rr_protocol_discriminator :4, |
| 178 | skip_indicator:4; |
| 179 | u_int8_t system_information; |
| 180 | u_int8_t cell_identity[2]; |
| 181 | struct gsm48_loc_area_id lai; |
| 182 | u_int8_t cell_options; |
| 183 | u_int8_t ncc_permitted; |
| 184 | u_int8_t si_6_reset[0]; |
| 185 | } __attribute__ ((packed)); |
| 186 | |
Harald Welte | 2f74aa4 | 2009-02-22 21:14:04 +0000 | [diff] [blame] | 187 | /* Section 9.2.12 IMSI Detach Indication */ |
| 188 | struct gsm48_imsi_detach_ind { |
| 189 | u_int8_t classmark1; |
| 190 | u_int8_t mi_len; |
| 191 | u_int8_t mi[0]; |
| 192 | } __attribute__ ((packed)); |
| 193 | |
Harald Welte | bcae43f | 2008-12-27 21:45:37 +0000 | [diff] [blame] | 194 | /* Section 10.2 + GSM 04.07 12.2.3.1.1 */ |
| 195 | #define GSM48_PDISC_GROUP_CC 0x00 |
| 196 | #define GSM48_PDISC_BCAST_CC 0x01 |
| 197 | #define GSM48_PDISC_PDSS1 0x02 |
Harald Welte | 4b63454 | 2008-12-27 01:55:51 +0000 | [diff] [blame] | 198 | #define GSM48_PDISC_CC 0x03 |
Harald Welte | bcae43f | 2008-12-27 21:45:37 +0000 | [diff] [blame] | 199 | #define GSM48_PDISC_PDSS2 0x04 |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 200 | #define GSM48_PDISC_MM 0x05 |
| 201 | #define GSM48_PDISC_RR 0x06 |
| 202 | #define GSM48_PDISC_MM_GPRS 0x08 |
Harald Welte | bcae43f | 2008-12-27 21:45:37 +0000 | [diff] [blame] | 203 | #define GSM48_PDISC_SMS 0x09 |
| 204 | #define GSM48_PDISC_SM_GPRS 0x0a |
| 205 | #define GSM48_PDISC_NC_SS 0x0b |
| 206 | #define GSM48_PDISC_LOC 0x0c |
Harald Welte | de9226d | 2008-12-29 02:37:23 +0000 | [diff] [blame] | 207 | #define GSM48_PDISC_MASK 0x0f |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 208 | |
| 209 | /* Section 10.4 */ |
| 210 | #define GSM48_MT_RR_INIT_REQ 0x3c |
| 211 | #define GSM48_MT_RR_ADD_ASS 0x3b |
| 212 | #define GSM48_MT_RR_IMM_ASS 0x3f |
| 213 | #define GSM48_MT_RR_IMM_ASS_EXT 0x39 |
| 214 | #define GSM48_MT_RR_IMM_ASS_REJ 0x3a |
| 215 | |
| 216 | #define GSM48_MT_RR_CIPH_M_CMD 0x35 |
| 217 | #define GSM48_MT_RR_CIPH_M_COMPL 0x32 |
| 218 | |
| 219 | #define GSM48_MT_RR_CFG_CHG_CMD 0x30 |
| 220 | #define GSM48_MT_RR_CFG_CHG_ACK 0x31 |
| 221 | #define GSM48_MT_RR_CFG_CHG_REJ 0x33 |
| 222 | |
| 223 | #define GSM48_MT_RR_ASS_CMD 0x2e |
| 224 | #define GSM48_MT_RR_ASS_COMPL 0x29 |
| 225 | #define GSM48_MT_RR_ASS_FAIL 0x2f |
| 226 | #define GSM48_MT_RR_HANDO_CMD 0x2b |
| 227 | #define GSM48_MT_RR_HANDO_COMPL 0x2c |
| 228 | #define GSM48_MT_RR_HANDO_FAIL 0x28 |
| 229 | #define GSM48_MT_RR_HANDO_INFO 0x2d |
| 230 | |
| 231 | #define GSM48_MT_RR_CELL_CHG_ORDER 0x08 |
| 232 | #define GSM48_MT_RR_PDCH_ASS_CMD 0x23 |
| 233 | |
| 234 | #define GSM48_MT_RR_CHAN_REL 0x0d |
| 235 | #define GSM48_MT_RR_PART_REL 0x0a |
| 236 | #define GSM48_MT_RR_PART_REL_COMP 0x0f |
| 237 | |
| 238 | #define GSM48_MT_RR_PAG_REQ_1 0x21 |
| 239 | #define GSM48_MT_RR_PAG_REQ_2 0x22 |
| 240 | #define GSM48_MT_RR_PAG_REQ_3 0x24 |
| 241 | #define GSM48_MT_RR_PAG_RESP 0x27 |
| 242 | #define GSM48_MT_RR_NOTIF_NCH 0x20 |
| 243 | #define GSM48_MT_RR_NOTIF_FACCH 0x25 |
| 244 | #define GSM48_MT_RR_NOTIF_RESP 0x26 |
| 245 | |
| 246 | #define GSM48_MT_RR_SYSINFO_8 0x18 |
| 247 | #define GSM48_MT_RR_SYSINFO_1 0x19 |
| 248 | #define GSM48_MT_RR_SYSINFO_2 0x1a |
| 249 | #define GSM48_MT_RR_SYSINFO_3 0x1b |
| 250 | #define GSM48_MT_RR_SYSINFO_4 0x1c |
| 251 | #define GSM48_MT_RR_SYSINFO_5 0x1d |
| 252 | #define GSM48_MT_RR_SYSINFO_6 0x1e |
| 253 | #define GSM48_MT_RR_SYSINFO_7 0x1f |
| 254 | |
| 255 | #define GSM48_MT_RR_SYSINFO_2bis 0x02 |
| 256 | #define GSM48_MT_RR_SYSINFO_2ter 0x03 |
| 257 | #define GSM48_MT_RR_SYSINFO_5bis 0x05 |
| 258 | #define GSM48_MT_RR_SYSINFO_5ter 0x06 |
| 259 | #define GSM48_MT_RR_SYSINFO_9 0x04 |
| 260 | #define GSM48_MT_RR_SYSINFO_13 0x00 |
| 261 | |
| 262 | #define GSM48_MT_RR_SYSINFO_16 0x3d |
| 263 | #define GSM48_MT_RR_SYSINFO_17 0x3e |
| 264 | |
| 265 | #define GSM48_MT_RR_CHAN_MODE_MODIF 0x10 |
| 266 | #define GSM48_MT_RR_STATUS 0x12 |
| 267 | #define GSM48_MT_RR_CHAN_MODE_MODIF_ACK 0x17 |
| 268 | #define GSM48_MT_RR_FREQ_REDEF 0x14 |
| 269 | #define GSM48_MT_RR_MEAS_REP 0x15 |
| 270 | #define GSM48_MT_RR_CLSM_CHG 0x16 |
| 271 | #define GSM48_MT_RR_CLSM_ENQ 0x13 |
| 272 | #define GSM48_MT_RR_EXT_MEAS_REP 0x36 |
| 273 | #define GSM48_MT_RR_EXT_MEAS_REP_ORD 0x37 |
| 274 | #define GSM48_MT_RR_GPRS_SUSP_REQ 0x34 |
| 275 | |
| 276 | #define GSM48_MT_RR_VGCS_UPL_GRANT 0x08 |
| 277 | #define GSM48_MT_RR_UPLINK_RELEASE 0x0e |
| 278 | #define GSM48_MT_RR_UPLINK_FREE 0x0c |
| 279 | #define GSM48_MT_RR_UPLINK_BUSY 0x2a |
| 280 | #define GSM48_MT_RR_TALKER_IND 0x11 |
| 281 | |
| 282 | #define GSM48_MT_RR_APP_INFO 0x38 |
| 283 | |
| 284 | /* Table 10.2/3GPP TS 04.08 */ |
| 285 | #define GSM48_MT_MM_IMSI_DETACH_IND 0x01 |
| 286 | #define GSM48_MT_MM_LOC_UPD_ACCEPT 0x02 |
| 287 | #define GSM48_MT_MM_LOC_UPD_REJECT 0x04 |
| 288 | #define GSM48_MT_MM_LOC_UPD_REQUEST 0x08 |
| 289 | |
| 290 | #define GSM48_MT_MM_AUTH_REJ 0x11 |
| 291 | #define GSM48_MT_MM_AUTH_REQ 0x12 |
| 292 | #define GSM48_MT_MM_AUTH_RESP 0x14 |
| 293 | #define GSM48_MT_MM_ID_REQ 0x18 |
| 294 | #define GSM48_MT_MM_ID_RESP 0x19 |
| 295 | #define GSM48_MT_MM_TMSI_REALL_CMD 0x1a |
| 296 | #define GSM48_MT_MM_TMSI_REALL_COMPL 0x1b |
| 297 | |
| 298 | #define GSM48_MT_MM_CM_SERV_ACC 0x21 |
| 299 | #define GSM48_MT_MM_CM_SERV_REJ 0x22 |
| 300 | #define GSM48_MT_MM_CM_SERV_ABORT 0x23 |
| 301 | #define GSM48_MT_MM_CM_SERV_REQ 0x24 |
| 302 | #define GSM48_MT_MM_CM_SERV_PROMPT 0x25 |
| 303 | #define GSM48_MT_MM_CM_REEST_REQ 0x28 |
| 304 | #define GSM48_MT_MM_ABORT 0x29 |
| 305 | |
| 306 | #define GSM48_MT_MM_NULL 0x30 |
| 307 | #define GSM48_MT_MM_STATUS 0x31 |
| 308 | #define GSM48_MT_MM_INFO 0x32 |
| 309 | |
| 310 | /* Table 10.3/3GPP TS 04.08 */ |
| 311 | #define GSM48_MT_CC_ALERTING 0x01 |
| 312 | #define GSM48_MT_CC_CALL_CONF 0x08 |
| 313 | #define GSM48_MT_CC_CALL_PROC 0x02 |
| 314 | #define GSM48_MT_CC_CONNECT 0x07 |
| 315 | #define GSM48_MT_CC_CONNECT_ACK 0x0f |
| 316 | #define GSM48_MT_CC_EMERG_SETUP 0x0e |
| 317 | #define GSM48_MT_CC_PROGRESS 0x03 |
| 318 | #define GSM48_MT_CC_ESTAB 0x04 |
| 319 | #define GSM48_MT_CC_ESTAB_CONF 0x06 |
| 320 | #define GSM48_MT_CC_RECALL 0x0b |
| 321 | #define GSM48_MT_CC_START_CC 0x09 |
| 322 | #define GSM48_MT_CC_SETUP 0x05 |
| 323 | |
| 324 | #define GSM48_MT_CC_MODIFY 0x17 |
| 325 | #define GSM48_MT_CC_MODIFY_COMPL 0x1f |
| 326 | #define GSM48_MT_CC_MODIFY_REJECT 0x13 |
| 327 | #define GSM48_MT_CC_USER_INFO 0x10 |
| 328 | #define GSM48_MT_CC_HOLD 0x18 |
| 329 | #define GSM48_MT_CC_HOLD_ACK 0x19 |
| 330 | #define GSM48_MT_CC_HOLD_REJ 0x1a |
| 331 | #define GSM48_MT_CC_RETR 0x1c |
| 332 | #define GSM48_MT_CC_RETR_ACK 0x1d |
| 333 | #define GSM48_MT_CC_RETR_REJ 0x1e |
| 334 | |
| 335 | #define GSM48_MT_CC_DISCONNECT 0x25 |
| 336 | #define GSM48_MT_CC_RELEASE 0x2d |
Harald Welte | 7ccf778 | 2009-02-17 01:43:01 +0000 | [diff] [blame] | 337 | #define GSM48_MT_CC_RELEASE_COMPL 0x2a |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 338 | |
| 339 | #define GSM48_MT_CC_CONG_CTRL 0x39 |
| 340 | #define GSM48_MT_CC_NOTIFY 0x3e |
| 341 | #define GSM48_MT_CC_STATUS 0x3d |
| 342 | #define GSM48_MT_CC_STATUS_ENQ 0x34 |
| 343 | #define GSM48_MT_CC_START_DTMF 0x35 |
| 344 | #define GSM48_MT_CC_STOP_DTMF 0x31 |
| 345 | #define GSM48_MT_CC_STOP_DTMF_ACK 0x32 |
| 346 | #define GSM48_MT_CC_START_DTMF_ACK 0x36 |
| 347 | #define GSM48_MT_CC_START_DTMF_REJ 0x37 |
| 348 | #define GSM48_MT_CC_FACILITY 0x3a |
| 349 | |
| 350 | /* FIXME: Table 10.4 / 10.4a (GPRS) */ |
| 351 | |
| 352 | /* Section 10.5.2.26, Table 10.5.64 */ |
| 353 | #define GSM48_PM_MASK 0x03 |
| 354 | #define GSM48_PM_NORMAL 0x00 |
| 355 | #define GSM48_PM_EXTENDED 0x01 |
| 356 | #define GSM48_PM_REORG 0x02 |
| 357 | #define GSM48_PM_SAME 0x03 |
| 358 | |
Harald Welte | 2f74aa4 | 2009-02-22 21:14:04 +0000 | [diff] [blame] | 359 | /* Chapter 10.5.3.5 / Table 10.5.93 */ |
| 360 | #define GSM48_LUPD_NORMAL 0x0 |
| 361 | #define GSM48_LUPD_PERIODIC 0x1 |
| 362 | #define GSM48_LUPD_IMSI_ATT 0x2 |
| 363 | #define GSM48_LUPD_RESERVED 0x3 |
| 364 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 365 | /* Table 10.5.4 */ |
| 366 | #define GSM_MI_TYPE_MASK 0x07 |
| 367 | #define GSM_MI_TYPE_NONE 0x00 |
| 368 | #define GSM_MI_TYPE_IMSI 0x01 |
| 369 | #define GSM_MI_TYPE_IMEI 0x02 |
| 370 | #define GSM_MI_TYPE_IMEISV 0x03 |
| 371 | #define GSM_MI_TYPE_TMSI 0x04 |
| 372 | #define GSM_MI_ODD 0x08 |
| 373 | |
Harald Welte | 4b63454 | 2008-12-27 01:55:51 +0000 | [diff] [blame] | 374 | #define GSM48_IE_MOBILE_ID 0x17 |
Harald Welte | c6ba9c2 | 2008-12-30 18:01:02 +0000 | [diff] [blame] | 375 | #define GSM48_IE_NAME_LONG 0x43 /* 10.5.3.5a */ |
| 376 | #define GSM48_IE_NAME_SHORT 0x45 /* 10.5.3.5a */ |
| 377 | #define GSM48_IE_UTC 0x46 /* 10.5.3.8 */ |
| 378 | #define GSM48_IE_NET_TIME_TZ 0x47 /* 10.5.3.9 */ |
| 379 | #define GSM48_IE_LSA_IDENT 0x48 /* 10.5.3.11 */ |
Harald Welte | 4b63454 | 2008-12-27 01:55:51 +0000 | [diff] [blame] | 380 | |
Harald Welte | 7584aea | 2009-02-11 11:44:12 +0000 | [diff] [blame] | 381 | #define GSM48_IE_BEARER_CAP 0x04 /* 10.5.4.5 */ |
| 382 | #define GSM48_IE_CAUSE 0x08 /* 10.5.4.11 */ |
| 383 | #define GSM48_IE_CC_CAP 0x15 /* 10.5.4.5a */ |
| 384 | #define GSM48_IE_ALERT 0x19 /* 10.5.4.26 */ |
| 385 | #define GSM48_IE_FACILITY 0x1c /* 10.5.4.15 */ |
| 386 | #define GSM48_IE_PROGR_IND 0x1e /* 10.5.4.21 */ |
| 387 | #define GSM48_IE_AUX_STATUS 0x24 /* 10.5.4.4 */ |
| 388 | #define GSM48_IE_KPD_FACILITY 0x2c /* 10.5.4.17 */ |
| 389 | #define GSM48_IE_SIGNAL 0x34 /* 10.5.4.23 */ |
| 390 | #define GSM48_IE_CONN_NUM 0x4c /* 10.5.4.13 */ |
| 391 | #define GSM48_IE_CONN_SUBADDR 0x4d /* 10.5.4.14 */ |
| 392 | #define GSM48_IE_CALLING_BCD 0x5c /* 10.5.4.9 */ |
| 393 | #define GSM48_IE_CALLING_SUB 0x5d /* 10.5.4.10 */ |
| 394 | #define GSM48_IE_CALLED_BCD 0x5e /* 10.5.4.7 */ |
| 395 | #define GSM48_IE_CALLED_SUB 0x6d /* 10.5.4.8 */ |
| 396 | #define GSM48_IE_REDIR_BCD 0x74 /* 10.5.4.21a */ |
| 397 | #define GSM48_IE_REDIR_SUB 0x75 /* 10.5.4.21b */ |
| 398 | #define GSM48_IE_LOWL_COMPAT 0x7c /* 10.5.4.18 */ |
| 399 | #define GSM48_IE_HIGHL_COMPAT 0x7d /* 10.5.4.16 */ |
| 400 | #define GSM48_IE_USER_USER 0x7e /* 10.5.4.25 */ |
| 401 | #define GSM48_IE_SS_VERS 0x7f /* 10.5.4.24 */ |
| 402 | #define GSM48_IE_MORE_DATA 0xa0 /* 10.5.4.19 */ |
| 403 | #define GSM48_IE_CLIR_SUPP 0xa1 /* 10.5.4.11a */ |
| 404 | #define GSM48_IE_CLIR_INVOC 0xa2 /* 10.5.4.11b */ |
| 405 | #define GSM48_IE_REV_C_SETUP 0xa3 /* 10.5.4.22a */ |
| 406 | |
Harald Welte | 4b63454 | 2008-12-27 01:55:51 +0000 | [diff] [blame] | 407 | /* Section 10.5.4.11 / Table 10.5.122 */ |
| 408 | #define GSM48_CAUSE_CS_GSM 0x60 |
| 409 | |
Harald Welte | 7584aea | 2009-02-11 11:44:12 +0000 | [diff] [blame] | 410 | /* Section 10.5.4.23 / Table 10.5.130 */ |
| 411 | enum gsm48_signal_val { |
| 412 | GSM48_SIGNAL_DIALTONE = 0x00, |
| 413 | GSM48_SIGNAL_RINGBACK = 0x01, |
| 414 | GSM48_SIGNAL_INTERCEPT = 0x02, |
| 415 | GSM48_SIGNAL_NET_CONG = 0x03, |
| 416 | GSM48_SIGNAL_BUSY = 0x04, |
| 417 | GSM48_SIGNAL_CONFIRM = 0x05, |
| 418 | GSM48_SIGNAL_ANSWER = 0x06, |
| 419 | GSM48_SIGNAL_CALL_WAIT = 0x07, |
| 420 | GSM48_SIGNAL_OFF_HOOK = 0x08, |
| 421 | GSM48_SIGNAL_OFF = 0x3f, |
| 422 | GSM48_SIGNAL_ALERT_OFF = 0x4f, |
| 423 | }; |
| 424 | |
Harald Welte | 4b63454 | 2008-12-27 01:55:51 +0000 | [diff] [blame] | 425 | enum gsm48_cause_loc { |
| 426 | GSM48_CAUSE_LOC_USER = 0x00, |
| 427 | GSM48_CAUSE_LOC_PRN_S_LU = 0x01, |
| 428 | GSM48_CAUSE_LOC_PUN_S_LU = 0x02, |
| 429 | GSM48_CAUSE_LOC_TRANS_NET = 0x03, |
| 430 | GSM48_CAUSE_LOC_PUN_S_RU = 0x04, |
| 431 | GSM48_CAUSE_LOC_PRN_S_RU = 0x05, |
| 432 | /* not defined */ |
| 433 | GSM48_CAUSE_LOC_INN_NET = 0x07, |
| 434 | GSM48_CAUSE_LOC_NET_BEYOND = 0x0a, |
| 435 | }; |
| 436 | |
Holger Freyther | e64a7a3 | 2009-02-06 21:55:37 +0000 | [diff] [blame] | 437 | /* Section 10.5.2.31 RR Cause / Table 10.5.70 */ |
| 438 | enum gsm48_rr_cause { |
| 439 | GSM48_RR_CAUSE_NORMAL = 0x00, |
| 440 | GSM48_RR_CAUSE_ABNORMAL_UNSPEC = 0x01, |
| 441 | GSM48_RR_CAUSE_ABNORMAL_UNACCT = 0x02, |
| 442 | GSM48_RR_CAUSE_ABNORMAL_TIMER = 0x03, |
| 443 | GSM48_RR_CAUSE_ABNORMAL_NOACT = 0x04, |
| 444 | GSM48_RR_CAUSE_PREMPTIVE_REL = 0x05, |
| 445 | GSM48_RR_CAUSE_HNDOVER_IMP = 0x06, |
| 446 | GSM48_RR_CAUSE_CHAN_MODE_UNACCT = 0x07, |
| 447 | GSM48_RR_CAUSE_FREQ_NOT_IMPL = 0x08, |
| 448 | GSM48_RR_CAUSE_CALL_ClEARED = 0x41, |
| 449 | GSM48_RR_CAUSE_SEMANT_INCORR = 0x5f, |
| 450 | GSM48_RR_CAUSE_INVALID_MAND_INF = 0x60, |
| 451 | GSM48_RR_CAUSE_MSG_TYPE_N = 0x61, |
| 452 | GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT= 0x62, |
| 453 | GSM48_RR_CAUSE_COND_IE_ERROR = 0x64, |
| 454 | GSM48_RR_CAUSE_NO_CELL_ALLOC_A = 0x65, |
| 455 | GSM48_RR_CAUSE_PROT_ERROR_UNSPC = 0x6f, |
| 456 | }; |
| 457 | |
Holger Freyther | a767794 | 2008-12-30 16:18:16 +0000 | [diff] [blame] | 458 | /* Annex G, GSM specific cause values for mobility management */ |
| 459 | enum gsm48_reject_value { |
| 460 | GSM48_REJECT_IMSI_UNKNOWN_IN_HLR = 2, |
| 461 | GSM48_REJECT_ILLEGAL_MS = 3, |
| 462 | GSM48_REJECT_IMSI_UNKNOWN_IN_VLR = 4, |
| 463 | GSM48_REJECT_IMEI_NOT_ACCEPTED = 5, |
| 464 | GSM48_REJECT_ILLEGAL_ME = 6, |
| 465 | GSM48_REJECT_PLMN_NOT_ALLOWED = 11, |
| 466 | GSM48_REJECT_LOC_NOT_ALLOWED = 12, |
| 467 | GSM48_REJECT_ROAMING_NOT_ALLOWED = 13, |
| 468 | GSM48_REJECT_NETWORK_FAILURE = 17, |
| 469 | GSM48_REJECT_CONGESTION = 22, |
| 470 | GSM48_REJECT_SRV_OPT_NOT_SUPPORTED = 32, |
| 471 | GSM48_REJECT_RQD_SRV_OPT_NOT_SUPPORTED = 33, |
| 472 | GSM48_REJECT_SRV_OPT_TMP_OUT_OF_ORDER = 34, |
| 473 | GSM48_REJECT_CALL_CAN_NOT_BE_IDENTIFIED = 38, |
| 474 | GSM48_REJECT_INCORRECT_MESSAGE = 95, |
| 475 | GSM48_REJECT_INVALID_MANDANTORY_INF = 96, |
| 476 | GSM48_REJECT_MSG_TYPE_NOT_IMPLEMENTED = 97, |
| 477 | GSM48_REJECT_MSG_TYPE_NOT_COMPATIBLE = 98, |
| 478 | GSM48_REJECT_INF_ELEME_NOT_IMPLEMENTED = 99, |
| 479 | GSM48_REJECT_CONDTIONAL_IE_ERROR = 100, |
| 480 | GSM48_REJECT_MSG_NOT_COMPATIBLE = 101, |
| 481 | GSM48_REJECT_PROTOCOL_ERROR = 111, |
| 482 | |
| 483 | /* according to G.6 Additional cause codes for GMM */ |
| 484 | GSM48_REJECT_GPRS_NOT_ALLOWED = 7, |
| 485 | GSM48_REJECT_SERVICES_NOT_ALLOWED = 8, |
| 486 | GSM48_REJECT_MS_IDENTITY_NOT_DERVIVABLE = 9, |
| 487 | GSM48_REJECT_IMPLICITLY_DETACHED = 10, |
| 488 | GSM48_REJECT_GPRS_NOT_ALLOWED_IN_PLMN = 14, |
| 489 | GSM48_REJECT_MSC_TMP_NOT_REACHABLE = 16, |
| 490 | }; |
| 491 | |
| 492 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 493 | struct msgb; |
| 494 | struct gsm_bts; |
Harald Welte | 0932d1e | 2009-02-16 22:53:52 +0000 | [diff] [blame] | 495 | struct gsm_subscriber; |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 496 | |
Holger Freyther | e97f7fb | 2008-12-31 18:52:11 +0000 | [diff] [blame] | 497 | /* config options controlling the behaviour of the lower leves */ |
Holger Freyther | 89824fc | 2008-12-30 16:18:18 +0000 | [diff] [blame] | 498 | void gsm0408_allow_everyone(int allow); |
Holger Freyther | e97f7fb | 2008-12-31 18:52:11 +0000 | [diff] [blame] | 499 | void gsm0408_set_reject_cause(int cause); |
| 500 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 501 | int gsm0408_rcvmsg(struct msgb *msg); |
Holger Freyther | 1774661 | 2008-12-28 16:32:44 +0000 | [diff] [blame] | 502 | void gsm0408_generate_lai(struct gsm48_loc_area_id *lai48, u_int16_t mcc, |
| 503 | u_int16_t mnc, u_int16_t lac); |
Harald Welte | 49f48b8 | 2009-02-17 15:29:33 +0000 | [diff] [blame] | 504 | int gsm48_cc_tx_setup(struct gsm_lchan *lchan, struct gsm_subscriber *calling); |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 505 | enum gsm_chan_t get_ctype_by_chreq(struct gsm_bts *bts, u_int8_t ra); |
Harald Welte | e14a57c | 2008-12-29 04:08:28 +0000 | [diff] [blame] | 506 | enum gsm_chreq_reason_t get_reason_by_chreq(struct gsm_bts *bts, u_int8_t ra); |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 507 | |
Harald Welte | c6ba9c2 | 2008-12-30 18:01:02 +0000 | [diff] [blame] | 508 | int gsm48_tx_mm_info(struct gsm_lchan *lchan); |
Holger Freyther | 819dd20 | 2009-01-04 03:52:50 +0000 | [diff] [blame] | 509 | struct msgb *gsm48_msgb_alloc(void); |
Holger Freyther | 3e2c323 | 2009-01-04 03:55:31 +0000 | [diff] [blame] | 510 | int gsm48_sendmsg(struct msgb *msg); |
Holger Freyther | ca362a6 | 2009-01-04 21:05:01 +0000 | [diff] [blame] | 511 | int generate_mid_from_tmsi(u_int8_t *buf, u_int32_t tmsi); |
Harald Welte | c6ba9c2 | 2008-12-30 18:01:02 +0000 | [diff] [blame] | 512 | |
Holger Freyther | e64a7a3 | 2009-02-06 21:55:37 +0000 | [diff] [blame] | 513 | int gsm48_send_rr_release(struct gsm_lchan *lchan); |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 514 | |
Harald Welte | 0932d1e | 2009-02-16 22:53:52 +0000 | [diff] [blame] | 515 | /* convert a ASCII phone number to call-control BCD */ |
| 516 | int encode_bcd_number(u_int8_t *bcd_lv, u_int8_t max_len, |
| 517 | u_int8_t type, const char *input); |
| 518 | u_int8_t decode_bcd_number(char *output, int output_len, const u_int8_t *bcd_lv); |
| 519 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 520 | #endif |