Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 1 | module L3_Templates { |
| 2 | |
Harald Welte | 35bb716 | 2018-01-03 21:07:52 +0100 | [diff] [blame] | 3 | /* L3 Templates, building on top of MobileL3*_Types from Ericsson. |
| 4 | * |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 5 | * (C) 2017-2018 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 35bb716 | 2018-01-03 21:07:52 +0100 | [diff] [blame] | 6 | * All rights reserved. |
| 7 | * |
| 8 | * Released under the terms of GNU General Public License, Version 2 or |
| 9 | * (at your option) any later version. |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 10 | * |
| 11 | * SPDX-License-Identifier: GPL-2.0-or-later |
Harald Welte | 35bb716 | 2018-01-03 21:07:52 +0100 | [diff] [blame] | 12 | */ |
| 13 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 14 | import from General_Types all; |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 15 | import from Osmocom_Types all; |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 16 | import from MobileL3_Types all; |
| 17 | import from MobileL3_CommonIE_Types all; |
| 18 | import from MobileL3_MM_Types all; |
| 19 | import from MobileL3_RRM_Types all; |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 20 | import from MobileL3_CC_Types all; |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 21 | import from MobileL3_GMM_SM_Types all; |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 22 | import from MobileL3_SMS_Types all; |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 23 | |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 24 | /* TS 24.007 Table 11.3 TI Flag */ |
| 25 | const BIT1 c_TIF_ORIG := '0'B; |
| 26 | const BIT1 c_TIF_REPL := '1'B; |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 27 | |
| 28 | type enumerated CmServiceType { |
| 29 | CM_TYPE_MO_CALL ('0001'B), |
| 30 | CM_TYPE_EMERG_CALL ('0010'B), |
| 31 | CM_TYPE_MO_SMS ('0100'B), |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 32 | CM_TYPE_SS_ACT ('1000'B), |
| 33 | CM_TYPE_VGCS ('1001'B), |
| 34 | CM_TYPE_VBS ('1010'B), |
| 35 | CM_TYPE_LCS ('1011'B) |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 36 | } |
| 37 | |
Oliver Smith | 3289845 | 2019-07-09 12:32:35 +0200 | [diff] [blame] | 38 | /* TS 24.008 10.5.3.4 Identity Type */ |
| 39 | type enumerated CmIdentityType { |
| 40 | CM_ID_TYPE_IMSI ('001'B), |
| 41 | CM_ID_TYPE_IMEI ('010'B), |
| 42 | CM_ID_TYPE_IMEISV ('011'B), |
| 43 | CM_ID_TYPE_TMSI ('100'B), |
| 44 | CM_ID_TYPE_PTMSI_RAI_PTMSI_SIG ('101'B) |
| 45 | } |
| 46 | |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 47 | template ML3_Cause_TLV ts_ML3_Cause(BIT7 cause, BIT4 loc := '0001'B, BIT2 std := '11'B) := { |
| 48 | elementIdentifier := '08'O, |
| 49 | lengthIndicator := 0, /* overwritten */ |
| 50 | oct3 := { |
| 51 | location := loc, |
| 52 | spare1_1 := '0'B, |
| 53 | codingStandard := std, |
| 54 | ext1 := '0'B, |
| 55 | recommendation := omit, |
| 56 | ext2 := omit |
| 57 | }, |
| 58 | oct4 := { |
| 59 | causeValue := cause, |
| 60 | ext3 := '1'B |
| 61 | }, |
| 62 | diagnostics := omit |
| 63 | } |
| 64 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 65 | |
Vadim Yanitskiy | c94c572 | 2020-03-28 05:17:23 +0700 | [diff] [blame] | 66 | /* 3GPP TS 24.008, section 10.5.1.4 "Mobile Identity" */ |
| 67 | template (value) MobileIdentityTLV ts_MI_TLV(template (value) MobileIdentityV mi) := { |
| 68 | elementIdentifier := '0010111'B, |
| 69 | spare1 := '0'B, |
| 70 | mobileIdentityLV := ts_MI_LV(mi) |
| 71 | }; |
| 72 | template MobileIdentityTLV tr_MI_TLV(template MobileIdentityV mi) := { |
| 73 | elementIdentifier := '0010111'B, |
| 74 | spare1 := '0'B, |
| 75 | mobileIdentityLV := tr_MI_LV(mi) |
| 76 | }; |
| 77 | |
| 78 | template (value) MobileIdentityLV ts_MI_LV(template (value) MobileIdentityV mi) := { |
| 79 | lengthIndicator := 0, /* overwritten */ |
| 80 | mobileIdentityV := mi |
| 81 | }; |
| 82 | template MobileIdentityLV tr_MI_LV(template MobileIdentityV mi) := { |
| 83 | lengthIndicator := ?, |
| 84 | mobileIdentityV := mi |
| 85 | }; |
| 86 | |
| 87 | /* Universal (send & receive) template for No Identity */ |
| 88 | template MobileIdentityV t_MI_NoIdentity(template (present) hexstring filler := 'F'H) := { |
| 89 | typeOfIdentity := '000'B, |
| 90 | oddEvenInd_identity := { |
| 91 | no_identity := { |
| 92 | /* Always old, since length can be 1, 3, or 5 */ |
| 93 | oddevenIndicator := '0'B, |
| 94 | fillerDigits := filler |
| 95 | } |
| 96 | } |
| 97 | }; |
| 98 | |
| 99 | /* Universal (send & receive) template for TMSI/P-TMSI */ |
| 100 | template MobileIdentityV t_MI_TMSI(template (present) OCT4 tmsi) := { |
| 101 | typeOfIdentity := '100'B, |
| 102 | oddEvenInd_identity := { |
| 103 | tmsi_ptmsi := { |
| 104 | oddevenIndicator := '0'B, |
| 105 | fillerDigit := '1111'B, |
| 106 | octets := tmsi |
| 107 | } |
| 108 | } |
| 109 | }; |
| 110 | |
| 111 | private function f_tr_MI_IMSI(template (present) hexstring digits) |
| 112 | return template (present) IMSI_L3 { |
| 113 | if (istemplatekind(digits, "?")) { |
| 114 | return ?; |
| 115 | } else { |
| 116 | return f_enc_IMSI_L3(valueof(digits)) |
| 117 | } |
| 118 | } |
| 119 | template MobileIdentityV tr_MI_IMSI(template hexstring imsi) := { |
| 120 | typeOfIdentity := '001'B, |
| 121 | oddEvenInd_identity := { |
| 122 | imsi := f_tr_MI_IMSI(imsi) |
| 123 | } |
| 124 | }; |
| 125 | |
| 126 | |
Oliver Smith | b4bf2b2 | 2019-07-09 11:55:15 +0200 | [diff] [blame] | 127 | /* send template for Mobile Identity (TMSI) */ |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 128 | template MobileIdentityLV ts_MI_TMSI_LV(OCT4 tmsi) := { |
| 129 | lengthIndicator := 0, /* overwritten */ |
| 130 | mobileIdentityV := { |
| 131 | typeOfIdentity := '000'B, /* overwritten */ |
| 132 | oddEvenInd_identity := { |
| 133 | tmsi_ptmsi := { |
| 134 | oddevenIndicator := '0'B, |
| 135 | fillerDigit := '1111'B, |
| 136 | octets := tmsi |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | |
Oliver Smith | b4bf2b2 | 2019-07-09 11:55:15 +0200 | [diff] [blame] | 142 | /* send template for Mobile Identity (TMSI) */ |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 143 | function ts_MI_TMSI_TLV(template (omit) OCT4 tmsi) return template (omit) MobileIdentityTLV { |
| 144 | var template (omit) MobileIdentityTLV ret; |
| 145 | if (istemplatekind(tmsi, "omit")) { |
| 146 | return omit; |
| 147 | } else { |
| 148 | ret := { |
| 149 | elementIdentifier := '0100011'B, |
| 150 | spare1 := '0'B, |
| 151 | mobileIdentityLV := ts_MI_TMSI_LV(valueof(tmsi)) |
| 152 | } |
| 153 | return ret; |
| 154 | } |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 155 | } |
| 156 | |
Harald Welte | b0386df | 2018-02-16 18:14:28 +0100 | [diff] [blame] | 157 | template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := { |
| 158 | elementIdentifier := '0100011'B, |
| 159 | spare1 := '0'B, |
| 160 | mobileIdentityLV := ts_MI_IMEISV_LV(imeisv) |
| 161 | } |
| 162 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 163 | private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 { |
| 164 | var IMSI_L3 l3; |
| 165 | var integer len := lengthof(digits); |
| 166 | if (len rem 2 == 1) { /* modulo remainder */ |
Harald Welte | 365f4ed | 2017-11-23 00:00:43 +0100 | [diff] [blame] | 167 | l3.oddevenIndicator := '1'B; |
Harald Welte | ae13625 | 2018-01-24 20:53:21 +0100 | [diff] [blame] | 168 | l3.fillerDigit := omit; |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 169 | } else { |
Harald Welte | 365f4ed | 2017-11-23 00:00:43 +0100 | [diff] [blame] | 170 | l3.oddevenIndicator := '0'B; |
Harald Welte | ae13625 | 2018-01-24 20:53:21 +0100 | [diff] [blame] | 171 | l3.fillerDigit := '1111'B; |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 172 | } |
| 173 | l3.digits := digits; |
| 174 | return l3; |
| 175 | } |
| 176 | |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 177 | private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 { |
| 178 | var IMEI_L3 l3; |
| 179 | var integer len := lengthof(digits); |
| 180 | if (len rem 2 == 1) { /* modulo remainder */ |
| 181 | l3.oddevenIndicator := '1'B; |
| 182 | } else { |
| 183 | l3.oddevenIndicator := '0'B; |
| 184 | } |
| 185 | l3.digits := digits; |
| 186 | return l3; |
| 187 | } |
| 188 | |
Harald Welte | b0386df | 2018-02-16 18:14:28 +0100 | [diff] [blame] | 189 | private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV { |
| 190 | var IMEI_SV l3; |
| 191 | var integer len := lengthof(digits); |
| 192 | if (len rem 2 == 1) { /* modulo remainder */ |
| 193 | l3.oddevenIndicator := '1'B; |
| 194 | } else { |
| 195 | l3.oddevenIndicator := '0'B; |
| 196 | } |
| 197 | l3.digits := digits; |
| 198 | l3.fillerDigit := '1111'B; |
| 199 | return l3; |
| 200 | } |
| 201 | |
Oliver Smith | b4bf2b2 | 2019-07-09 11:55:15 +0200 | [diff] [blame] | 202 | /* send template for Mobile Identity (IMSI) */ |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 203 | template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := { |
| 204 | lengthIndicator := 0, /* overwritten */ |
| 205 | mobileIdentityV := { |
Harald Welte | 519db89 | 2018-02-16 18:15:22 +0100 | [diff] [blame] | 206 | typeOfIdentity := '001'B, |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 207 | oddEvenInd_identity := { |
| 208 | imsi := f_enc_IMSI_L3(imsi_digits) |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
Oliver Smith | b4bf2b2 | 2019-07-09 11:55:15 +0200 | [diff] [blame] | 213 | /* send template for Mobile Identity (IMEI) */ |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 214 | template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := { |
| 215 | lengthIndicator := 0, /* overwritten */ |
| 216 | mobileIdentityV := { |
Harald Welte | 519db89 | 2018-02-16 18:15:22 +0100 | [diff] [blame] | 217 | typeOfIdentity := '010'B, |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 218 | oddEvenInd_identity := { |
| 219 | imei := f_enc_IMEI_L3(imei_digits) |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | |
Oliver Smith | b4bf2b2 | 2019-07-09 11:55:15 +0200 | [diff] [blame] | 224 | /* send template for Mobile Identity (IMEISV) */ |
Harald Welte | b0386df | 2018-02-16 18:14:28 +0100 | [diff] [blame] | 225 | template (value) MobileIdentityLV ts_MI_IMEISV_LV(hexstring imei_digits) := { |
| 226 | lengthIndicator := 0, /* overwritten */ |
| 227 | mobileIdentityV := { |
| 228 | typeOfIdentity := '011'B, |
| 229 | oddEvenInd_identity := { |
| 230 | imei_sv := f_enc_IMEI_SV(imei_digits) |
| 231 | } |
| 232 | } |
| 233 | } |
| 234 | |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 235 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 236 | /* Send template for Classmark 2 */ |
| 237 | template (value) MobileStationClassmark2_LV ts_CM2 := { |
| 238 | lengthIndicator := 0, |
| 239 | rf_PowerCapability := '000'B, |
| 240 | a5_1 := '0'B, |
| 241 | esind := '1'B, |
| 242 | revisionLevel := '10'B, |
| 243 | spare1_1 := '0'B, |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 244 | mobileStationClassmark2_oct4 := { |
| 245 | fc := '1'B, |
| 246 | vgcs := '0'B, |
| 247 | vbs := '0'B, |
| 248 | sm_Capability := '1'B, |
| 249 | ss_ScreenIndicator := '01'B, |
| 250 | ps_Capability := '1'B, |
| 251 | spare2_1 := '0'B |
| 252 | }, |
| 253 | mobileStationClassmark2_oct5 := { |
| 254 | a5_2 := '0'B, |
| 255 | a5_3 := '1'B, |
| 256 | cmsp := '0'B, |
| 257 | solsa := '0'B, |
| 258 | ucs2 := '0'B, |
| 259 | lcsva_cap := '0'B, |
| 260 | spare5_7 :='0'B, |
| 261 | cm3 := '0'B |
| 262 | } |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 263 | }; |
| 264 | |
| 265 | /* Send template for CM SERVICE REQUEST */ |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 266 | template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(CmServiceType serv_type, MobileIdentityLV mi_lv) := { |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 267 | discriminator := '0000'B, /* overwritten */ |
| 268 | tiOrSkip := { |
| 269 | skipIndicator := '0000'B |
| 270 | }, |
| 271 | msgs := { |
| 272 | mm := { |
| 273 | cMServiceRequest := { |
| 274 | messageType := '000000'B, /* overwritten */ |
| 275 | nsd := '00'B, |
Harald Welte | 6ed6bf9 | 2018-01-24 21:09:15 +0100 | [diff] [blame] | 276 | cm_ServiceType := int2bit(enum2int(serv_type), 4), |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 277 | cipheringKeySequenceNumber := { '000'B, '0'B }, |
| 278 | mobileStationClassmark2 := ts_CM2, |
| 279 | mobileIdentity := mi_lv, |
| 280 | priorityLevel := omit, |
| 281 | additionalUpdateParameterTV := omit, |
| 282 | deviceProperties := omit |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | |
Harald Welte | 0195ab1 | 2018-01-24 21:50:20 +0100 | [diff] [blame] | 288 | template (value) CipheringKeySequenceNumberV ts_CKSN(integer key_seq) := { |
| 289 | keySequence := int2bit(key_seq, 3), |
| 290 | spare := '0'B |
| 291 | } |
| 292 | |
| 293 | /* Send template for CM RE-ESTABLISH REQUEST */ |
| 294 | template (value) PDU_ML3_MS_NW ts_CM_REEST_REQ(integer cksn, MobileIdentityLV mi_lv) := { |
| 295 | discriminator := '0000'B, /* overwritten */ |
| 296 | tiOrSkip := { |
| 297 | skipIndicator := '0000'B |
| 298 | }, |
| 299 | msgs := { |
| 300 | mm := { |
| 301 | cMReEstablReq := { |
| 302 | messageType := '101000'B, /* overwritten */ |
| 303 | nsd := '00'B, |
| 304 | cipheringKeySequenceNumber := ts_CKSN(cksn), |
| 305 | spare := '0000'B, |
| 306 | mobileStationClassmark2 := ts_CM2, |
| 307 | mobileIdentityLV := mi_lv, |
| 308 | locationAreaIdentification := omit, |
| 309 | deviceProperties := omit |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 316 | template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := { |
| 317 | discriminator := discr, |
| 318 | tiOrSkip := { |
| 319 | skipIndicator := '0000'B |
| 320 | }, |
| 321 | msgs := ? |
| 322 | } |
| 323 | |
| 324 | |
| 325 | template PDU_ML3_NW_MS tr_CM_SERV_ACC := { |
| 326 | discriminator := '0101'B, |
| 327 | tiOrSkip := { |
| 328 | skipIndicator := '0000'B |
| 329 | }, |
| 330 | msgs := { |
| 331 | mm := { |
| 332 | cMServiceAccept := { |
| 333 | messageType := '100001'B, |
| 334 | nsd := ? |
| 335 | } |
| 336 | } |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 341 | template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := { |
| 342 | discriminator := '0101'B, |
| 343 | tiOrSkip := { |
| 344 | skipIndicator := '0000'B |
| 345 | }, |
| 346 | msgs := { |
| 347 | mm := { |
| 348 | cMServiceReject := { |
| 349 | messageType := '100010'B, |
| 350 | nsd := ?, |
| 351 | rejectCause := rej_cause, |
| 352 | t3246_Value := * |
| 353 | } |
| 354 | } |
| 355 | } |
| 356 | } |
| 357 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 358 | template PDU_ML3_NW_MS tr_PAGING_REQ1(template MobileIdentityLV mi1 := ?, |
| 359 | template MobileIdentityTLV mi2 := *) := { |
| 360 | discriminator := '0110'B, |
| 361 | tiOrSkip := { |
| 362 | skipIndicator := '0000'B |
| 363 | }, |
| 364 | msgs := { |
| 365 | rrm := { |
| 366 | pagingReq_Type1 := { |
| 367 | messageType := '00100001'B, |
| 368 | pageMode := ?, |
| 369 | channelNeeded := ?, |
| 370 | mobileIdentity1 := mi1, |
| 371 | mobileIdentity2 := mi2, |
| 372 | p1RestOctets := ? |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | } |
| 377 | |
Stefan Sperling | 4c32b95 | 2018-05-29 20:51:04 +0200 | [diff] [blame] | 378 | /* Template for receiving a Paging Request Type1 message with a given TMSI in the first mobile identity. */ |
Vadim Yanitskiy | 98bb2d5 | 2020-03-28 00:57:21 +0700 | [diff] [blame] | 379 | template MobileIdentityLV tr_PAGING_REQ1_MI1_TMSI(octetstring tmsi) := { |
Stefan Sperling | 4c32b95 | 2018-05-29 20:51:04 +0200 | [diff] [blame] | 380 | lengthIndicator := 5, |
| 381 | mobileIdentityV := { |
| 382 | typeOfIdentity := '100'B, |
| 383 | oddEvenInd_identity := { |
| 384 | tmsi_ptmsi := { |
| 385 | oddevenIndicator := '0'B, |
| 386 | fillerDigit := '1111'B, |
| 387 | octets := tmsi |
| 388 | } |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | } |
| 393 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 394 | template PDU_ML3_NW_MS tr_PAGING_REQ2(template TMSIP_TMSI_V mi1 := ?, |
| 395 | template TMSIP_TMSI_V mi2 := ?, |
| 396 | template MobileIdentityTLV mi3 := *) := { |
| 397 | discriminator := '0110'B, |
| 398 | tiOrSkip := { |
| 399 | skipIndicator := '0000'B |
| 400 | }, |
| 401 | msgs := { |
| 402 | rrm := { |
| 403 | pagingReq_Type2 := { |
| 404 | messageType := '00100010'B, |
| 405 | pageMode := ?, |
| 406 | channelNeeded := ?, |
| 407 | mobileIdentity1 := mi1, |
| 408 | mobileIdentity2 := mi2, |
| 409 | mobileIdentity3 := mi3, |
| 410 | p2RestOctets := ? |
| 411 | } |
| 412 | } |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | template PDU_ML3_NW_MS tr_PAGING_REQ3(template TMSIP_TMSI_V mi1 := ?, |
| 417 | template TMSIP_TMSI_V mi2 := ?, |
| 418 | template TMSIP_TMSI_V mi3 := ?, |
| 419 | template TMSIP_TMSI_V mi4 := ?) := { |
| 420 | discriminator := '0110'B, |
| 421 | tiOrSkip := { |
| 422 | skipIndicator := '0000'B |
| 423 | }, |
| 424 | msgs := { |
| 425 | rrm := { |
| 426 | pagingReq_Type3 := { |
| 427 | messageType := '00100100'B, |
| 428 | pageMode := ?, |
| 429 | channelNeeded := ?, |
| 430 | mobileIdentity1 := mi1, |
| 431 | mobileIdentity2 := mi2, |
| 432 | mobileIdentity3 := mi3, |
| 433 | mobileIdentity4 := mi4, |
| 434 | p3RestOctets := ? |
| 435 | } |
| 436 | } |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | |
| 441 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 442 | /* Send template for PAGING RESPONSE */ |
| 443 | template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := { |
| 444 | discriminator := '0000'B, /* overwritten */ |
| 445 | tiOrSkip := { |
| 446 | skipIndicator := '0000'B |
| 447 | }, |
| 448 | msgs := { |
| 449 | rrm := { |
| 450 | pagingResponse := { |
| 451 | messageType := '00000000'B, /* overwritten */ |
| 452 | cipheringKeySequenceNumber := { '000'B, '0'B }, |
| 453 | spare1_4 := '0000'B, |
| 454 | mobileStationClassmark := ts_CM2, |
| 455 | mobileIdentity := mi_lv, |
| 456 | additionalUpdateParameters := omit |
| 457 | } |
| 458 | } |
| 459 | } |
| 460 | } |
| 461 | |
Harald Welte | 1516614 | 2017-12-16 23:02:08 +0100 | [diff] [blame] | 462 | template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := { |
| 463 | discriminator := '0000'B, /* overwritten */ |
| 464 | tiOrSkip := { |
| 465 | skipIndicator := '0000'B |
| 466 | }, |
| 467 | msgs := { |
| 468 | rrm := { |
| 469 | channelModeModifyAck := { |
| 470 | messageType := '00010111'B, |
| 471 | channelDescription := desc, |
| 472 | channelMode := mode, |
| 473 | extendedTSCSet := omit |
| 474 | } |
| 475 | } |
| 476 | } |
| 477 | } |
| 478 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 479 | template (value) PDU_ML3_NW_MS ts_RRM_CiphModeCmd(BIT3 alg_id) := { |
| 480 | discriminator := '0000'B, /* overwritten */ |
| 481 | tiOrSkip := { |
| 482 | skipIndicator := '0000'B |
| 483 | }, |
| 484 | msgs := { |
| 485 | rrm := { |
| 486 | cipheringModeCommand := { |
| 487 | messageType := '00110101'B, |
| 488 | cipherModeSetting := { |
| 489 | sC := '1'B, |
| 490 | algorithmIdentifier := alg_id |
| 491 | }, |
| 492 | cipherModeResponse := { |
| 493 | cR := '0'B, |
| 494 | spare := '000'B |
| 495 | } |
| 496 | } |
| 497 | } |
| 498 | } |
| 499 | } |
| 500 | |
Harald Welte | 73cd271 | 2017-12-17 00:44:52 +0100 | [diff] [blame] | 501 | template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := { |
| 502 | discriminator := '0000'B, /* overwritten */ |
| 503 | tiOrSkip := { |
| 504 | skipIndicator := '0000'B |
| 505 | }, |
| 506 | msgs := { |
| 507 | rrm := { |
| 508 | cipheringModeComplete := { |
| 509 | messageType := '00110010'B, |
| 510 | mobileEquipmentIdentity := omit |
| 511 | } |
| 512 | } |
| 513 | } |
| 514 | } |
| 515 | |
Harald Welte | ecb254b | 2018-01-29 22:01:54 +0100 | [diff] [blame] | 516 | template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := { |
| 517 | discriminator := '0000'B, /* overwritten */ |
| 518 | tiOrSkip := { |
| 519 | skipIndicator := '0000'B |
| 520 | }, |
| 521 | msgs := { |
| 522 | rrm := { |
| 523 | assignmentComplete := { |
| 524 | messageType := '00101001'B, |
| 525 | rR_Cause := { |
| 526 | valuePart := cause |
| 527 | } |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | } |
Harald Welte | 1516614 | 2017-12-16 23:02:08 +0100 | [diff] [blame] | 532 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 533 | template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := { |
| 534 | discriminator := '0000'B, /* overwritten */ |
| 535 | tiOrSkip := { |
| 536 | skipIndicator := '0000'B |
| 537 | }, |
| 538 | msgs := { |
| 539 | rrm := { |
| 540 | assignmentFailure := { |
| 541 | messageType := '00101111'B, |
| 542 | rR_Cause := { |
| 543 | valuePart := cause |
| 544 | } |
| 545 | } |
| 546 | } |
| 547 | } |
| 548 | } |
| 549 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 550 | template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := { |
| 551 | discriminator := '0000'B, /* overwritten */ |
| 552 | tiOrSkip := { |
| 553 | skipIndicator := '0000'B |
| 554 | }, |
| 555 | msgs := { |
| 556 | rrm := { |
| 557 | handoverFailure := { |
| 558 | messageType := '00101000'B, |
| 559 | rRCause := { |
| 560 | valuePart := cause |
| 561 | }, |
| 562 | pSCause := omit |
| 563 | } |
| 564 | } |
| 565 | } |
| 566 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 567 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 568 | template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := { |
| 569 | discriminator := '0000'B, /* overwritten */ |
| 570 | tiOrSkip := { |
| 571 | skipIndicator := '0000'B |
| 572 | }, |
| 573 | msgs := { |
| 574 | rrm := { |
| 575 | handoverComplete := { |
| 576 | messageType := '00101100'B, |
| 577 | rRCause := { |
| 578 | valuePart := cause |
| 579 | }, |
| 580 | mobileObsservedTimeDiff := omit, |
| 581 | mobileTimeDifferenceHyperframe := omit |
| 582 | } |
| 583 | } |
| 584 | } |
| 585 | } |
| 586 | |
Harald Welte | 187f7a9 | 2019-09-05 11:15:20 +0200 | [diff] [blame] | 587 | template (present) PDU_ML3_NW_MS tr_RR_APP_INFO(template (present) BIT4 apdu_id, |
| 588 | template (present) octetstring data, |
| 589 | template (present) APDU_Flags_V flags := ?) := { |
| 590 | discriminator := '0000'B, /* overwritten */ |
| 591 | tiOrSkip := { |
| 592 | skipIndicator := '0000'B |
| 593 | }, |
| 594 | msgs := { |
| 595 | rrm := { |
| 596 | applicationInformation := { |
| 597 | messageType := '00111000'B, |
| 598 | aPDU_ID := apdu_id, |
| 599 | aPDU_Flags := flags, |
| 600 | aPDU_Data := { |
| 601 | lengthIndicator := ?, |
| 602 | aPDU_DataValue := data |
| 603 | } |
| 604 | } |
| 605 | } |
| 606 | } |
| 607 | } |
| 608 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 609 | template (value) PDU_ML3_NW_MS ts_RR_HandoverCommand := { |
| 610 | discriminator := '0110'B, |
| 611 | tiOrSkip := { |
| 612 | skipIndicator := '0000'B |
| 613 | }, |
| 614 | msgs := { |
| 615 | rrm := { |
| 616 | handoverCommand := { |
| 617 | messageType := '00101011'B, |
| 618 | cellDescription := { |
| 619 | bcc := '001'B, |
| 620 | ncc := '010'B, |
| 621 | BCCHArfcn_HighPart := '11'B, |
| 622 | BCCHArfcn_LowPart := '04'O |
| 623 | }, |
| 624 | channelDescription2 := { |
| 625 | timeslotNumber := '110'B, |
| 626 | channelTypeandTDMAOffset := '00001'B, |
| 627 | octet3 := '00'O, |
| 628 | octet4 := '09'O |
| 629 | }, |
| 630 | handoverReference := { |
| 631 | handoverReferenceValue := '00'O |
| 632 | }, |
| 633 | powerCommandAndAccesstype := { |
| 634 | powerlevel := '00000'B, |
| 635 | fPC_EP := '0'B, |
| 636 | ePC_Mode := '0'B, |
| 637 | aTC := '0'B |
| 638 | }, |
| 639 | synchronizationIndication := omit, |
| 640 | frequencyShortListAfterTime := omit, |
| 641 | frequencyListAfterTime := omit, |
| 642 | cellChannelDescription := omit, |
| 643 | multislotAllocation := omit, |
| 644 | modeOfChannelSet1 := omit, |
| 645 | modeOfChannelSet2 := omit, |
| 646 | modeOfChannelSet3 := omit, |
| 647 | modeOfChannelSet4 := omit, |
| 648 | modeOfChannelSet5 := omit, |
| 649 | modeOfChannelSet6 := omit, |
| 650 | modeOfChannelSet7 := omit, |
| 651 | modeOfChannelSet8 := omit, |
| 652 | descrOf2ndCh_at := omit, |
| 653 | modeOf2ndChannel := omit, |
| 654 | frequencyChannelSequence_at := omit, |
| 655 | mobileAllocation_at := omit, |
| 656 | startingTime := omit, |
| 657 | timeDifference := omit, |
| 658 | timingAdvance := omit, |
| 659 | frequencyShortListBeforeTime := omit, |
| 660 | frequencyListBeforeTime := omit, |
| 661 | descrOf1stCh_bt := omit, |
| 662 | descrOf2ndCh_bt := omit, |
| 663 | frequencyChannelSequence_bt := omit, |
| 664 | mobileAllocation_bt := omit, |
| 665 | cipherModeSetting := omit, |
| 666 | vGCS_TargetModeIndication := omit, |
| 667 | multiRateConfiguration := omit, |
| 668 | dynamicARFCN_Mapping := omit, |
| 669 | vGCS_Ciphering_Parameters := omit, |
| 670 | dedicatedServiceInformation := omit, |
| 671 | pLMNIndex := omit, |
| 672 | extendedTSCSet_afterTime := omit, |
| 673 | extendedTSCSet_beforeTime := omit |
| 674 | } |
| 675 | } |
| 676 | } |
| 677 | } |
| 678 | |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 679 | template PDU_ML3_NW_MS tr_RR_HandoverCommand := { |
| 680 | discriminator := '0110'B, |
| 681 | tiOrSkip := { |
| 682 | skipIndicator := '0000'B |
| 683 | }, |
| 684 | msgs := { |
| 685 | rrm := { |
| 686 | handoverCommand := { |
| 687 | messageType := '00101011'B, |
| 688 | cellDescription := ?, |
| 689 | channelDescription2 := ?, |
| 690 | handoverReference := ?, |
| 691 | powerCommandAndAccesstype := ?, |
| 692 | synchronizationIndication := *, |
| 693 | frequencyShortListAfterTime := *, |
| 694 | frequencyListAfterTime := *, |
| 695 | cellChannelDescription := *, |
| 696 | multislotAllocation := *, |
| 697 | modeOfChannelSet1 := *, |
| 698 | modeOfChannelSet2 := *, |
| 699 | modeOfChannelSet3 := *, |
| 700 | modeOfChannelSet4 := *, |
| 701 | modeOfChannelSet5 := *, |
| 702 | modeOfChannelSet6 := *, |
| 703 | modeOfChannelSet7 := *, |
| 704 | modeOfChannelSet8 := *, |
| 705 | descrOf2ndCh_at := *, |
| 706 | modeOf2ndChannel := *, |
| 707 | frequencyChannelSequence_at := *, |
| 708 | mobileAllocation_at := *, |
| 709 | startingTime := *, |
| 710 | timeDifference := *, |
| 711 | timingAdvance := *, |
| 712 | frequencyShortListBeforeTime := *, |
| 713 | frequencyListBeforeTime := *, |
| 714 | descrOf1stCh_bt := *, |
| 715 | descrOf2ndCh_bt := *, |
| 716 | frequencyChannelSequence_bt := *, |
| 717 | mobileAllocation_bt := *, |
| 718 | cipherModeSetting := *, |
| 719 | vGCS_TargetModeIndication := *, |
| 720 | multiRateConfiguration := *, |
| 721 | dynamicARFCN_Mapping := *, |
| 722 | vGCS_Ciphering_Parameters := *, |
| 723 | dedicatedServiceInformation := *, |
| 724 | pLMNIndex := *, |
| 725 | extendedTSCSet_afterTime := *, |
| 726 | extendedTSCSet_beforeTime := * |
| 727 | } |
| 728 | } |
| 729 | } |
| 730 | } |
| 731 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 732 | function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV { |
| 733 | if (not isvalue(cm3)) { |
| 734 | return omit; |
| 735 | } |
| 736 | var template MobileStationClassmark3_TLV ret := { |
| 737 | elementIdentifier := '20'O, |
| 738 | lengthIndicator := 0, /* overwritten */ |
| 739 | valuePart := cm3 |
| 740 | } |
| 741 | return ret; |
| 742 | } |
| 743 | |
| 744 | template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2, |
| 745 | template (omit) MobileStationClassmark3_TLV cm3 := omit) := { |
| 746 | discriminator := '0110'B, |
| 747 | tiOrSkip := { |
| 748 | skipIndicator := '0000'B |
| 749 | }, |
| 750 | msgs := { |
| 751 | rrm := { |
| 752 | classmarkChange := { |
| 753 | messageType := '00010110'B, |
| 754 | mobileStationClassmark2 := cm2, |
| 755 | mobileStationClassmark3 := cm3 |
| 756 | } |
| 757 | } |
| 758 | } |
| 759 | } |
| 760 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 761 | template PDU_ML3_NW_MS tr_RRM_CM_ENQUIRY := { |
| 762 | discriminator := '0110'B, |
| 763 | tiOrSkip := { |
| 764 | skipIndicator := '0000'B |
| 765 | }, |
| 766 | msgs := { |
| 767 | rrm := { |
| 768 | classmarkEnquiry := { |
| 769 | messageType := '00010011'B, |
| 770 | classmarkEnquiryMask := * |
| 771 | } |
| 772 | } |
| 773 | } |
| 774 | } |
| 775 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 776 | template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := { |
| 777 | discriminator := '0110'B, |
| 778 | tiOrSkip := { |
| 779 | skipIndicator := '0000'B |
| 780 | }, |
| 781 | msgs := { |
| 782 | rrm := { |
| 783 | uplinkRelease := { |
| 784 | messageType := '00001110'B, |
| 785 | rR_Cause := { |
| 786 | valuePart := cause |
| 787 | } |
| 788 | } |
| 789 | } |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := { |
| 794 | discriminator := '0110'B, |
| 795 | tiOrSkip := { |
| 796 | skipIndicator := '0000'B |
| 797 | }, |
| 798 | msgs := { |
| 799 | rrm := { |
| 800 | rR_Status := { |
| 801 | messageType := '00010010'B, |
| 802 | rR_Cause := { |
| 803 | valuePart := cause |
| 804 | } |
| 805 | } |
| 806 | } |
| 807 | } |
| 808 | } |
| 809 | |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 810 | template PDU_ML3_NW_MS tr_RRM_RR_RELEASE(template OCT1 cause := ?) := { |
| 811 | discriminator := '0110'B, |
| 812 | tiOrSkip := { |
| 813 | skipIndicator := '0000'B |
| 814 | }, |
| 815 | msgs := { |
| 816 | rrm := { |
| 817 | channelRelease := { |
| 818 | messageType := '00001101'B, |
| 819 | rRCause := { |
| 820 | valuePart := cause |
| 821 | }, |
| 822 | bARange := *, |
| 823 | groupChannelDescription := *, |
| 824 | groupCipherKeyNumber := *, |
| 825 | gPRSResumption := *, |
| 826 | bAListPref := *, |
| 827 | uTRANFrequencyList := *, |
| 828 | cellChannelDescr := *, |
| 829 | cellSelectionIndicator := *, |
| 830 | enhanced_DTM_CS_Release_Indication := *, |
| 831 | vGCS_Ciphering_Parameters := *, |
| 832 | group_Channel_Description_2 := *, |
| 833 | talkerIdentity := *, |
| 834 | talkerPriorityStatus := *, |
| 835 | vGCS_AMR_Configuration := *, |
| 836 | individual_Priorities := * |
| 837 | } |
| 838 | } |
| 839 | } |
| 840 | } |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 841 | |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 842 | template PDU_ML3_NW_MS tr_RRM_RR_RELEASE_CSFB(template OCT1 cause := ?) modifies tr_RRM_RR_RELEASE := { |
| 843 | msgs := { |
| 844 | rrm := { |
| 845 | channelRelease := { |
| 846 | cellSelectionIndicator := { |
| 847 | elementIdentifier := '77'O, |
| 848 | lengthIndicator := ?, |
| 849 | cellSelectionIndicatorValue := ? |
| 850 | } |
| 851 | } |
| 852 | } |
| 853 | } |
| 854 | } |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 855 | |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 856 | template PDU_ML3_MS_NW ts_ML3_MO := { |
| 857 | discriminator := '0000'B, |
| 858 | tiOrSkip := { |
| 859 | skipIndicator := '0000'B |
| 860 | }, |
| 861 | msgs := ? |
| 862 | } |
| 863 | |
| 864 | template LocationUpdatingType ts_ML3_IE_LuType := { |
| 865 | lut := ?, |
| 866 | spare1_1 := '0'B, |
| 867 | fop := '0'B |
| 868 | } |
| 869 | |
| 870 | template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := { |
| 871 | lut := '00'B |
| 872 | } |
| 873 | |
| 874 | template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := { |
| 875 | lut := '01'B |
| 876 | } |
| 877 | |
| 878 | template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := { |
| 879 | lut := '10'B |
| 880 | } |
| 881 | |
| 882 | template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := { |
| 883 | keySequence := int2bit(cksn, 3), |
| 884 | spare := '0'B |
| 885 | } |
| 886 | |
| 887 | template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai, |
| 888 | MobileIdentityLV mi, MobileStationClassmark1_V cm1) |
| 889 | modifies ts_ML3_MO := { |
| 890 | msgs := { |
| 891 | mm := { |
| 892 | locationUpdateRequest := { |
| 893 | messageType := '001000'B, |
| 894 | nsd := '00'B, /* ? */ |
| 895 | locationUpdatingType := lu_type, |
| 896 | cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0), |
| 897 | locationAreaIdentification := lai, |
| 898 | mobileStationClassmark1 := cm1, |
| 899 | mobileIdentityLV := mi, |
| 900 | classmarkInformationType2_forUMTS := omit, |
| 901 | additionalUpdateParameterTV := omit, |
| 902 | deviceProperties := omit, |
| 903 | mS_NetworkFeatureSupport := omit |
| 904 | } |
| 905 | } |
| 906 | } |
| 907 | } |
| 908 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 909 | template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := { |
| 910 | msgs := { |
| 911 | mm := { |
| 912 | tmsiReallocComplete := { |
| 913 | messageType := '011011'B, |
| 914 | nsd := '00'B |
| 915 | } |
| 916 | } |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := { |
| 921 | discriminator := '0101'B, |
| 922 | tiOrSkip := { |
| 923 | skipIndicator := '0000'B |
| 924 | }, |
| 925 | msgs := { |
| 926 | mm := { |
| 927 | locationUpdateAccept := { |
| 928 | messageType := '000010'B, |
| 929 | nsd := '00'B, |
| 930 | locationAreaIdentification := ?, |
| 931 | mobileIdentityTLV := *, |
| 932 | followOnProceed := *, |
| 933 | cTS_Permission := *, |
| 934 | equivalentPLMNs := *, |
| 935 | emergencyNumberList := *, |
| 936 | perMS_T3212 := * |
| 937 | } |
| 938 | } |
| 939 | } |
| 940 | } |
| 941 | |
| 942 | template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := { |
| 943 | discriminator := '0101'B, |
| 944 | tiOrSkip := { |
| 945 | skipIndicator := '0000'B |
| 946 | }, |
| 947 | msgs := { |
| 948 | mm := { |
| 949 | locationUpdateReject := { |
| 950 | messageType := '000100'B, |
| 951 | nsd := '00'B, |
| 952 | rejectCause := cause, |
| 953 | t3246_Value := * |
| 954 | } |
| 955 | } |
| 956 | } |
| 957 | } |
| 958 | |
Oliver Smith | af2f1f8 | 2019-07-19 12:33:12 +0200 | [diff] [blame] | 959 | private function f_id_type_or_any(template CmIdentityType id_type) return template bitstring { |
| 960 | if (istemplatekind(id_type, "?")) { |
| 961 | return ?; |
| 962 | } else { |
| 963 | return int2bit(enum2int(valueof(id_type)), 3); |
| 964 | } |
| 965 | } |
| 966 | |
Oliver Smith | 3289845 | 2019-07-09 12:32:35 +0200 | [diff] [blame] | 967 | template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template CmIdentityType id_type := ?) := { |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 968 | discriminator := '0101'B, |
| 969 | tiOrSkip := { |
| 970 | skipIndicator := '0000'B |
| 971 | }, |
| 972 | msgs := { |
| 973 | mm := { |
| 974 | identityRequest := { |
| 975 | messageType := '011000'B, |
| 976 | nsd := '00'B, |
Oliver Smith | af2f1f8 | 2019-07-19 12:33:12 +0200 | [diff] [blame] | 977 | identityType := f_id_type_or_any(id_type), |
Harald Welte | ba7b6d9 | 2018-01-23 21:32:34 +0100 | [diff] [blame] | 978 | spare1_5 := ? |
| 979 | } |
| 980 | } |
| 981 | } |
| 982 | } |
| 983 | |
| 984 | template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := { |
| 985 | msgs := { |
| 986 | mm := { |
| 987 | identityResponse := { |
| 988 | messageType := '011001'B, |
| 989 | nsd := '00'B, |
| 990 | mobileIdentityLV := mi, |
| 991 | p_TMSI_TypeTV := omit, |
| 992 | routingAreaIdentification2TLV := omit, |
| 993 | p_TMSISignature2TLV := omit |
| 994 | } |
| 995 | } |
| 996 | } |
| 997 | } |
| 998 | template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) := |
| 999 | ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi))); |
| 1000 | template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) := |
| 1001 | ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei))); |
| 1002 | |
| 1003 | |
Neels Hofmeyr | 6338247 | 2018-03-01 19:57:44 +0100 | [diff] [blame] | 1004 | template (value) MobileStationClassmark1_V ts_CM1(BIT1 a5_1_unavail := '0'B, BIT2 rev := '10'B, BIT1 esind := '1'B) := { |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1005 | rf_PowerCapability := '010'B, |
| 1006 | a5_1 := a5_1_unavail, |
Neels Hofmeyr | 6338247 | 2018-03-01 19:57:44 +0100 | [diff] [blame] | 1007 | esind := esind, |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1008 | revisionLevel := rev, |
| 1009 | spare1_1 := '0'B |
| 1010 | } |
| 1011 | |
| 1012 | template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi, |
| 1013 | template MobileStationClassmark1_V cm1 := ts_CM1) |
| 1014 | modifies ts_ML3_MO := { |
| 1015 | msgs := { |
| 1016 | mm := { |
| 1017 | imsiDetachIndication := { |
| 1018 | messageType := '000001'B, |
| 1019 | nsd := '00'B, |
| 1020 | mobileStationClassmark1 := cm1, |
| 1021 | mobileIdentityLV := mi |
| 1022 | } |
| 1023 | } |
| 1024 | } |
| 1025 | } |
| 1026 | |
Harald Welte | d748a05 | 2018-01-22 02:59:24 +0100 | [diff] [blame] | 1027 | template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := { |
| 1028 | discriminator := '0011'B, |
| 1029 | tiOrSkip := { |
| 1030 | transactionId := { |
Daniel Willmann | dcf9eb9 | 2018-02-02 20:07:52 +0100 | [diff] [blame] | 1031 | tio := int2bit(tid, 3), |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 1032 | tiFlag := c_TIF_ORIG, |
Harald Welte | d748a05 | 2018-01-22 02:59:24 +0100 | [diff] [blame] | 1033 | tIExtension := omit |
| 1034 | } |
| 1035 | } |
| 1036 | } |
| 1037 | |
| 1038 | template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := { |
| 1039 | elementIdentifier := '5E'O, |
| 1040 | lengthIndicator := 0, /* overwritten */ |
| 1041 | numberingPlanIdentification := '0000'B, |
| 1042 | typeOfNumber := '000'B, /* unknown */ |
| 1043 | ext1 := '0'B, |
| 1044 | digits := digits |
| 1045 | } |
| 1046 | |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1047 | template CalledPartyBCD_Number tr_Called(template hexstring digits) := { |
| 1048 | elementIdentifier := '5E'O, |
| 1049 | lengthIndicator := ?, |
| 1050 | numberingPlanIdentification := ?, |
| 1051 | typeOfNumber := ?, |
| 1052 | ext1 := ?, |
| 1053 | digits := digits |
| 1054 | } |
| 1055 | |
Stefan Sperling | 26d57be | 2018-11-12 17:03:26 +0100 | [diff] [blame] | 1056 | private function f_pad_digits(hexstring digits) return hexstring { |
| 1057 | if (lengthof(digits) mod 2 != 0) { |
| 1058 | /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do. |
| 1059 | * Otherwise our template won't match the data received (see OS#2930). */ |
| 1060 | return digits & 'F'H; |
| 1061 | } |
| 1062 | return digits; |
| 1063 | } |
| 1064 | |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1065 | template CallingPartyBCD_Number tr_Calling(template hexstring digits) := { |
| 1066 | elementIdentifier := '5C'O, |
| 1067 | lengthIndicator := ?, |
| 1068 | oct3 := ?, |
Stefan Sperling | 26d57be | 2018-11-12 17:03:26 +0100 | [diff] [blame] | 1069 | digits := f_pad_digits(valueof(digits)) |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1070 | } |
| 1071 | |
Harald Welte | 4b2b3a6 | 2018-01-26 10:32:39 +0100 | [diff] [blame] | 1072 | type integer SpeechVer; |
| 1073 | |
| 1074 | template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := { |
| 1075 | speechVersionIndication := int2bit(ver-1,3) & suffix, |
| 1076 | spare1_1 := '0'B, |
| 1077 | cTM_or_Spare := '0'B, |
| 1078 | coding := '0'B, |
| 1079 | extension_octet_3a_3b := '0'B |
| 1080 | } |
| 1081 | |
| 1082 | template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B); |
| 1083 | template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B); |
| 1084 | |
Harald Welte | d748a05 | 2018-01-22 02:59:24 +0100 | [diff] [blame] | 1085 | template (value) BearerCapability_TLV ts_Bcap_voice := { |
| 1086 | elementIdentifier := '04'O, |
| 1087 | lengthIndicator := 0, /* overwritten */ |
| 1088 | octet3 := { |
| 1089 | informationTransferCapability := '000'B, |
| 1090 | transferMode := '0'B, |
| 1091 | codingStandard := '0'B, |
| 1092 | radioChannelRequirement := '11'B, /* FR preferred */ |
| 1093 | extension_octet_3 := '0'B, /* overwritten */ |
Harald Welte | 4b2b3a6 | 2018-01-26 10:32:39 +0100 | [diff] [blame] | 1094 | speech_aux_3a_3b := { |
| 1095 | valueof(ts_SpeechAuxHR(3)), |
| 1096 | valueof(ts_SpeechAuxFR(3)), |
| 1097 | valueof(ts_SpeechAuxFR(2)), |
| 1098 | valueof(ts_SpeechAuxFR(1)), |
| 1099 | valueof(ts_SpeechAuxHR(1)) |
| 1100 | } |
Harald Welte | d748a05 | 2018-01-22 02:59:24 +0100 | [diff] [blame] | 1101 | }, |
| 1102 | octet4 := omit, |
| 1103 | octet5 := omit, |
| 1104 | octet6 := omit, |
| 1105 | octet7 := omit |
| 1106 | } |
| 1107 | |
| 1108 | template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := { |
| 1109 | discriminator := '0011'B, |
| 1110 | tiOrSkip := { |
| 1111 | transactionId := { |
| 1112 | tio := int2bit(tid, 3), |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 1113 | tiFlag := c_TIF_ORIG, |
Harald Welte | d748a05 | 2018-01-22 02:59:24 +0100 | [diff] [blame] | 1114 | tIExtension := omit |
| 1115 | } |
| 1116 | }, |
| 1117 | msgs := { |
| 1118 | cc := { |
| 1119 | setup_MS_NW := { |
| 1120 | messageType := '000101'B, |
| 1121 | nsd := '00'B, |
| 1122 | bcRepeatIndicator := omit, |
| 1123 | bearerCapability1 := bcap, |
| 1124 | bearerCapability2 := omit, |
| 1125 | facility := omit, |
| 1126 | callingPartySubAddress := omit, |
| 1127 | calledPartyBCD_Number := ts_Called(called), |
| 1128 | calledPartySubAddress := omit, |
| 1129 | llc_RepeatIndicator := omit, |
| 1130 | lowLayerCompatibility1 := omit, |
| 1131 | lowLayerCompatibility2 := omit, |
| 1132 | hlc_RepeatIndicator := omit, |
| 1133 | highLayerCompatibility1 := omit, |
| 1134 | highLayerCompatibility2 := omit, |
| 1135 | user_user := omit, |
| 1136 | ss_VersionIndicator := omit, |
| 1137 | clir_Suppression := omit, |
| 1138 | clir_Invocation := omit, |
| 1139 | cC_Capabilities := omit, |
| 1140 | facility_ccbs1 := omit, |
| 1141 | facility_ccbs2 := omit, |
| 1142 | streamIdentifier := omit, |
| 1143 | supportedCodecs := omit, |
| 1144 | redial := omit |
| 1145 | } |
| 1146 | } |
| 1147 | } |
| 1148 | } |
| 1149 | |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1150 | template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := { |
| 1151 | discriminator := '0011'B, |
| 1152 | tiOrSkip := { |
| 1153 | transactionId := { |
| 1154 | tio := int2bit(tid, 3), |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 1155 | tiFlag := c_TIF_ORIG, |
Harald Welte | 45164da | 2018-01-24 12:51:27 +0100 | [diff] [blame] | 1156 | tIExtension := omit |
| 1157 | } |
| 1158 | }, |
| 1159 | msgs := { |
| 1160 | cc := { |
| 1161 | emergencySetup := { |
| 1162 | messageType := '001110'B, |
| 1163 | nsd := '00'B, |
| 1164 | bearerCapability := bcap, |
| 1165 | streamIdentifier := omit, |
| 1166 | supportedCodecs := omit, |
| 1167 | emergencyCategory := omit |
| 1168 | } |
| 1169 | } |
| 1170 | } |
| 1171 | } |
| 1172 | |
| 1173 | |
Harald Welte | d748a05 | 2018-01-22 02:59:24 +0100 | [diff] [blame] | 1174 | template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := { |
| 1175 | discriminator := '0011'B, |
| 1176 | tiOrSkip := { |
| 1177 | transactionId := { |
| 1178 | tio := int2bit(tid, 3), |
| 1179 | tiFlag := ?, |
| 1180 | tIExtension := omit |
| 1181 | } |
| 1182 | }, |
| 1183 | msgs := { |
| 1184 | cc := { |
| 1185 | callProceeding := { |
| 1186 | messageType := '000010'B, |
| 1187 | nsd := '00'B, |
| 1188 | repeatIndicator := *, |
| 1189 | bearerCapability1 := *, |
| 1190 | bearerCapability2 := *, |
| 1191 | facility := *, |
| 1192 | progressIndicator := *, |
| 1193 | priorityGranted := *, |
| 1194 | networkCCCapabilities := * |
| 1195 | } |
| 1196 | } |
| 1197 | } |
| 1198 | } |
| 1199 | |
| 1200 | template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := { |
| 1201 | discriminator := '0011'B, |
| 1202 | tiOrSkip := { |
| 1203 | transactionId := { |
| 1204 | tio := int2bit(tid, 3), |
| 1205 | tiFlag := ?, |
| 1206 | tIExtension := omit |
| 1207 | } |
| 1208 | }, |
| 1209 | msgs := { |
| 1210 | cc := { |
| 1211 | alerting_NW_MS := { |
| 1212 | messageType := '000001'B, |
| 1213 | nsd := '00'B, |
| 1214 | facility := *, |
| 1215 | progressIndicator := *, |
| 1216 | user_user := * |
| 1217 | } |
| 1218 | } |
| 1219 | } |
| 1220 | } |
| 1221 | |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1222 | template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := { |
| 1223 | discriminator := '0011'B, |
| 1224 | tiOrSkip := { |
| 1225 | transactionId := { |
| 1226 | tio := int2bit(tid, 3), |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 1227 | tiFlag := c_TIF_REPL, |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1228 | tIExtension := omit |
| 1229 | } |
| 1230 | }, |
| 1231 | msgs := { |
| 1232 | cc := { |
| 1233 | alerting_MS_NW := { |
| 1234 | messageType := '000001'B, |
| 1235 | nsd := '00'B, |
| 1236 | facility := omit, |
| 1237 | user_user := omit, |
| 1238 | ss_VersionIndicator := omit |
| 1239 | } |
| 1240 | } |
| 1241 | } |
| 1242 | } |
| 1243 | |
| 1244 | template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := { |
| 1245 | discriminator := '0011'B, |
| 1246 | tiOrSkip := { |
| 1247 | transactionId := { |
| 1248 | tio := int2bit(tid, 3), |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 1249 | tiFlag := c_TIF_REPL, |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1250 | tIExtension := omit |
| 1251 | } |
| 1252 | }, |
| 1253 | msgs := { |
| 1254 | cc := { |
| 1255 | alerting_MS_NW := { |
| 1256 | messageType := '000001'B, |
| 1257 | nsd := '00'B, |
| 1258 | facility := omit, |
| 1259 | user_user := omit, |
| 1260 | ss_VersionIndicator := omit |
| 1261 | } |
| 1262 | } |
| 1263 | } |
| 1264 | } |
| 1265 | |
| 1266 | template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := { |
| 1267 | discriminator := '0011'B, |
| 1268 | tiOrSkip := { |
| 1269 | transactionId := { |
| 1270 | tio := int2bit(tid, 3), |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 1271 | tiFlag := c_TIF_REPL, |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1272 | tIExtension := omit |
| 1273 | } |
| 1274 | }, |
| 1275 | msgs := { |
| 1276 | cc := { |
| 1277 | connect_MS_NW := { |
| 1278 | messageType := '000111'B, |
| 1279 | nsd := '00'B, |
| 1280 | facility := omit, |
| 1281 | connectedSubAddress := omit, |
| 1282 | user_user := omit, |
| 1283 | ss_VersionIndicator := omit, |
| 1284 | streamIdentifier := omit |
| 1285 | } |
| 1286 | } |
| 1287 | } |
| 1288 | } |
| 1289 | |
Harald Welte | 4017d55 | 2018-01-26 21:40:05 +0100 | [diff] [blame] | 1290 | template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := { |
| 1291 | discriminator := '0011'B, |
| 1292 | tiOrSkip := { |
| 1293 | transactionId := { |
| 1294 | tio := int2bit(tid, 3), |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 1295 | tiFlag := c_TIF_REPL, |
Harald Welte | 4017d55 | 2018-01-26 21:40:05 +0100 | [diff] [blame] | 1296 | tIExtension := omit |
| 1297 | } |
| 1298 | }, |
| 1299 | msgs := { |
| 1300 | cc := { |
| 1301 | connect_NW_MS := { |
| 1302 | messageType := '000111'B, |
| 1303 | nsd := '00'B, |
| 1304 | facility := *, |
| 1305 | progressIndicator := *, |
| 1306 | connectedNumber := *, |
| 1307 | connectedSubAddress := *, |
| 1308 | user_user := * |
| 1309 | } |
| 1310 | } |
| 1311 | } |
| 1312 | } |
| 1313 | |
| 1314 | template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := { |
| 1315 | discriminator := '0011'B, |
| 1316 | tiOrSkip := { |
| 1317 | transactionId := { |
| 1318 | tio := int2bit(tid, 3), |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 1319 | tiFlag := c_TIF_ORIG, |
Harald Welte | 4017d55 | 2018-01-26 21:40:05 +0100 | [diff] [blame] | 1320 | tIExtension := omit |
| 1321 | } |
| 1322 | }, |
| 1323 | msgs := { |
| 1324 | cc := { |
| 1325 | connectAck := { |
| 1326 | messageType := '001111'B, |
| 1327 | nsd := '00'B |
| 1328 | } |
| 1329 | } |
| 1330 | } |
| 1331 | } |
| 1332 | |
Daniel Willmann | 8b08437 | 2018-02-04 13:35:26 +0100 | [diff] [blame] | 1333 | template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := { |
| 1334 | discriminator := '0011'B, |
| 1335 | tiOrSkip := { |
| 1336 | transactionId := { |
| 1337 | tio := int2bit(tid, 3), |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 1338 | tiFlag := c_TIF_ORIG, |
Daniel Willmann | 8b08437 | 2018-02-04 13:35:26 +0100 | [diff] [blame] | 1339 | tIExtension := omit |
| 1340 | } |
| 1341 | }, |
| 1342 | msgs := { |
| 1343 | cc := { |
| 1344 | startDTMF := { |
| 1345 | messageType := '110101'B, |
| 1346 | nsd := '00'B, |
| 1347 | keypadFacility := { |
| 1348 | elementIdentifier := '2C'O, |
| 1349 | keypadInformation := int2bit(char2int(number), 7), |
| 1350 | spare_1 := '0'B |
| 1351 | } |
| 1352 | } |
| 1353 | } |
| 1354 | } |
| 1355 | } |
| 1356 | |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 1357 | template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := { |
| 1358 | discriminator := '0011'B, |
| 1359 | tiOrSkip := { |
| 1360 | transactionId := { |
| 1361 | tio := int2bit(tid, 3), |
| 1362 | tiFlag := ?, |
| 1363 | tIExtension := omit |
| 1364 | } |
| 1365 | }, |
| 1366 | msgs := { |
| 1367 | cc := { |
| 1368 | disconnect_NW_MS := { |
| 1369 | messageType := '100101'B, |
| 1370 | nsd := '00'B, |
| 1371 | cause := ?, |
| 1372 | facility := *, |
| 1373 | progressIndicator := *, |
| 1374 | user_user := *, |
| 1375 | allowedActions := * |
| 1376 | } |
| 1377 | } |
| 1378 | } |
| 1379 | } |
| 1380 | |
| 1381 | template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := { |
| 1382 | discriminator := '0011'B, |
| 1383 | tiOrSkip := { |
| 1384 | transactionId := { |
| 1385 | tio := int2bit(tid, 3), |
| 1386 | tiFlag := ?, |
| 1387 | tIExtension := omit |
| 1388 | } |
| 1389 | }, |
| 1390 | msgs := { |
| 1391 | cc := { |
| 1392 | release_NW_MS := { |
| 1393 | messageType := '101101'B, |
| 1394 | nsd := '00'B, |
| 1395 | cause := ?, |
| 1396 | secondCause := *, |
| 1397 | facility := *, |
| 1398 | user_user := * |
| 1399 | } |
| 1400 | } |
| 1401 | } |
| 1402 | } |
Harald Welte | d748a05 | 2018-01-22 02:59:24 +0100 | [diff] [blame] | 1403 | |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1404 | template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := { |
| 1405 | discriminator := '0011'B, |
| 1406 | tiOrSkip := { |
| 1407 | transactionId := { |
| 1408 | tio := int2bit(tid, 3), |
| 1409 | tiFlag := tid_remote, |
| 1410 | tIExtension := omit |
| 1411 | } |
| 1412 | }, |
| 1413 | msgs := { |
| 1414 | cc := { |
| 1415 | release_MS_NW := { |
| 1416 | messageType := '101101'B, |
| 1417 | nsd := '00'B, |
| 1418 | cause := ts_ML3_Cause(cause), |
| 1419 | secondCause := omit, |
| 1420 | facility := omit, |
| 1421 | user_user := omit, |
| 1422 | ss_VersionIndicator := omit |
| 1423 | } |
| 1424 | } |
| 1425 | } |
| 1426 | } |
| 1427 | |
| 1428 | |
Neels Hofmeyr | 2ca1ab4 | 2019-03-08 03:45:43 +0100 | [diff] [blame] | 1429 | template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_REL_COMPL(integer tid, BIT1 tid_remote := '0'B) := { |
Harald Welte | b71901a | 2018-01-26 19:16:05 +0100 | [diff] [blame] | 1430 | discriminator := '0011'B, |
| 1431 | tiOrSkip := { |
| 1432 | transactionId := { |
| 1433 | tio := int2bit(tid, 3), |
Neels Hofmeyr | 2ca1ab4 | 2019-03-08 03:45:43 +0100 | [diff] [blame] | 1434 | tiFlag := tid_remote, |
Harald Welte | b71901a | 2018-01-26 19:16:05 +0100 | [diff] [blame] | 1435 | tIExtension := omit |
| 1436 | } |
| 1437 | }, |
| 1438 | msgs := { |
| 1439 | cc := { |
| 1440 | releaseComplete_MS_NW := { |
| 1441 | messageType := '101010'B, |
| 1442 | nsd := '00'B, |
| 1443 | cause := omit, |
| 1444 | facility := omit, |
| 1445 | user_user := omit, |
| 1446 | ss_VersionIndicator := omit |
| 1447 | } |
| 1448 | } |
| 1449 | } |
| 1450 | } |
| 1451 | |
Harald Welte | 33ec09b | 2018-02-10 15:34:46 +0100 | [diff] [blame] | 1452 | template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := { |
| 1453 | discriminator := '0011'B, |
| 1454 | tiOrSkip := { |
| 1455 | transactionId := { |
| 1456 | tio := int2bit(tid, 3), |
| 1457 | tiFlag := ?, |
| 1458 | tIExtension := omit |
| 1459 | } |
| 1460 | }, |
| 1461 | msgs := { |
| 1462 | cc := { |
| 1463 | releaseComplete_NW_MS := { |
| 1464 | messageType := '101010'B, |
| 1465 | nsd := '00'B, |
| 1466 | cause := *, |
| 1467 | facility := *, |
| 1468 | user_user := * |
| 1469 | } |
| 1470 | } |
| 1471 | } |
| 1472 | } |
| 1473 | |
| 1474 | |
Harald Welte | b71901a | 2018-01-26 19:16:05 +0100 | [diff] [blame] | 1475 | |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 1476 | template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := { |
| 1477 | discriminator := '0101'B, |
| 1478 | tiOrSkip := { |
| 1479 | skipIndicator := '0000'B |
| 1480 | }, |
| 1481 | msgs := { |
| 1482 | mm := { |
| 1483 | authenticationRequest := { |
| 1484 | messageType := '010010'B, |
| 1485 | nsd := '00'B, |
| 1486 | cipheringKeySequenceNumber := ?, |
| 1487 | spare2_4 := ?, |
| 1488 | authenticationParRAND := rand, |
| 1489 | authenticationParAUTN := * |
| 1490 | } |
| 1491 | } |
| 1492 | } |
| 1493 | } |
| 1494 | |
Harald Welte | 0cedf2c | 2018-10-28 23:28:35 +0100 | [diff] [blame] | 1495 | template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := { |
| 1496 | discriminator := '0101'B, |
| 1497 | tiOrSkip := { |
| 1498 | skipIndicator := '0000'B |
| 1499 | }, |
| 1500 | msgs := { |
| 1501 | mm := { |
| 1502 | authenticationRequest := { |
| 1503 | messageType := '010010'B, |
| 1504 | nsd := '00'B, |
| 1505 | cipheringKeySequenceNumber := ?, |
| 1506 | spare2_4 := ?, |
| 1507 | authenticationParRAND := rand, |
| 1508 | authenticationParAUTN := { |
| 1509 | elementIdentifier := '20'O, |
| 1510 | lengthIndicator := ?, |
| 1511 | autnValue := autn |
| 1512 | } |
| 1513 | } |
| 1514 | } |
| 1515 | } |
| 1516 | } |
| 1517 | |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 1518 | template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := { |
| 1519 | discriminator := '0101'B, |
| 1520 | tiOrSkip := { |
| 1521 | skipIndicator := '0000'B |
| 1522 | }, |
| 1523 | msgs := { |
| 1524 | mm := { |
| 1525 | authenticationResponse := { |
| 1526 | messageType := '010100'B, |
| 1527 | nsd := '00'B, |
| 1528 | authenticationParSRES := sres, |
| 1529 | authenticationParSRESext := omit |
| 1530 | } |
| 1531 | } |
| 1532 | } |
| 1533 | } |
| 1534 | |
| 1535 | template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := { |
| 1536 | discriminator := '0101'B, |
| 1537 | tiOrSkip := { |
| 1538 | skipIndicator := '0000'B |
| 1539 | }, |
| 1540 | msgs := { |
| 1541 | mm := { |
| 1542 | authenticationResponse := { |
| 1543 | messageType := '010100'B, |
| 1544 | nsd := '00'B, |
| 1545 | authenticationParSRES := sres, |
| 1546 | authenticationParSRESext := { |
| 1547 | elementIdentifier := '21'O, |
| 1548 | lengthIndicator := 0, /* overwritten */ |
| 1549 | valueField := res |
| 1550 | } |
| 1551 | } |
| 1552 | } |
| 1553 | } |
| 1554 | } |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 1555 | |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1556 | template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid, |
| 1557 | template BearerCapability_TLV bcap := omit) := { |
| 1558 | discriminator := '0011'B, |
| 1559 | tiOrSkip := { |
| 1560 | transactionId := { |
| 1561 | tio := int2bit(tid, 3), |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 1562 | tiFlag := c_TIF_REPL, /* response from destination */ |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1563 | tIExtension := omit |
| 1564 | } |
| 1565 | }, |
| 1566 | msgs := { |
| 1567 | cc := { |
| 1568 | callConfirmed := { |
| 1569 | messageType := '001000'B, |
| 1570 | nsd := '00'B, |
| 1571 | repeatIndicator := omit, |
| 1572 | bearerCapability1 := bcap, |
| 1573 | bearerCapability2 := omit, |
| 1574 | cause := omit, |
| 1575 | cC_Capabilities := omit, |
| 1576 | streamIdentifier := omit, |
| 1577 | supportedCodecs := omit |
| 1578 | } |
| 1579 | } |
| 1580 | } |
| 1581 | } |
| 1582 | |
| 1583 | |
| 1584 | template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *, |
| 1585 | template hexstring calling := *, |
| 1586 | template BearerCapability_TLV bcap := *) := { |
| 1587 | discriminator := '0011'B, |
| 1588 | tiOrSkip := { |
| 1589 | transactionId := { |
| 1590 | tio := int2bit(tid, 3), |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 1591 | tiFlag := c_TIF_ORIG, /* from originator */ |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 1592 | tIExtension := omit |
| 1593 | } |
| 1594 | }, |
| 1595 | msgs := { |
| 1596 | cc := { |
| 1597 | setup_NW_MS := { |
| 1598 | messageType := '000101'B, |
| 1599 | nsd := '00'B, |
| 1600 | bcRepeatIndicator := *, |
| 1601 | bearerCapability1 := bcap, |
| 1602 | bearerCapability2 := *, |
| 1603 | facility := *, |
| 1604 | progressIndicator := *, |
| 1605 | signal := *, |
| 1606 | callingPartyBCD_Number := tr_Calling(calling) ifpresent, |
| 1607 | callingPartySubAddress := *, |
| 1608 | calledPartyBCD_Number := tr_Called(called) ifpresent, |
| 1609 | calledPartySubAddress := *, |
| 1610 | redirectingPartyBCDNumber := *, |
| 1611 | redirectingPartySubaddress := *, |
| 1612 | llc_RepeatIndicator := *, |
| 1613 | lowLayerCompatibility1 := *, |
| 1614 | lowLayerCompatibility2 := *, |
| 1615 | hlc_RepeatIndicator := *, |
| 1616 | highLayerCompatibility1 := *, |
| 1617 | highLayerCompatibility2 := *, |
| 1618 | user_user := *, |
| 1619 | priority := *, |
| 1620 | alert := *, |
| 1621 | networkCCCapabilities := *, |
| 1622 | causeofNoCli := *, |
| 1623 | backupBearerCapacity := * |
| 1624 | } |
| 1625 | } |
| 1626 | } |
| 1627 | } |
| 1628 | |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 1629 | /*********************************************************************** |
Harald Welte | 5360396 | 2018-05-28 11:13:09 +0200 | [diff] [blame] | 1630 | * Supplementary Services |
| 1631 | ***********************************************************************/ |
| 1632 | |
| 1633 | private template (value) Facility_TLV ts_FacTLV(OCTN facility) := { |
| 1634 | elementIdentifier := '1C'O, |
| 1635 | lengthIndicator := lengthof(facility), |
| 1636 | facilityInformation := facility |
| 1637 | } |
| 1638 | private template Facility_TLV tr_FacTLV(template OCTN facility) := { |
| 1639 | elementIdentifier := '1C'O, |
| 1640 | lengthIndicator := ?, |
| 1641 | facilityInformation := facility |
| 1642 | } |
| 1643 | |
| 1644 | private template (value) Facility_LV ts_FacLV(OCTN facility) := { |
| 1645 | lengthIndicator := lengthof(facility), |
| 1646 | facilityInformation := facility |
| 1647 | } |
| 1648 | private template Facility_LV tr_FacLV(template OCTN facility) := { |
| 1649 | lengthIndicator := ?, |
| 1650 | facilityInformation := facility |
| 1651 | } |
| 1652 | |
Vadim Yanitskiy | 0319813 | 2018-05-29 03:35:16 +0700 | [diff] [blame] | 1653 | private function f_facility_or_omit(template (omit) OCTN facility) |
| 1654 | return template (omit) Facility_TLV { |
| 1655 | if (istemplatekind(facility, "omit")) { |
| 1656 | return omit; |
| 1657 | } else { |
| 1658 | return ts_FacTLV(valueof(facility)); |
| 1659 | } |
| 1660 | } |
| 1661 | private function f_facility_or_wc(template OCTN facility) |
| 1662 | return template Facility_TLV { |
| 1663 | if (istemplatekind(facility, "*")) { |
| 1664 | return *; |
| 1665 | } else if (istemplatekind(facility, "?")) { |
| 1666 | return ?; |
Vadim Yanitskiy | 52f8b6e | 2018-06-19 17:32:46 +0700 | [diff] [blame] | 1667 | } else if (istemplatekind(facility, "omit")) { |
| 1668 | return omit; |
Vadim Yanitskiy | 0319813 | 2018-05-29 03:35:16 +0700 | [diff] [blame] | 1669 | } else { |
| 1670 | return tr_FacTLV(facility); |
| 1671 | } |
| 1672 | } |
| 1673 | |
Harald Welte | 5360396 | 2018-05-28 11:13:09 +0200 | [diff] [blame] | 1674 | template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER( |
| 1675 | uint3_t tid, BIT1 ti_flag, |
| 1676 | OCTN facility, |
| 1677 | template (omit) SS_VersionIndicator ss_ver := omit |
| 1678 | ) := { |
| 1679 | discriminator := '1011'B, |
| 1680 | tiOrSkip := { |
| 1681 | transactionId := { |
| 1682 | tio := int2bit(tid, 3), |
| 1683 | tiFlag := ti_flag, |
| 1684 | tIExtension := omit |
| 1685 | } |
| 1686 | }, |
| 1687 | msgs := { |
| 1688 | ss := { |
| 1689 | register := { |
| 1690 | messageType := '111011'B, |
| 1691 | nsd := '00'B, |
| 1692 | facility := ts_FacTLV(facility), |
| 1693 | ss_version := ss_ver |
| 1694 | } |
| 1695 | } |
| 1696 | } |
| 1697 | } |
| 1698 | template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER( |
| 1699 | template uint3_t tid, template BIT1 ti_flag, |
| 1700 | template OCTN facility, |
| 1701 | template SS_VersionIndicator ss_ver := omit |
| 1702 | ) := { |
| 1703 | discriminator := '1011'B, |
| 1704 | tiOrSkip := { |
| 1705 | transactionId := { |
| 1706 | tio := f_tid_or_wc(tid), |
| 1707 | tiFlag := ti_flag, |
| 1708 | tIExtension := omit |
| 1709 | } |
| 1710 | }, |
| 1711 | msgs := { |
| 1712 | ss := { |
| 1713 | register := { |
| 1714 | messageType := '111011'B, |
| 1715 | nsd := '00'B, |
| 1716 | facility := tr_FacTLV(facility), |
| 1717 | ss_version := ss_ver |
| 1718 | } |
| 1719 | } |
| 1720 | } |
| 1721 | } |
| 1722 | |
| 1723 | template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER( |
| 1724 | uint3_t tid, BIT1 ti_flag, |
| 1725 | OCTN facility |
| 1726 | ) := { |
| 1727 | discriminator := '1011'B, |
| 1728 | tiOrSkip := { |
| 1729 | transactionId := { |
| 1730 | tio := int2bit(tid, 3), |
| 1731 | tiFlag := ti_flag, |
| 1732 | tIExtension := omit |
| 1733 | } |
| 1734 | }, |
| 1735 | msgs := { |
| 1736 | ss := { |
| 1737 | register := { |
| 1738 | messageType := '111011'B, |
| 1739 | nsd := '00'B, |
| 1740 | facility := ts_FacTLV(facility) |
| 1741 | } |
| 1742 | } |
| 1743 | } |
| 1744 | } |
| 1745 | template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER( |
| 1746 | template uint3_t tid, template BIT1 ti_flag, |
| 1747 | template OCTN facility |
| 1748 | ) := { |
| 1749 | discriminator := '1011'B, |
| 1750 | tiOrSkip := { |
| 1751 | transactionId := { |
| 1752 | tio := f_tid_or_wc(tid), |
| 1753 | tiFlag := ti_flag, |
| 1754 | tIExtension := omit |
| 1755 | } |
| 1756 | }, |
| 1757 | msgs := { |
| 1758 | ss := { |
| 1759 | register := { |
| 1760 | messageType := '111011'B, |
| 1761 | nsd := '00'B, |
| 1762 | facility := tr_FacTLV(facility) |
| 1763 | } |
| 1764 | } |
| 1765 | } |
| 1766 | } |
| 1767 | |
| 1768 | template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY( |
| 1769 | uint3_t tid, BIT1 ti_flag, |
| 1770 | OCTN facility |
| 1771 | ) := { |
| 1772 | discriminator := '1011'B, |
| 1773 | tiOrSkip := { |
| 1774 | transactionId := { |
| 1775 | tio := int2bit(tid, 3), |
| 1776 | tiFlag := ti_flag, |
| 1777 | tIExtension := omit |
| 1778 | } |
| 1779 | }, |
| 1780 | msgs := { |
| 1781 | ss := { |
| 1782 | facility := { |
| 1783 | messageType := '111010'B, |
| 1784 | nsd := '00'B, |
| 1785 | facility := ts_FacLV(facility) |
| 1786 | } |
| 1787 | } |
| 1788 | } |
| 1789 | } |
| 1790 | template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY( |
| 1791 | template uint3_t tid, template BIT1 ti_flag, |
| 1792 | template OCTN facility |
| 1793 | ) := { |
| 1794 | discriminator := '1011'B, |
| 1795 | tiOrSkip := { |
| 1796 | transactionId := { |
| 1797 | tio := f_tid_or_wc(tid), |
| 1798 | tiFlag := ti_flag, |
| 1799 | tIExtension := omit |
| 1800 | } |
| 1801 | }, |
| 1802 | msgs := { |
| 1803 | ss := { |
| 1804 | facility := { |
| 1805 | messageType := '111010'B, |
| 1806 | nsd := '00'B, |
| 1807 | facility := tr_FacLV(facility) |
| 1808 | } |
| 1809 | } |
| 1810 | } |
| 1811 | } |
| 1812 | |
| 1813 | template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY( |
| 1814 | uint3_t tid, BIT1 ti_flag, |
| 1815 | OCTN facility |
| 1816 | ) := { |
| 1817 | discriminator := '1011'B, |
| 1818 | tiOrSkip := { |
| 1819 | transactionId := { |
| 1820 | tio := int2bit(tid, 3), |
| 1821 | tiFlag := ti_flag, |
| 1822 | tIExtension := omit |
| 1823 | } |
| 1824 | }, |
| 1825 | msgs := { |
| 1826 | ss := { |
| 1827 | facility := { |
| 1828 | messageType := '111010'B, |
| 1829 | nsd := '00'B, |
| 1830 | facility := ts_FacLV(facility) |
| 1831 | } |
| 1832 | } |
| 1833 | } |
| 1834 | } |
| 1835 | template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY( |
| 1836 | template uint3_t tid, template BIT1 ti_flag, |
| 1837 | template OCTN facility |
| 1838 | ) := { |
| 1839 | discriminator := '1011'B, |
| 1840 | tiOrSkip := { |
| 1841 | transactionId := { |
| 1842 | tio := f_tid_or_wc(tid), |
| 1843 | tiFlag := ti_flag, |
| 1844 | tIExtension := omit |
| 1845 | } |
| 1846 | }, |
| 1847 | msgs := { |
| 1848 | ss := { |
| 1849 | facility := { |
| 1850 | messageType := '111010'B, |
| 1851 | nsd := '00'B, |
| 1852 | facility := tr_FacLV(facility) |
| 1853 | } |
| 1854 | } |
| 1855 | } |
| 1856 | } |
| 1857 | |
Vadim Yanitskiy | 0319813 | 2018-05-29 03:35:16 +0700 | [diff] [blame] | 1858 | template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE( |
| 1859 | uint3_t tid, BIT1 ti_flag, |
| 1860 | template (omit) ML3_Cause_TLV cause := omit, |
| 1861 | template (omit) OCTN facility := omit |
| 1862 | ) := { |
| 1863 | discriminator := '1011'B, |
| 1864 | tiOrSkip := { |
| 1865 | transactionId := { |
| 1866 | tio := int2bit(tid, 3), |
| 1867 | tiFlag := ti_flag, |
| 1868 | tIExtension := omit |
| 1869 | } |
| 1870 | }, |
| 1871 | msgs := { |
| 1872 | ss := { |
| 1873 | releaseComplete_MS_NW := { |
| 1874 | messageType := '101010'B, |
| 1875 | nsd := '00'B, |
| 1876 | cause := cause, |
| 1877 | facility := f_facility_or_omit(facility) |
| 1878 | } |
| 1879 | } |
| 1880 | } |
| 1881 | } |
| 1882 | template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE( |
| 1883 | template uint3_t tid, template BIT1 ti_flag, |
| 1884 | template ML3_Cause_TLV cause := *, |
| 1885 | template OCTN facility := * |
| 1886 | ) := { |
| 1887 | discriminator := '1011'B, |
| 1888 | tiOrSkip := { |
| 1889 | transactionId := { |
| 1890 | tio := f_tid_or_wc(tid), |
| 1891 | tiFlag := ti_flag, |
| 1892 | tIExtension := omit |
| 1893 | } |
| 1894 | }, |
| 1895 | msgs := { |
| 1896 | ss := { |
| 1897 | releaseComplete_MS_NW := { |
| 1898 | messageType := '101010'B, |
| 1899 | nsd := '00'B, |
| 1900 | cause := cause, |
| 1901 | facility := f_facility_or_wc(facility) |
| 1902 | } |
| 1903 | } |
| 1904 | } |
| 1905 | } |
| 1906 | |
| 1907 | template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE( |
| 1908 | uint3_t tid, BIT1 ti_flag, |
| 1909 | template (omit) ML3_Cause_TLV cause := omit, |
| 1910 | template (omit) OCTN facility := omit |
| 1911 | ) := { |
| 1912 | discriminator := '1011'B, |
| 1913 | tiOrSkip := { |
| 1914 | transactionId := { |
| 1915 | tio := int2bit(tid, 3), |
| 1916 | tiFlag := ti_flag, |
| 1917 | tIExtension := omit |
| 1918 | } |
| 1919 | }, |
| 1920 | msgs := { |
| 1921 | ss := { |
| 1922 | releaseComplete_NW_MS := { |
| 1923 | messageType := '101010'B, |
| 1924 | nsd := '00'B, |
| 1925 | cause := cause, |
| 1926 | facility := f_facility_or_omit(facility) |
| 1927 | } |
| 1928 | } |
| 1929 | } |
| 1930 | } |
| 1931 | template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE( |
| 1932 | template uint3_t tid, template BIT1 ti_flag, |
| 1933 | template ML3_Cause_TLV cause := *, |
| 1934 | template OCTN facility := * |
| 1935 | ) := { |
| 1936 | discriminator := '1011'B, |
| 1937 | tiOrSkip := { |
| 1938 | transactionId := { |
| 1939 | tio := f_tid_or_wc(tid), |
| 1940 | tiFlag := ti_flag, |
| 1941 | tIExtension := omit |
| 1942 | } |
| 1943 | }, |
| 1944 | msgs := { |
| 1945 | ss := { |
| 1946 | releaseComplete_NW_MS := { |
| 1947 | messageType := '101010'B, |
| 1948 | nsd := '00'B, |
| 1949 | cause := cause, |
| 1950 | facility := f_facility_or_wc(facility) |
| 1951 | } |
| 1952 | } |
| 1953 | } |
| 1954 | } |
| 1955 | |
Harald Welte | 5360396 | 2018-05-28 11:13:09 +0200 | [diff] [blame] | 1956 | /*********************************************************************** |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 1957 | * GPRS Mobility Management |
| 1958 | ***********************************************************************/ |
| 1959 | |
| 1960 | template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := { |
| 1961 | gea1bit := '1'B, |
| 1962 | smCapabilitiesviaDedicatedChannels := '1'B, |
| 1963 | smCapabilitiesviaGPRSChannels := '0'B, |
| 1964 | ucs2Support := '1'B, |
| 1965 | ssScreeningIndicator := '01'B, |
| 1966 | solSACapability := omit, |
| 1967 | revisionLevelIndicatior := omit, |
| 1968 | pFCFeatureMode := omit, |
| 1969 | extendedGEAbits := omit, |
| 1970 | lcsVAcapability := omit, |
| 1971 | pSInterRATHOtoUTRANIuModeCapability := omit, |
| 1972 | pSInterRATHOtoEUTRANS1ModeCapability := omit, |
| 1973 | eMMCombinedProceduresCapability := omit, |
| 1974 | iSRSupport := omit, |
| 1975 | sRVCCtoGERANUTRANCapability := omit, |
| 1976 | ePCCapability := omit, |
| 1977 | nFCapability := omit, |
| 1978 | gERANNertworkSharingCapability := omit, |
| 1979 | spare_octets := omit |
| 1980 | }; |
| 1981 | |
| 1982 | template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := { |
| 1983 | lengthIndicator := 0, /* overwritten */ |
| 1984 | msNetworkCapabilityV := ts_GMM_MsNetCapV |
| 1985 | }; |
| 1986 | |
| 1987 | type enumerated GprsAttachType { |
| 1988 | GPRS_ATT_T_GPRS, |
| 1989 | GPRS_ATT_T_GPRS_IMSI_COMBINED |
| 1990 | }; |
| 1991 | |
| 1992 | function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false) |
| 1993 | return AttachTypeV { |
| 1994 | var AttachTypeV att; |
| 1995 | if (combined) { |
| 1996 | att.attachType := '011'B; |
| 1997 | } else { |
| 1998 | att.attachType := '001'B; |
| 1999 | } |
| 2000 | att.for_l3 := bool2bit(combined); |
| 2001 | return att; |
| 2002 | } |
| 2003 | |
| 2004 | type enumerated GprsUpdateType { |
| 2005 | GPRS_UPD_T_RA ('000'B), |
| 2006 | GPRS_UPD_T_RA_LA_COMBINED ('001'B), |
| 2007 | GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B), |
| 2008 | GPRS_UPD_T_PERIODIC ('011'B) |
| 2009 | }; |
| 2010 | |
| 2011 | /* 10.5.5.18 Update Type */ |
| 2012 | template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false, |
| 2013 | boolean follow_on_pending := false) := { |
| 2014 | valueField := int2bit(enum2int(upd_t), 3), |
| 2015 | for_l3 := bool2bit(combined) |
| 2016 | } |
| 2017 | |
| 2018 | template (value) DRXParameterV ts_DrxParameterV := { |
| 2019 | splitPGCycleCode := '00'O, /* no DRX */ |
| 2020 | nonDRXTimer := '000'B, /* no non-DRX mode */ |
| 2021 | splitOnCCCH := '0'B, /* not supported */ |
| 2022 | cnSpecificDRXCycleLength := '0000'B /* SI value used */ |
| 2023 | }; |
| 2024 | |
| 2025 | template (value) AccessCapabilitiesStruct ts_AccesssCap := { |
| 2026 | lengthIndicator := 0, /* overwritten */ |
| 2027 | accessCapabilities := { |
| 2028 | rfPowerCapability := '001'B, /* FIXME */ |
| 2029 | presenceBitA5 := '0'B, |
| 2030 | a5bits := omit, |
| 2031 | esind := '1'B, |
| 2032 | psbit := '0'B, |
| 2033 | vgcs := '0'B, |
| 2034 | vbs := '0'B, |
| 2035 | presenceBitMultislot := '0'B, |
| 2036 | multislotcap := omit, |
| 2037 | accessCapAdditionsAfterRel97 := omit |
| 2038 | }, |
| 2039 | spare_bits := omit |
| 2040 | } |
| 2041 | |
| 2042 | template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := { |
| 2043 | mSRACapabilityValues := { |
| 2044 | mSRACapabilityValuesExclude1111 := { |
| 2045 | accessTechnType := '0001'B, /* E-GSM */ |
| 2046 | accessCapabilities := ts_AccesssCap |
| 2047 | } |
| 2048 | }, |
| 2049 | presenceBitMSRACap := '0'B |
| 2050 | }; |
| 2051 | |
| 2052 | template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := { |
| 2053 | lengthIndicator := 0, /* overwritten */ |
| 2054 | msRadioAccessCapabilityV := { |
| 2055 | ts_RaCapRec('0001'B) /* E-GSM */ |
| 2056 | } |
| 2057 | } |
| 2058 | |
| 2059 | template (value) PDU_L3_MS_SGSN |
| 2060 | ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra, |
| 2061 | boolean combined := false, boolean follow_on_pending := false, |
| 2062 | template (omit) MobileStationClassmark2_TLV cm2_tlv, |
| 2063 | template (omit) MobileStationClassmark3_TLV cm3_tlv |
| 2064 | ) := { |
| 2065 | discriminator := '0000'B, /* overwritten */ |
| 2066 | tiOrSkip := { |
| 2067 | skipIndicator := '0000'B |
| 2068 | }, |
| 2069 | msgs := { |
| 2070 | gprs_mm := { |
| 2071 | attachRequest := { |
| 2072 | messageType := '00000000'B, /* overwritten */ |
| 2073 | msNetworkCapability := ts_GMM_MsNetCapLV, |
| 2074 | attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)), |
| 2075 | gprsCKSN := { '111'B, '0'B }, |
| 2076 | drxParam := ts_DrxParameterV, |
| 2077 | mobileIdentity := mi_lv, |
| 2078 | oldRoutingAreaID := old_ra, |
| 2079 | msRACap := ts_MS_RaCapa, |
| 2080 | ptmsiSignature := omit, /* TODO */ |
| 2081 | reqGPRStimer := omit, |
| 2082 | tmsiStatus := omit, |
| 2083 | pC_LCSCapability := omit, |
| 2084 | mobileStationClassmark2 := cm2_tlv, |
| 2085 | mobileStationClassmark3 := cm3_tlv, |
| 2086 | supportedCodecs := omit, |
| 2087 | uENetworkCapability := omit, |
| 2088 | additionalMobileIdentity := omit, |
| 2089 | routingAreaIdentification2 := omit, |
| 2090 | voiceDomainandUEsUsageSetting := omit, |
| 2091 | deviceProperties := omit, |
| 2092 | p_TMSI_Type := omit, |
| 2093 | mS_NetworkFeatureSupport := omit, |
| 2094 | oldLocationAreaIdentification := omit, |
| 2095 | additionalUpdateType := omit, |
| 2096 | tMSIBasedNRIcontainer := omit, |
| 2097 | t3324 := omit, |
| 2098 | t3312_ExtendedValue := omit, |
| 2099 | extendedDRXParameters := omit |
| 2100 | } |
| 2101 | } |
| 2102 | } |
| 2103 | } |
| 2104 | |
Harald Welte | b0386df | 2018-02-16 18:14:28 +0100 | [diff] [blame] | 2105 | private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV { |
| 2106 | if (istemplatekind(tmsi, "*")) { |
| 2107 | return *; |
| 2108 | } else if (istemplatekind(tmsi, "?")) { |
| 2109 | return ?; |
| 2110 | } else { |
| 2111 | var template MobileIdentityTLV mi := { |
| 2112 | elementIdentifier := '0011000'B, |
| 2113 | spare1 := '0'B, |
| 2114 | mobileIdentityLV := { |
| 2115 | lengthIndicator := 4, |
| 2116 | mobileIdentityV := { |
| 2117 | typeOfIdentity := '100'B, |
| 2118 | oddEvenInd_identity := { |
| 2119 | tmsi_ptmsi := { |
| 2120 | oddevenIndicator := '1'B, |
| 2121 | fillerDigit := '1111'B, |
| 2122 | octets := tmsi |
| 2123 | } |
| 2124 | } |
| 2125 | } |
| 2126 | } |
| 2127 | }; |
| 2128 | return mi; |
| 2129 | } |
| 2130 | } |
| 2131 | |
| 2132 | template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?, |
| 2133 | template RoutingAreaIdentificationV ra := ?, |
| 2134 | template OCT4 ptmsi := *) := { |
| 2135 | discriminator := '1000'B, |
| 2136 | tiOrSkip := { |
| 2137 | skipIndicator := '0000'B |
| 2138 | }, |
| 2139 | msgs := { |
| 2140 | gprs_mm := { |
| 2141 | attachAccept := { |
| 2142 | messageType := '00000010'B, |
| 2143 | attachResult := { res, ? }, |
| 2144 | forceToStandby := ?, |
| 2145 | updateTimer := ?, |
| 2146 | radioPriority := ?, |
| 2147 | radioPriorityTOM8 := ?, |
| 2148 | routingAreaIdentification := ra, |
| 2149 | ptmsiSignature := *, |
| 2150 | readyTimer := *, |
| 2151 | allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi), |
| 2152 | msIdentity := *, |
| 2153 | gmmCause := *, |
| 2154 | t3302 := *, |
| 2155 | cellNotification := *, |
| 2156 | equivalentPLMNs := *, |
| 2157 | networkFeatureSupport := *, |
| 2158 | emergencyNumberList := *, |
| 2159 | requestedMSInformation := *, |
| 2160 | t3319 := *, |
| 2161 | t3323 := *, |
| 2162 | t3312_ExtendedValue := *, |
| 2163 | additionalNetworkFeatureSupport := *, |
| 2164 | t3324 := *, |
| 2165 | extendedDRXParameters := * |
| 2166 | } |
| 2167 | } |
| 2168 | } |
| 2169 | } |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2170 | |
Harald Welte | 5b7c812 | 2018-02-16 21:48:17 +0100 | [diff] [blame] | 2171 | template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := { |
| 2172 | discriminator := '1000'B, |
| 2173 | tiOrSkip := { |
| 2174 | skipIndicator := '0000'B |
| 2175 | }, |
| 2176 | msgs := { |
| 2177 | gprs_mm := { |
| 2178 | attachReject := { |
| 2179 | messageType := '00000100'B, |
| 2180 | gmmCause := { |
| 2181 | causeValue := cause |
| 2182 | }, |
| 2183 | t3302 := *, |
| 2184 | t3346 := * |
| 2185 | } |
| 2186 | } |
| 2187 | } |
| 2188 | } |
| 2189 | |
| 2190 | |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2191 | template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := { |
| 2192 | discriminator := '0000'B, /* overwritten */ |
| 2193 | tiOrSkip := { |
| 2194 | skipIndicator := '0000'B |
| 2195 | }, |
| 2196 | msgs := { |
| 2197 | gprs_mm := { |
| 2198 | attachComplete := { |
| 2199 | messageType := '00000000'B, /* overwritten */ |
| 2200 | interRATHandoverInformation := omit, |
| 2201 | eUTRANinterRATHandoverInformation := omit |
| 2202 | } |
| 2203 | } |
| 2204 | } |
| 2205 | } |
| 2206 | |
| 2207 | template (value) PDU_L3_MS_SGSN |
| 2208 | ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type, |
| 2209 | RoutingAreaIdentificationV old_ra, |
| 2210 | boolean follow_on_pending := false, |
| 2211 | template (omit) MobileStationClassmark2_TLV cm2_tlv, |
Alexander Couzens | bfcb320 | 2019-09-03 12:34:21 +0200 | [diff] [blame] | 2212 | template (omit) MobileStationClassmark3_TLV cm3_tlv, |
| 2213 | template (omit) OCT4 p_tmsi := omit |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2214 | ) := { |
| 2215 | discriminator := '0000'B, /* overwritten */ |
| 2216 | tiOrSkip := { |
| 2217 | skipIndicator := '0000'B |
| 2218 | }, |
| 2219 | msgs := { |
| 2220 | gprs_mm := { |
| 2221 | routingAreaUpdateRequest := { |
| 2222 | messageType := '00000000'B, /* overwritten */ |
| 2223 | updateType := ts_GMM_UpdateType(upd_type, follow_on_pending), |
| 2224 | gprsCKSN := { '111'B, '0'B }, |
| 2225 | oldRoutingAreaId := old_ra, |
| 2226 | msRACap := ts_MS_RaCapa, |
| 2227 | oldPTMSISignature := omit, /* TODO */ |
| 2228 | readyTimerValue := omit, |
| 2229 | drxParameter := omit, |
| 2230 | tmsiStatus := omit, |
Alexander Couzens | bfcb320 | 2019-09-03 12:34:21 +0200 | [diff] [blame] | 2231 | ptmsi := ts_MI_TMSI_TLV(p_tmsi), |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2232 | mSNetworkCapability := omit, |
| 2233 | pdpContextStatus := omit, /* TODO */ |
| 2234 | pC_LCSCapability := omit, |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 2235 | mBMS_ContextStatus := omit, |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2236 | uENetworkCapability := omit, |
| 2237 | additionalMobileIdentity := omit, |
| 2238 | oldRoutingAreaIdentification2 := omit, |
| 2239 | mobileStationClassmark2 := cm2_tlv, |
| 2240 | mobileStationClassmark3 := cm3_tlv, |
| 2241 | supportedCodecs := omit, |
| 2242 | voiceDomainUEUsageSetting := omit, |
| 2243 | p_TMSI_Type := omit, |
| 2244 | deviceProperties := omit, |
| 2245 | mS_NetworkFeatureSupport := omit, |
| 2246 | oldLocationAreaIdentification := omit, |
| 2247 | additionalUpdateType := omit, |
| 2248 | tMSIBasedNRIcontainer := omit, |
| 2249 | t3324 := omit, |
| 2250 | t3312_ExtendedValue := omit, |
| 2251 | extendedDRXParameters := omit |
| 2252 | } |
| 2253 | } |
| 2254 | } |
| 2255 | } |
| 2256 | |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 2257 | template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := { |
| 2258 | discriminator := '1000'B, |
| 2259 | tiOrSkip := { |
| 2260 | skipIndicator := '0000'B |
| 2261 | }, |
| 2262 | msgs := { |
| 2263 | gprs_mm := { |
| 2264 | routingAreaUpdateReject := { |
| 2265 | messageType := '00001011'B, |
| 2266 | gmmCause := { |
| 2267 | causeValue := cause |
| 2268 | }, |
| 2269 | forceToStandby := ?, |
| 2270 | spare := '0000'B, |
| 2271 | t3302 := *, |
| 2272 | t3346 := * |
| 2273 | } |
| 2274 | } |
| 2275 | } |
| 2276 | } |
| 2277 | |
Harald Welte | 91636de | 2018-02-17 10:16:14 +0100 | [diff] [blame] | 2278 | template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?, |
| 2279 | template RoutingAreaIdentificationV ra := ?, |
| 2280 | template OCT4 ptmsi := *) := { |
| 2281 | discriminator := '1000'B, |
| 2282 | tiOrSkip := { |
| 2283 | skipIndicator := '0000'B |
| 2284 | }, |
| 2285 | msgs := { |
| 2286 | gprs_mm := { |
| 2287 | routingAreaUpdateAccept := { |
| 2288 | messageType := '00001001'B, |
| 2289 | forceToStandby := ?, |
| 2290 | updateResult := { res, ? }, |
| 2291 | raUpdateTimer := ?, |
| 2292 | routingAreaId := ra, |
| 2293 | ptmsiSignature := *, |
| 2294 | allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi), |
| 2295 | msIdentity := *, |
| 2296 | receiveNPDUNumbers := *, |
| 2297 | readyTimer := *, |
| 2298 | gmmCause := *, |
| 2299 | t3302 := *, |
| 2300 | cellNotification := *, |
| 2301 | equivalentPLMNs := *, |
| 2302 | pdpContextStatus := *, |
| 2303 | networkFeatureSupport := *, |
| 2304 | emergencyNumberList := *, |
| 2305 | mBMS_ContextStatus := *, |
| 2306 | requestedMSInformation := *, |
| 2307 | t3319 := *, |
| 2308 | t3323 := *, |
| 2309 | t3312_ExtendedValue := *, |
| 2310 | additionalNetworkFeatureSupport := *, |
| 2311 | t3324 := *, |
| 2312 | extendedDRXParameters := * |
| 2313 | } |
| 2314 | } |
| 2315 | } |
| 2316 | } |
Harald Welte | 04683d0 | 2018-02-16 22:43:45 +0100 | [diff] [blame] | 2317 | |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2318 | template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := { |
| 2319 | discriminator := '0000'B, /* overwritten */ |
| 2320 | tiOrSkip := { |
| 2321 | skipIndicator := '0000'B |
| 2322 | }, |
| 2323 | msgs := { |
| 2324 | gprs_mm := { |
| 2325 | routingAreaUpdateComplete := { |
| 2326 | messageType := '00000000'B, /* overwritten */ |
| 2327 | receiveNPDUNumbers := omit, |
| 2328 | interRATHandoverInformation := omit, |
| 2329 | eUTRANinterRATHandoverInformation := omit |
| 2330 | } |
| 2331 | } |
| 2332 | } |
| 2333 | } |
| 2334 | |
| 2335 | template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := { |
| 2336 | discriminator := '0000'B, /* overwritten */ |
| 2337 | tiOrSkip := { |
| 2338 | skipIndicator := '0000'B |
| 2339 | }, |
| 2340 | msgs := { |
| 2341 | gprs_mm := { |
| 2342 | p_TMSIReallocationComplete := { |
| 2343 | messageType := '00000000'B /* overwritten */ |
| 2344 | } |
| 2345 | } |
| 2346 | } |
| 2347 | } |
| 2348 | |
| 2349 | template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := { |
| 2350 | discriminator := '0000'B, /* overwritten */ |
| 2351 | tiOrSkip := { |
| 2352 | skipIndicator := '0000'B |
| 2353 | }, |
| 2354 | msgs := { |
| 2355 | gprs_mm := { |
| 2356 | authenticationAndCipheringResponse := { |
| 2357 | messageType := '00000000'B, /* overwritten */ |
| 2358 | acReferenceNumber := ref, |
| 2359 | spare := '0000'B, |
| 2360 | authenticationParResp := { |
| 2361 | elementIdentifier := '22'O, |
| 2362 | valueField := res |
| 2363 | }, |
| 2364 | imeisv := omit, |
| 2365 | authenticationRespParExt := omit |
| 2366 | } |
| 2367 | } |
| 2368 | } |
| 2369 | } |
| 2370 | |
Harald Welte | b0386df | 2018-02-16 18:14:28 +0100 | [diff] [blame] | 2371 | template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := { |
| 2372 | discriminator := '1000'B, |
| 2373 | tiOrSkip := { |
| 2374 | skipIndicator := '0000'B |
| 2375 | }, |
| 2376 | msgs := { |
| 2377 | gprs_mm := { |
| 2378 | identityRequest := { |
| 2379 | messageType := '00010101'B, |
| 2380 | identityType := { id_type, '0'B }, |
| 2381 | forceToStandby := ? |
| 2382 | } |
| 2383 | } |
| 2384 | } |
| 2385 | } |
| 2386 | |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2387 | template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := { |
| 2388 | discriminator := '0000'B, /* overwritten */ |
| 2389 | tiOrSkip := { |
| 2390 | skipIndicator := '0000'B |
| 2391 | }, |
| 2392 | msgs := { |
| 2393 | gprs_mm := { |
| 2394 | identityResponse := { |
| 2395 | messageType := '00000000'B, /* overwritten */ |
| 2396 | mobileIdentity := mi_lv |
| 2397 | } |
| 2398 | } |
| 2399 | } |
| 2400 | } |
| 2401 | |
Harald Welte | b0386df | 2018-02-16 18:14:28 +0100 | [diff] [blame] | 2402 | template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := { |
| 2403 | discriminator := '1000'B, |
| 2404 | tiOrSkip := { |
| 2405 | skipIndicator := '0000'B |
| 2406 | }, |
| 2407 | msgs := { |
| 2408 | gprs_mm := { |
| 2409 | authenticationAndCipheringRequest := { |
| 2410 | messageType := '00010010'B, |
| 2411 | cipheringAlgorithm := { ciph_alg, '0'B }, |
| 2412 | imeisvRequest := ?, |
| 2413 | forceToStandby := ?, |
| 2414 | acReferenceNumber := ?, |
| 2415 | authenticationParameterRAND := { |
| 2416 | elementIdentifier := '21'O, |
| 2417 | randValue := rand |
| 2418 | }, |
| 2419 | cipheringKeySequenceNumber := *, |
| 2420 | authenticationParameterAUTN := * |
| 2421 | } |
| 2422 | } |
| 2423 | } |
| 2424 | } |
| 2425 | |
| 2426 | template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := { |
| 2427 | discriminator := '1000'B, |
| 2428 | tiOrSkip := { |
| 2429 | skipIndicator := '0000'B |
| 2430 | }, |
| 2431 | msgs := { |
| 2432 | gprs_mm := { |
| 2433 | authenticationAndCipheringResponse := { |
| 2434 | messageType := '00010011'B, |
| 2435 | acReferenceNumber := { valueField := ac_ref }, |
| 2436 | spare := '0000'B, |
| 2437 | authenticationParResp := { |
| 2438 | elementIdentifier := '22'O, |
| 2439 | valueField := sres |
| 2440 | }, |
| 2441 | imeisv := omit, |
| 2442 | authenticationRespParExt := omit |
| 2443 | } |
| 2444 | } |
| 2445 | } |
| 2446 | } |
| 2447 | |
Alexander Couzens | 15faf92 | 2018-09-04 15:16:26 +0200 | [diff] [blame] | 2448 | template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := { |
| 2449 | discriminator := '1000'B, |
| 2450 | tiOrSkip := { |
| 2451 | skipIndicator := '0000'B |
| 2452 | }, |
| 2453 | msgs := { |
| 2454 | gprs_mm := { |
| 2455 | authenticationAndCipheringFailure := { |
| 2456 | messageType := '00011100'B, |
| 2457 | gmmCause := { |
| 2458 | causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */ |
| 2459 | }, |
| 2460 | authenticationFailureParam := { |
| 2461 | elementIdentifier := '30'O, |
| 2462 | lengthIndicator := 14, |
| 2463 | valueField := auts |
| 2464 | } |
| 2465 | } |
| 2466 | } |
| 2467 | } |
| 2468 | } |
| 2469 | |
Harald Welte | b0386df | 2018-02-16 18:14:28 +0100 | [diff] [blame] | 2470 | |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2471 | const BIT3 c_GMM_DTT_MO_GPRS := '001'B; |
| 2472 | const BIT3 c_GMM_DTT_MO_IMSI := '010'B; |
| 2473 | const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B; |
| 2474 | |
Alexander Couzens | b6ab456 | 2018-05-17 02:59:22 +0200 | [diff] [blame] | 2475 | const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B; |
| 2476 | const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B; |
| 2477 | const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B; |
| 2478 | |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 2479 | template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := { |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2480 | detachType := dtt, |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 2481 | powerOffFlag := bool2bit(power_off) |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2482 | } |
| 2483 | |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 2484 | function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV { |
| 2485 | var template (omit) P_TMSISignatureTV ret; |
| 2486 | if (istemplatekind(val, "omit")) { |
| 2487 | return omit; |
| 2488 | } else { |
| 2489 | ret := { |
| 2490 | elementIdentifier := '19'O, |
| 2491 | valueField := valueof(val) |
| 2492 | } |
| 2493 | return ret; |
| 2494 | } |
| 2495 | } |
| 2496 | |
| 2497 | function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV { |
| 2498 | var template (omit) P_TMSISignature2TLV ret; |
| 2499 | if (istemplatekind(val, "omit")) { |
| 2500 | return omit; |
| 2501 | } else { |
| 2502 | ret := { |
| 2503 | elementIdentifier := '19'O, |
| 2504 | lengthIndicator := 3, |
| 2505 | valueField := valueof(val) |
| 2506 | } |
| 2507 | return ret; |
| 2508 | } |
| 2509 | } |
| 2510 | |
| 2511 | template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS, |
| 2512 | boolean power_off := false, |
| 2513 | template (omit) OCT4 p_tmsi := omit, |
| 2514 | template (omit) OCT3 p_tmsi_sig := omit) := { |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2515 | discriminator := '0000'B, /* overwritten */ |
| 2516 | tiOrSkip := { |
| 2517 | skipIndicator := '0000'B |
| 2518 | }, |
| 2519 | msgs := { |
| 2520 | gprs_mm := { |
| 2521 | detachRequest_MS_SGSN := { |
| 2522 | messageType := '00000000'B, /* overwritten */ |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 2523 | detachType := valueof(ts_GMM_DetType(dtt, power_off)), |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2524 | spare := '0000'B, |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 2525 | ptmsi := ts_MI_TMSI_TLV(p_tmsi), |
| 2526 | ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig) |
| 2527 | } |
| 2528 | } |
| 2529 | } |
| 2530 | } |
| 2531 | |
| 2532 | template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := { |
| 2533 | discriminator := '1000'B, |
| 2534 | tiOrSkip := { |
| 2535 | skipIndicator := '0000'B |
| 2536 | }, |
| 2537 | msgs := { |
| 2538 | gprs_mm := { |
| 2539 | detachAccept_SGSN_MS := { |
| 2540 | messageType := '00000110'B, |
| 2541 | forceToStandby := ?, |
| 2542 | spare := '0000'B |
Harald Welte | 38575a7 | 2018-02-15 20:41:37 +0100 | [diff] [blame] | 2543 | } |
| 2544 | } |
| 2545 | } |
| 2546 | } |
Harald Welte | 812f7a4 | 2018-01-27 00:49:18 +0100 | [diff] [blame] | 2547 | |
Alexander Couzens | d62fba5 | 2018-05-22 16:08:39 +0200 | [diff] [blame] | 2548 | template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT( |
| 2549 | template BIT3 dtt := *, |
| 2550 | template BIT3 forceToStandby := ?, |
Alexander Couzens | d8604ab | 2018-05-29 15:46:06 +0200 | [diff] [blame] | 2551 | template OCT1 cause := *) := { |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 2552 | discriminator := '1000'B, |
| 2553 | tiOrSkip := { |
| 2554 | skipIndicator := '0000'B |
| 2555 | }, |
| 2556 | msgs := { |
| 2557 | gprs_mm := { |
| 2558 | detachRequest_SGSN_MS := { |
| 2559 | messageType := '00000101'B, |
Alexander Couzens | d62fba5 | 2018-05-22 16:08:39 +0200 | [diff] [blame] | 2560 | detachType := { dtt, ? }, |
| 2561 | forceToStandby := { forceToStandby, '0'B }, |
| 2562 | gmmCause := { |
| 2563 | elementIdentifier := '25'O, |
| 2564 | causeValue := { cause } |
| 2565 | } |
| 2566 | } |
| 2567 | } |
| 2568 | } |
| 2569 | } |
| 2570 | |
| 2571 | template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := { |
| 2572 | discriminator := '0000'B, /* overwritten */ |
| 2573 | tiOrSkip := { |
| 2574 | skipIndicator := '0000'B |
| 2575 | }, |
| 2576 | msgs := { |
| 2577 | gprs_mm := { |
| 2578 | detachAccept_MS_SGSN := { |
| 2579 | messageType := '00000000'B |
Harald Welte | 835b15f | 2018-02-18 14:39:11 +0100 | [diff] [blame] | 2580 | } |
| 2581 | } |
| 2582 | } |
| 2583 | } |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 2584 | |
| 2585 | function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV { |
| 2586 | if (istemplatekind(apn, "omit")) { |
| 2587 | return omit; |
| 2588 | } else { |
| 2589 | var template (omit) AccessPointNameTLV ret := { |
| 2590 | elementIdentifier := '28'O, |
| 2591 | lengthIndicator := 0, /* overwritten */ |
| 2592 | accessPointNameValue := apn |
| 2593 | } |
| 2594 | return ret; |
| 2595 | } |
| 2596 | } |
| 2597 | |
| 2598 | function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco) |
| 2599 | return template (omit) ProtocolConfigOptionsTLV { |
| 2600 | if (istemplatekind(pco, "omit")) { |
| 2601 | return omit; |
| 2602 | } else { |
| 2603 | var template (omit) ProtocolConfigOptionsTLV ret := { |
| 2604 | elementIdentifier := '27'O, |
| 2605 | lengthIndicator := 0, /* overwritten */ |
| 2606 | protocolConfigOptionsV := pco |
| 2607 | } |
| 2608 | return ret; |
| 2609 | } |
| 2610 | } |
| 2611 | |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2612 | function ts_TearDownIndicatorTV(in template (omit) boolean ind) |
| 2613 | return template (omit) TearDownIndicatorTV { |
| 2614 | if (istemplatekind(ind, "omit")) { |
| 2615 | return omit; |
| 2616 | } else { |
| 2617 | var template (omit) TearDownIndicatorTV ret := { |
| 2618 | tearDownIndicatorV := { |
| 2619 | tdi_flag := bool2bit(valueof(ind)), |
| 2620 | spare := '000'B |
| 2621 | }, |
| 2622 | elementIdentifier := '1001'B |
| 2623 | } |
| 2624 | return ret; |
| 2625 | } |
| 2626 | } |
| 2627 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 2628 | template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos, |
| 2629 | PDPAddressV addr, |
| 2630 | template (omit) octetstring apn := omit, |
| 2631 | template (omit) ProtocolConfigOptionsV pco := omit |
| 2632 | ) := { |
| 2633 | discriminator := '0000'B, /* overwritten */ |
| 2634 | tiOrSkip := { |
| 2635 | transactionId := { |
| 2636 | tio := tid, |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 2637 | tiFlag := c_TIF_ORIG, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 2638 | tIExtension := omit |
| 2639 | } |
| 2640 | }, |
| 2641 | msgs := { |
| 2642 | gprs_sm := { |
| 2643 | activatePDPContextRequest := { |
| 2644 | messageType := '00000000'B, /* overwritten */ |
| 2645 | requestedNSAPI := { nsapi, '0000'B }, |
| 2646 | requestedLLCSAPI := { sapi, '0000'B }, |
| 2647 | requestedQoS := { |
| 2648 | lengthIndicator := 0, /* overwritten */ |
| 2649 | qoSV := qos |
| 2650 | }, |
| 2651 | requestedPDPaddress := { |
| 2652 | lengthIndicator := 0, /* overwritten */ |
| 2653 | pdpAddressV := addr |
| 2654 | }, |
| 2655 | accessPointName := ts_ApnTLV(apn), |
| 2656 | protocolConfigOpts := ts_PcoTLV(pco), |
| 2657 | requestType := omit, |
| 2658 | deviceProperties := omit, |
| 2659 | nBIFOM_Container := omit |
| 2660 | } |
| 2661 | } |
| 2662 | } |
| 2663 | } |
| 2664 | |
| 2665 | template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := { |
| 2666 | discriminator := '1010'B, |
| 2667 | tiOrSkip := { |
| 2668 | transactionId := { |
| 2669 | tio := tid, |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 2670 | tiFlag := c_TIF_REPL, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 2671 | tIExtension := omit |
| 2672 | } |
| 2673 | }, |
| 2674 | msgs := { |
| 2675 | gprs_sm := { |
| 2676 | activatePDPContextReject := { |
Harald Welte | 4aacdd8 | 2018-02-18 21:24:05 +0100 | [diff] [blame] | 2677 | messageType := '01000011'B, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 2678 | smCause := cause, |
| 2679 | protocolConfigOpts := *, |
| 2680 | backOffTimer := *, |
| 2681 | reAttemptIndicator := *, |
| 2682 | nBIFOM_Container := * |
| 2683 | } |
| 2684 | } |
| 2685 | } |
| 2686 | } |
| 2687 | |
| 2688 | template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?, |
| 2689 | template QoSV qos := ?) |
| 2690 | := { |
| 2691 | discriminator := '1010'B, |
| 2692 | tiOrSkip := { |
| 2693 | transactionId := { |
| 2694 | tio := tid, |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 2695 | tiFlag := c_TIF_REPL, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 2696 | tIExtension := omit |
| 2697 | } |
| 2698 | }, |
| 2699 | msgs := { |
| 2700 | gprs_sm := { |
| 2701 | activatePDPContextAccept := { |
| 2702 | messageType := '01000010'B, |
| 2703 | negotiatedLLCSAPI := { sapi, '0000'B }, |
| 2704 | negotiatedQoS := { |
| 2705 | lengthIndicator := ?, |
| 2706 | qoSV := qos |
| 2707 | }, |
| 2708 | radioPriority := ?, |
| 2709 | spare := '0000'B, |
| 2710 | pdpAddress := *, |
| 2711 | protocolConfigOpts := *, |
| 2712 | packetFlowID := *, |
| 2713 | sMCause2 := *, |
| 2714 | connectivityType := *, |
| 2715 | wLANOffloadIndication := *, |
| 2716 | nBIFOM_Container := * |
| 2717 | } |
| 2718 | } |
| 2719 | } |
| 2720 | } |
| 2721 | |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2722 | template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause, |
| 2723 | template (omit) boolean tdown := omit, |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 2724 | template (omit) ProtocolConfigOptionsV pco := omit |
| 2725 | ) := { |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2726 | discriminator := '1010'B, |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 2727 | tiOrSkip := { |
| 2728 | transactionId := { |
| 2729 | tio := tid, |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 2730 | tiFlag := c_TIF_ORIG, |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 2731 | tIExtension := omit |
| 2732 | } |
| 2733 | }, |
| 2734 | msgs := { |
| 2735 | gprs_sm := { |
| 2736 | deactivatePDPContextRequest := { |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2737 | messageType := '01000110'B, |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 2738 | smCause := cause, |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2739 | tearDownIndicator := ts_TearDownIndicatorTV(tdown), |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 2740 | protocolConfigOpts := ts_PcoTLV(pco), |
| 2741 | mBMSprotocolConfigOptions := omit, |
| 2742 | t3396 := omit, |
| 2743 | wLANOffloadIndication := omit, |
| 2744 | nBIFOM_Container := omit |
| 2745 | } |
| 2746 | } |
| 2747 | } |
| 2748 | } |
| 2749 | |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2750 | template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause, |
| 2751 | template (omit) boolean tdown := omit, |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2752 | template (omit) ProtocolConfigOptionsV pco := omit |
| 2753 | ) := { |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2754 | discriminator := '1010'B, |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2755 | tiOrSkip := { |
| 2756 | transactionId := { |
| 2757 | tio := tid, |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 2758 | tiFlag := c_TIF_REPL, |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2759 | tIExtension := omit |
| 2760 | } |
| 2761 | }, |
| 2762 | msgs := { |
| 2763 | gprs_sm := { |
| 2764 | deactivatePDPContextRequest := { |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2765 | messageType := '01000110'B, |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2766 | smCause := cause, |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2767 | tearDownIndicator := ts_TearDownIndicatorTV(tdown), |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2768 | protocolConfigOpts := ts_PcoTLV(pco), |
| 2769 | mBMSprotocolConfigOptions := omit, |
| 2770 | t3396 := omit, |
| 2771 | wLANOffloadIndication := omit, |
| 2772 | nBIFOM_Container := omit |
| 2773 | } |
| 2774 | } |
| 2775 | } |
| 2776 | } |
| 2777 | |
| 2778 | template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause, |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2779 | template (omit) boolean tdown := omit, |
| 2780 | template (omit) ProtocolConfigOptionsV pco := omit |
| 2781 | ) := { |
| 2782 | discriminator := '1010'B, |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2783 | tiOrSkip := { |
| 2784 | transactionId := { |
| 2785 | tio := tid, |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 2786 | tiFlag := c_TIF_REPL, |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2787 | tIExtension := omit |
| 2788 | } |
| 2789 | }, |
| 2790 | msgs := { |
| 2791 | gprs_sm := { |
| 2792 | deactivatePDPContextRequest := { |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2793 | messageType := '01000110'B, |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2794 | smCause := cause, |
Pau Espin Pedrol | 67e47dd | 2018-07-13 15:07:43 +0200 | [diff] [blame] | 2795 | tearDownIndicator := ts_TearDownIndicatorTV(tdown), |
| 2796 | protocolConfigOpts := ts_PcoTLV(pco), |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2797 | mBMSprotocolConfigOptions := *, |
| 2798 | t3396 := *, |
| 2799 | wLANOffloadIndication := *, |
| 2800 | nBIFOM_Container := * |
| 2801 | } |
| 2802 | } |
| 2803 | } |
| 2804 | } |
| 2805 | |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 2806 | template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?) |
| 2807 | := { |
| 2808 | discriminator := '1010'B, |
| 2809 | tiOrSkip := { |
| 2810 | transactionId := { |
| 2811 | tio := tid, |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 2812 | tiFlag := c_TIF_REPL, |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 2813 | tIExtension := omit |
| 2814 | } |
| 2815 | }, |
| 2816 | msgs := { |
| 2817 | gprs_sm := { |
| 2818 | deactivatePDPContextAccept := { |
| 2819 | messageType := '01000111'B, |
| 2820 | protocolConfigOpts := *, |
| 2821 | mBMSprotocolConfigOptions := *, |
| 2822 | nBIFOM_Container := * |
| 2823 | } |
| 2824 | } |
| 2825 | } |
| 2826 | } |
| 2827 | |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2828 | template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?) |
| 2829 | := { |
| 2830 | discriminator := '1010'B, |
| 2831 | tiOrSkip := { |
| 2832 | transactionId := { |
| 2833 | tio := tid, |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 2834 | tiFlag := c_TIF_ORIG, |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2835 | tIExtension := omit |
| 2836 | } |
| 2837 | }, |
| 2838 | msgs := { |
| 2839 | gprs_sm := { |
| 2840 | deactivatePDPContextAccept := { |
| 2841 | messageType := '01000111'B, |
| 2842 | protocolConfigOpts := *, |
| 2843 | mBMSprotocolConfigOptions := *, |
| 2844 | nBIFOM_Container := * |
| 2845 | } |
| 2846 | } |
| 2847 | } |
| 2848 | } |
| 2849 | |
| 2850 | template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid) |
| 2851 | := { |
| 2852 | discriminator := '1010'B, |
| 2853 | tiOrSkip := { |
| 2854 | transactionId := { |
| 2855 | tio := tid, |
Harald Welte | 51affb6 | 2018-04-09 14:17:45 +0200 | [diff] [blame] | 2856 | tiFlag := c_TIF_ORIG, |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 2857 | tIExtension := omit |
| 2858 | } |
| 2859 | }, |
| 2860 | msgs := { |
| 2861 | gprs_sm := { |
| 2862 | deactivatePDPContextAccept := { |
| 2863 | messageType := '01000111'B, |
| 2864 | protocolConfigOpts := omit, |
| 2865 | mBMSprotocolConfigOptions := omit, |
| 2866 | nBIFOM_Container := omit |
| 2867 | } |
| 2868 | } |
| 2869 | } |
| 2870 | } |
| 2871 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 2872 | |
| 2873 | |
Harald Welte | e5695f5 | 2018-02-16 14:46:15 +0100 | [diff] [blame] | 2874 | private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring { |
| 2875 | var integer suffix_len := tot_len - lengthof(prefix); |
| 2876 | var charstring suffix_ch := int2str(suffix); |
| 2877 | var integer pad_len := suffix_len - lengthof(suffix_ch); |
| 2878 | |
| 2879 | return prefix & int2hex(0, pad_len) & str2hex(suffix_ch); |
| 2880 | } |
| 2881 | |
| 2882 | function f_gen_imei(integer suffix) return hexstring { |
Oliver Smith | 745ed95 | 2019-07-05 14:08:17 +0200 | [diff] [blame] | 2883 | return f_concat_pad(14, '49999'H, suffix); |
Harald Welte | e5695f5 | 2018-02-16 14:46:15 +0100 | [diff] [blame] | 2884 | } |
| 2885 | |
| 2886 | function f_gen_imsi(integer suffix) return hexstring { |
| 2887 | return f_concat_pad(15, '26242'H, suffix); |
| 2888 | } |
| 2889 | |
| 2890 | function f_gen_msisdn(integer suffix) return hexstring { |
| 2891 | return f_concat_pad(12, '49123'H, suffix); |
| 2892 | } |
| 2893 | |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 2894 | external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring |
| 2895 | with { extension "prototype(convert) encode(RAW)" }; |
Harald Welte | e5695f5 | 2018-02-16 14:46:15 +0100 | [diff] [blame] | 2896 | |
Vadim Yanitskiy | 322c793 | 2020-01-01 23:03:47 +0100 | [diff] [blame] | 2897 | external function dec_MobileIdentityV(in octetstring mi) return MobileIdentityV |
| 2898 | with { extension "prototype(convert) decode(RAW)" }; |
| 2899 | |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 2900 | |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 2901 | |
| 2902 | /* SMS TPDU Layer */ |
| 2903 | |
| 2904 | template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr, |
| 2905 | template (value) OCT1 pid, template (value) OCT1 dcs, |
| 2906 | integer length_ind, octetstring user_data) := { |
| 2907 | sMS_SUBMIT := { |
| 2908 | tP_MTI := '01'B, /* SUBMIT */ |
| 2909 | tP_RD := '1'B, /* reject duplicates */ |
| 2910 | tP_VPF := '00'B, /* not present */ |
| 2911 | tP_SRR := '0'B, /* no status report requested */ |
| 2912 | tP_UDHI := '0'B, /* no user data header in UD */ |
| 2913 | tP_RP := '0'B, /* no reply path */ |
| 2914 | tP_MR := msg_ref, |
| 2915 | tP_DA := dst_addr, |
| 2916 | tP_PID := pid, |
| 2917 | tP_DCS := dcs, |
| 2918 | tP_VP := omit, |
| 2919 | tP_UDL_UD := { |
| 2920 | tP_LengthIndicator := length_ind, |
| 2921 | tP_UD := user_data |
| 2922 | } |
| 2923 | } |
| 2924 | } |
| 2925 | |
| 2926 | template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?, |
| 2927 | template octetstring user_data := ?, |
| 2928 | template OCT1 pid := ?, template OCT1 dcs := ?, |
| 2929 | template BIT1 mms := ? |
| 2930 | ) := { |
| 2931 | sMS_DELIVER := { |
| 2932 | tP_MTI := '00'B, /* DELIVER */ |
| 2933 | tP_MMS := mms, /* more messages to send */ |
| 2934 | tP_LP := ?, /* ?!? */ |
| 2935 | tP_Spare := '0'B, |
| 2936 | tP_SRI := '0'B, /* status report indication */ |
| 2937 | tP_UDHI := '0'B, /* no user data header in UD */ |
| 2938 | tP_RP := '0'B, /* no reply path */ |
| 2939 | tP_OA := src_addr, |
| 2940 | tP_PID := pid, |
| 2941 | tP_DCS := dcs, |
| 2942 | tP_SCTS := ?, |
| 2943 | tP_UDL_UD := { |
| 2944 | tP_LengthIndicator := ?, |
| 2945 | tP_UD := user_data |
| 2946 | } |
| 2947 | } |
| 2948 | } |
| 2949 | |
| 2950 | /* RP Layer */ |
| 2951 | |
| 2952 | private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig) |
| 2953 | return RP_OriginatorAddressLV { |
| 2954 | var RP_OriginatorAddressLV ret; |
| 2955 | if (istemplatekind(rp_orig, "omit")) { |
| 2956 | ret := { 0, omit }; |
| 2957 | } else { |
| 2958 | ret := { 0, valueof(rp_orig) }; |
| 2959 | } |
| 2960 | return ret; |
| 2961 | } |
| 2962 | |
| 2963 | private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst) |
| 2964 | return RP_DestinationAddressLV { |
| 2965 | var RP_DestinationAddressLV ret; |
| 2966 | if (istemplatekind(rp_dst, "omit")) { |
| 2967 | ret := { 0, omit }; |
| 2968 | } else { |
| 2969 | ret := { 0, valueof(rp_dst) }; |
| 2970 | } |
| 2971 | return ret; |
| 2972 | } |
| 2973 | |
| 2974 | template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref, |
| 2975 | template (omit) RP_NumberingPlan_and_NumberDigits rp_orig, |
| 2976 | template (omit) RP_NumberingPlan_and_NumberDigits rp_dst, |
| 2977 | template (value) TPDU_RP_DATA_MS_SGSN tpdu) := { |
| 2978 | rP_DATA_MS_SGSN := { |
| 2979 | rP_MTI := '000'B, |
| 2980 | rP_Spare := '00000'B, |
| 2981 | rP_MessageReference := msg_ref, |
| 2982 | rP_OriginatorAddress := ts_RpOrig(rp_orig), |
| 2983 | rP_DestinationAddress := ts_RpDst(rp_dst), |
| 2984 | rP_User_Data := { |
| 2985 | rP_LengthIndicator := 0, /* overwritten */ |
| 2986 | rP_TPDU := tpdu |
| 2987 | } |
| 2988 | } |
| 2989 | } |
| 2990 | |
| 2991 | template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref, |
| 2992 | template RP_NumberingPlan_and_NumberDigits rp_orig, |
| 2993 | template RP_NumberingPlan_and_NumberDigits rp_dst, |
| 2994 | template TPDU_RP_DATA_SGSN_MS tpdu) := { |
| 2995 | rP_DATA_SGSN_MS := { |
| 2996 | rP_MTI := '001'B, |
| 2997 | rP_Spare := '00000'B, |
| 2998 | rP_MessageReference := msg_ref, |
| 2999 | rP_OriginatorAddress := { ?, rp_orig }, |
| 3000 | rP_DestinationAddress := { ?, rp_dst }, |
| 3001 | rP_User_Data := { |
| 3002 | rP_LengthIndicator := ?, |
| 3003 | rP_TPDU := tpdu |
| 3004 | } |
| 3005 | |
| 3006 | } |
| 3007 | } |
| 3008 | |
| 3009 | template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := { |
| 3010 | rP_ACK_MS_SGSN := { |
| 3011 | rP_MTI := '010'B, |
| 3012 | rP_Spare := '00000'B, |
| 3013 | rP_MessageReference := msg_ref, |
| 3014 | rP_User_Data := omit /* FIXME: report */ |
| 3015 | } |
| 3016 | } |
| 3017 | |
| 3018 | template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := { |
| 3019 | rP_ACK_SGSN_MS := { |
| 3020 | rP_MTI := '011'B, |
| 3021 | rP_Spare := '00000'B, |
| 3022 | rP_MessageReference := msg_ref, |
| 3023 | rP_User_Data := omit /* FIXME: report */ |
| 3024 | } |
| 3025 | } |
| 3026 | |
| 3027 | template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := { |
| 3028 | rP_ERROR_MS_SGSN := { |
| 3029 | rP_MTI := '100'B, |
| 3030 | rP_Spare := '00000'B, |
| 3031 | rP_Message_Reference := msg_ref, |
| 3032 | rP_CauseLV := { |
| 3033 | rP_LengthIndicator := 0, /* overwritten */ |
| 3034 | rP_CauseV := { |
| 3035 | causeValue := int2bit(cause, 7), |
| 3036 | ext := '0'B |
| 3037 | }, |
| 3038 | rP_diagnisticField := omit |
| 3039 | }, |
| 3040 | rP_User_Data := omit /* FIXME: report */ |
| 3041 | } |
| 3042 | } |
| 3043 | |
| 3044 | private function f_cause_or_wc(template uint7_t cause) return template BIT7 { |
| 3045 | if (istemplatekind(cause, "?")) { |
| 3046 | return ?; |
| 3047 | } else if (istemplatekind(cause, "*")) { |
| 3048 | return *; |
| 3049 | } else { |
| 3050 | return int2bit(valueof(cause), 7); |
| 3051 | } |
| 3052 | } |
| 3053 | |
| 3054 | template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := { |
| 3055 | rP_ERROR_SGSN_MS := { |
| 3056 | rP_MTI := '101'B, |
| 3057 | rP_Spare := '00000'B, |
| 3058 | rP_Message_Reference := msg_ref, |
| 3059 | rP_CauseLV := { |
Vadim Yanitskiy | e9e9301 | 2020-01-15 12:35:17 +0700 | [diff] [blame] | 3060 | rP_LengthIndicator := ?, |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 3061 | rP_CauseV := { |
| 3062 | causeValue := f_cause_or_wc(cause), |
| 3063 | ext := '0'B |
| 3064 | }, |
| 3065 | rP_diagnisticField := omit |
| 3066 | }, |
| 3067 | rP_User_Data := omit /* FIXME: report */ |
| 3068 | } |
| 3069 | } |
| 3070 | |
| 3071 | |
| 3072 | template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := { |
| 3073 | rP_SMMA := { |
| 3074 | rP_MTI := '110'B, |
| 3075 | rP_Spare := '00000'B, |
| 3076 | rP_MessageReference := msg_ref |
| 3077 | } |
| 3078 | } |
| 3079 | |
| 3080 | |
| 3081 | |
| 3082 | |
| 3083 | /* CP Layer */ |
| 3084 | |
| 3085 | template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := { |
| 3086 | cP_DATA := { |
| 3087 | cP_messageType := '00000001'B, |
| 3088 | cP_User_Data := { |
| 3089 | lengthIndicator := 0, /* overwritten */ |
| 3090 | cP_RPDU := rpdu |
| 3091 | } |
| 3092 | } |
| 3093 | } |
| 3094 | |
| 3095 | template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := { |
| 3096 | cP_ACK := { |
| 3097 | cP_messageType := '00000100'B |
| 3098 | } |
| 3099 | } |
| 3100 | |
| 3101 | template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := { |
| 3102 | cP_ERROR := { |
| 3103 | cP_messageType := '00010000'B, |
| 3104 | cP_Cause := { |
| 3105 | causeValue := cause |
| 3106 | } |
| 3107 | } |
| 3108 | } |
| 3109 | |
| 3110 | template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := { |
| 3111 | cP_DATA := { |
| 3112 | cP_messageType := '00000001'B, |
| 3113 | cP_User_Data := { |
| 3114 | lengthIndicator := ?, |
| 3115 | cP_RPDU := rpdu |
| 3116 | } |
| 3117 | } |
| 3118 | } |
| 3119 | |
| 3120 | template L3_SMS_SGSN_MS tr_CP_ACK_MT := { |
| 3121 | cP_ACK := { |
| 3122 | cP_messageType := '00000100'B |
| 3123 | } |
| 3124 | } |
| 3125 | |
| 3126 | template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := { |
| 3127 | cP_ERROR := { |
| 3128 | cP_messageType := '00010000'B, |
| 3129 | cP_Cause := { |
| 3130 | causeValue := cause |
| 3131 | } |
| 3132 | } |
| 3133 | } |
| 3134 | |
| 3135 | /* L3 Wrapper */ |
| 3136 | |
| 3137 | template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag, |
| 3138 | template (value) L3_SMS_MS_SGSN sms_mo) := { |
| 3139 | discriminator := '1001'B, |
| 3140 | tiOrSkip := { |
| 3141 | transactionId := { |
| 3142 | tio := int2bit(tid, 3), |
| 3143 | tiFlag := ti_flag, |
| 3144 | tIExtension := omit |
| 3145 | } |
| 3146 | }, |
| 3147 | msgs := { |
| 3148 | sms := sms_mo |
| 3149 | } |
| 3150 | } |
| 3151 | |
| 3152 | private function f_tid_or_wc(template uint3_t tid) return template BIT3 { |
| 3153 | var template BIT3 ret; |
| 3154 | if (istemplatekind(tid, "*")) { |
| 3155 | return *; |
| 3156 | } else if (istemplatekind(tid, "?")) { |
| 3157 | return ?; |
| 3158 | } else { |
| 3159 | return int2bit(valueof(tid), 3); |
| 3160 | } |
| 3161 | } |
| 3162 | |
| 3163 | template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag, |
| 3164 | template L3_SMS_SGSN_MS sms_mt) := { |
| 3165 | discriminator := '1001'B, |
| 3166 | tiOrSkip := { |
| 3167 | transactionId := { |
| 3168 | tio := f_tid_or_wc(tid), |
| 3169 | tiFlag := ti_flag, |
| 3170 | tIExtension := omit |
| 3171 | } |
| 3172 | }, |
| 3173 | msgs := { |
| 3174 | sms := sms_mt |
| 3175 | } |
| 3176 | } |
| 3177 | |
Philipp Maier | 9b690e4 | 2018-12-21 11:50:03 +0100 | [diff] [blame] | 3178 | template PDU_ML3_NW_MS tr_ML3_MT_MM_Info := { |
| 3179 | discriminator := '0101'B, |
| 3180 | tiOrSkip := { |
| 3181 | skipIndicator := '0000'B |
| 3182 | }, |
| 3183 | msgs := { |
| 3184 | mm := { |
| 3185 | mMInformation := { |
| 3186 | messageType := '110010'B, |
| 3187 | nsd := '00'B, |
| 3188 | fullNetworkName := *, |
| 3189 | shortNetworkName := *, |
| 3190 | localtimeZone := *, |
| 3191 | univTime := *, |
| 3192 | lSAIdentity := *, |
| 3193 | networkDST := * |
| 3194 | } |
| 3195 | } |
| 3196 | } |
| 3197 | } |
Harald Welte | f45efeb | 2018-04-09 18:19:24 +0200 | [diff] [blame] | 3198 | |
| 3199 | |
| 3200 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 3201 | } |