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 | * |
| 5 | * (C) 2017 by Harald Welte <laforge@gnumonks.org> |
| 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. |
| 10 | */ |
| 11 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 12 | import from General_Types all; |
| 13 | import from MobileL3_Types all; |
| 14 | import from MobileL3_CommonIE_Types all; |
| 15 | import from MobileL3_MM_Types all; |
| 16 | import from MobileL3_RRM_Types all; |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 17 | import from MobileL3_CC_Types all; |
| 18 | //import from MobileL3_GMM_SM_Types all; |
| 19 | //import from MobileL3_SMS_Types all; |
| 20 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 21 | |
| 22 | type enumerated CmServiceType { |
| 23 | CM_TYPE_MO_CALL ('0001'B), |
| 24 | CM_TYPE_EMERG_CALL ('0010'B), |
| 25 | CM_TYPE_MO_SMS ('0100'B), |
| 26 | CM_TYPE_SS_ACT ('1000'B) |
| 27 | } |
| 28 | |
| 29 | |
| 30 | /* send template fro Mobile Identity (TMSI) */ |
| 31 | template MobileIdentityLV ts_MI_TMSI_LV(OCT4 tmsi) := { |
| 32 | lengthIndicator := 0, /* overwritten */ |
| 33 | mobileIdentityV := { |
| 34 | typeOfIdentity := '000'B, /* overwritten */ |
| 35 | oddEvenInd_identity := { |
| 36 | tmsi_ptmsi := { |
| 37 | oddevenIndicator := '0'B, |
| 38 | fillerDigit := '1111'B, |
| 39 | octets := tmsi |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 { |
| 46 | var IMSI_L3 l3; |
| 47 | var integer len := lengthof(digits); |
| 48 | if (len rem 2 == 1) { /* modulo remainder */ |
Harald Welte | 365f4ed | 2017-11-23 00:00:43 +0100 | [diff] [blame] | 49 | l3.oddevenIndicator := '1'B; |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 50 | l3.fillerDigit := '1111'B; |
| 51 | } else { |
Harald Welte | 365f4ed | 2017-11-23 00:00:43 +0100 | [diff] [blame] | 52 | l3.oddevenIndicator := '0'B; |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 53 | l3.fillerDigit := omit; |
| 54 | } |
| 55 | l3.digits := digits; |
| 56 | return l3; |
| 57 | } |
| 58 | |
| 59 | /* send template fro Mobile Identity (IMSI) */ |
| 60 | template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := { |
| 61 | lengthIndicator := 0, /* overwritten */ |
| 62 | mobileIdentityV := { |
| 63 | typeOfIdentity := '000'B, /* overwritten */ |
| 64 | oddEvenInd_identity := { |
| 65 | imsi := f_enc_IMSI_L3(imsi_digits) |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /* Send template for Classmark 2 */ |
| 71 | template (value) MobileStationClassmark2_LV ts_CM2 := { |
| 72 | lengthIndicator := 0, |
| 73 | rf_PowerCapability := '000'B, |
| 74 | a5_1 := '0'B, |
| 75 | esind := '1'B, |
| 76 | revisionLevel := '10'B, |
| 77 | spare1_1 := '0'B, |
| 78 | mobileStationClassmark2_oct4 := omit, |
| 79 | mobileStationClassmark2_oct5 := omit |
| 80 | }; |
| 81 | |
| 82 | /* Send template for CM SERVICE REQUEST */ |
| 83 | template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(BIT4 serv_type, MobileIdentityLV mi_lv) := { |
| 84 | discriminator := '0000'B, /* overwritten */ |
| 85 | tiOrSkip := { |
| 86 | skipIndicator := '0000'B |
| 87 | }, |
| 88 | msgs := { |
| 89 | mm := { |
| 90 | cMServiceRequest := { |
| 91 | messageType := '000000'B, /* overwritten */ |
| 92 | nsd := '00'B, |
| 93 | cm_ServiceType := serv_type, |
| 94 | cipheringKeySequenceNumber := { '000'B, '0'B }, |
| 95 | mobileStationClassmark2 := ts_CM2, |
| 96 | mobileIdentity := mi_lv, |
| 97 | priorityLevel := omit, |
| 98 | additionalUpdateParameterTV := omit, |
| 99 | deviceProperties := omit |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 105 | template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := { |
| 106 | discriminator := discr, |
| 107 | tiOrSkip := { |
| 108 | skipIndicator := '0000'B |
| 109 | }, |
| 110 | msgs := ? |
| 111 | } |
| 112 | |
| 113 | |
| 114 | template PDU_ML3_NW_MS tr_CM_SERV_ACC := { |
| 115 | discriminator := '0101'B, |
| 116 | tiOrSkip := { |
| 117 | skipIndicator := '0000'B |
| 118 | }, |
| 119 | msgs := { |
| 120 | mm := { |
| 121 | cMServiceAccept := { |
| 122 | messageType := '100001'B, |
| 123 | nsd := ? |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 130 | template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := { |
| 131 | discriminator := '0101'B, |
| 132 | tiOrSkip := { |
| 133 | skipIndicator := '0000'B |
| 134 | }, |
| 135 | msgs := { |
| 136 | mm := { |
| 137 | cMServiceReject := { |
| 138 | messageType := '100010'B, |
| 139 | nsd := ?, |
| 140 | rejectCause := rej_cause, |
| 141 | t3246_Value := * |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 147 | /* Send template for PAGING RESPONSE */ |
| 148 | template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := { |
| 149 | discriminator := '0000'B, /* overwritten */ |
| 150 | tiOrSkip := { |
| 151 | skipIndicator := '0000'B |
| 152 | }, |
| 153 | msgs := { |
| 154 | rrm := { |
| 155 | pagingResponse := { |
| 156 | messageType := '00000000'B, /* overwritten */ |
| 157 | cipheringKeySequenceNumber := { '000'B, '0'B }, |
| 158 | spare1_4 := '0000'B, |
| 159 | mobileStationClassmark := ts_CM2, |
| 160 | mobileIdentity := mi_lv, |
| 161 | additionalUpdateParameters := omit |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
Harald Welte | 1516614 | 2017-12-16 23:02:08 +0100 | [diff] [blame] | 167 | template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := { |
| 168 | discriminator := '0000'B, /* overwritten */ |
| 169 | tiOrSkip := { |
| 170 | skipIndicator := '0000'B |
| 171 | }, |
| 172 | msgs := { |
| 173 | rrm := { |
| 174 | channelModeModifyAck := { |
| 175 | messageType := '00010111'B, |
| 176 | channelDescription := desc, |
| 177 | channelMode := mode, |
| 178 | extendedTSCSet := omit |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | } |
| 183 | |
Harald Welte | 73cd271 | 2017-12-17 00:44:52 +0100 | [diff] [blame] | 184 | template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := { |
| 185 | discriminator := '0000'B, /* overwritten */ |
| 186 | tiOrSkip := { |
| 187 | skipIndicator := '0000'B |
| 188 | }, |
| 189 | msgs := { |
| 190 | rrm := { |
| 191 | cipheringModeComplete := { |
| 192 | messageType := '00110010'B, |
| 193 | mobileEquipmentIdentity := omit |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
Harald Welte | 1516614 | 2017-12-16 23:02:08 +0100 | [diff] [blame] | 199 | |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 200 | template PDU_ML3_MS_NW ts_ML3_MO := { |
| 201 | discriminator := '0000'B, |
| 202 | tiOrSkip := { |
| 203 | skipIndicator := '0000'B |
| 204 | }, |
| 205 | msgs := ? |
| 206 | } |
| 207 | |
| 208 | template LocationUpdatingType ts_ML3_IE_LuType := { |
| 209 | lut := ?, |
| 210 | spare1_1 := '0'B, |
| 211 | fop := '0'B |
| 212 | } |
| 213 | |
| 214 | template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := { |
| 215 | lut := '00'B |
| 216 | } |
| 217 | |
| 218 | template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := { |
| 219 | lut := '01'B |
| 220 | } |
| 221 | |
| 222 | template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := { |
| 223 | lut := '10'B |
| 224 | } |
| 225 | |
| 226 | template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := { |
| 227 | keySequence := int2bit(cksn, 3), |
| 228 | spare := '0'B |
| 229 | } |
| 230 | |
| 231 | template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai, |
| 232 | MobileIdentityLV mi, MobileStationClassmark1_V cm1) |
| 233 | modifies ts_ML3_MO := { |
| 234 | msgs := { |
| 235 | mm := { |
| 236 | locationUpdateRequest := { |
| 237 | messageType := '001000'B, |
| 238 | nsd := '00'B, /* ? */ |
| 239 | locationUpdatingType := lu_type, |
| 240 | cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0), |
| 241 | locationAreaIdentification := lai, |
| 242 | mobileStationClassmark1 := cm1, |
| 243 | mobileIdentityLV := mi, |
| 244 | classmarkInformationType2_forUMTS := omit, |
| 245 | additionalUpdateParameterTV := omit, |
| 246 | deviceProperties := omit, |
| 247 | mS_NetworkFeatureSupport := omit |
| 248 | } |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 253 | template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := { |
| 254 | msgs := { |
| 255 | mm := { |
| 256 | tmsiReallocComplete := { |
| 257 | messageType := '011011'B, |
| 258 | nsd := '00'B |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := { |
| 265 | discriminator := '0101'B, |
| 266 | tiOrSkip := { |
| 267 | skipIndicator := '0000'B |
| 268 | }, |
| 269 | msgs := { |
| 270 | mm := { |
| 271 | locationUpdateAccept := { |
| 272 | messageType := '000010'B, |
| 273 | nsd := '00'B, |
| 274 | locationAreaIdentification := ?, |
| 275 | mobileIdentityTLV := *, |
| 276 | followOnProceed := *, |
| 277 | cTS_Permission := *, |
| 278 | equivalentPLMNs := *, |
| 279 | emergencyNumberList := *, |
| 280 | perMS_T3212 := * |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := { |
| 287 | discriminator := '0101'B, |
| 288 | tiOrSkip := { |
| 289 | skipIndicator := '0000'B |
| 290 | }, |
| 291 | msgs := { |
| 292 | mm := { |
| 293 | locationUpdateReject := { |
| 294 | messageType := '000100'B, |
| 295 | nsd := '00'B, |
| 296 | rejectCause := cause, |
| 297 | t3246_Value := * |
| 298 | } |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | |
Harald Welte | d748a05 | 2018-01-22 02:59:24 +0100 | [diff] [blame] | 303 | template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := { |
| 304 | discriminator := '0011'B, |
| 305 | tiOrSkip := { |
| 306 | transactionId := { |
| 307 | tio := '000'B, |
| 308 | tiFlag := '0'B, |
| 309 | tIExtension := omit |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := { |
| 315 | elementIdentifier := '5E'O, |
| 316 | lengthIndicator := 0, /* overwritten */ |
| 317 | numberingPlanIdentification := '0000'B, |
| 318 | typeOfNumber := '000'B, /* unknown */ |
| 319 | ext1 := '0'B, |
| 320 | digits := digits |
| 321 | } |
| 322 | |
| 323 | template (value) BearerCapability_TLV ts_Bcap_voice := { |
| 324 | elementIdentifier := '04'O, |
| 325 | lengthIndicator := 0, /* overwritten */ |
| 326 | octet3 := { |
| 327 | informationTransferCapability := '000'B, |
| 328 | transferMode := '0'B, |
| 329 | codingStandard := '0'B, |
| 330 | radioChannelRequirement := '11'B, /* FR preferred */ |
| 331 | extension_octet_3 := '0'B, /* overwritten */ |
| 332 | speech_aux_3a_3b := omit |
| 333 | }, |
| 334 | octet4 := omit, |
| 335 | octet5 := omit, |
| 336 | octet6 := omit, |
| 337 | octet7 := omit |
| 338 | } |
| 339 | |
| 340 | template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := { |
| 341 | discriminator := '0011'B, |
| 342 | tiOrSkip := { |
| 343 | transactionId := { |
| 344 | tio := int2bit(tid, 3), |
| 345 | tiFlag := '0'B, |
| 346 | tIExtension := omit |
| 347 | } |
| 348 | }, |
| 349 | msgs := { |
| 350 | cc := { |
| 351 | setup_MS_NW := { |
| 352 | messageType := '000101'B, |
| 353 | nsd := '00'B, |
| 354 | bcRepeatIndicator := omit, |
| 355 | bearerCapability1 := bcap, |
| 356 | bearerCapability2 := omit, |
| 357 | facility := omit, |
| 358 | callingPartySubAddress := omit, |
| 359 | calledPartyBCD_Number := ts_Called(called), |
| 360 | calledPartySubAddress := omit, |
| 361 | llc_RepeatIndicator := omit, |
| 362 | lowLayerCompatibility1 := omit, |
| 363 | lowLayerCompatibility2 := omit, |
| 364 | hlc_RepeatIndicator := omit, |
| 365 | highLayerCompatibility1 := omit, |
| 366 | highLayerCompatibility2 := omit, |
| 367 | user_user := omit, |
| 368 | ss_VersionIndicator := omit, |
| 369 | clir_Suppression := omit, |
| 370 | clir_Invocation := omit, |
| 371 | cC_Capabilities := omit, |
| 372 | facility_ccbs1 := omit, |
| 373 | facility_ccbs2 := omit, |
| 374 | streamIdentifier := omit, |
| 375 | supportedCodecs := omit, |
| 376 | redial := omit |
| 377 | } |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := { |
| 383 | discriminator := '0011'B, |
| 384 | tiOrSkip := { |
| 385 | transactionId := { |
| 386 | tio := int2bit(tid, 3), |
| 387 | tiFlag := ?, |
| 388 | tIExtension := omit |
| 389 | } |
| 390 | }, |
| 391 | msgs := { |
| 392 | cc := { |
| 393 | callProceeding := { |
| 394 | messageType := '000010'B, |
| 395 | nsd := '00'B, |
| 396 | repeatIndicator := *, |
| 397 | bearerCapability1 := *, |
| 398 | bearerCapability2 := *, |
| 399 | facility := *, |
| 400 | progressIndicator := *, |
| 401 | priorityGranted := *, |
| 402 | networkCCCapabilities := * |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := { |
| 409 | discriminator := '0011'B, |
| 410 | tiOrSkip := { |
| 411 | transactionId := { |
| 412 | tio := int2bit(tid, 3), |
| 413 | tiFlag := ?, |
| 414 | tIExtension := omit |
| 415 | } |
| 416 | }, |
| 417 | msgs := { |
| 418 | cc := { |
| 419 | alerting_NW_MS := { |
| 420 | messageType := '000001'B, |
| 421 | nsd := '00'B, |
| 422 | facility := *, |
| 423 | progressIndicator := *, |
| 424 | user_user := * |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | } |
| 429 | |
Harald Welte | 2bb825f | 2018-01-22 11:31:18 +0100 | [diff] [blame] | 430 | template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := { |
| 431 | discriminator := '0011'B, |
| 432 | tiOrSkip := { |
| 433 | transactionId := { |
| 434 | tio := int2bit(tid, 3), |
| 435 | tiFlag := ?, |
| 436 | tIExtension := omit |
| 437 | } |
| 438 | }, |
| 439 | msgs := { |
| 440 | cc := { |
| 441 | disconnect_NW_MS := { |
| 442 | messageType := '100101'B, |
| 443 | nsd := '00'B, |
| 444 | cause := ?, |
| 445 | facility := *, |
| 446 | progressIndicator := *, |
| 447 | user_user := *, |
| 448 | allowedActions := * |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := { |
| 455 | discriminator := '0011'B, |
| 456 | tiOrSkip := { |
| 457 | transactionId := { |
| 458 | tio := int2bit(tid, 3), |
| 459 | tiFlag := ?, |
| 460 | tIExtension := omit |
| 461 | } |
| 462 | }, |
| 463 | msgs := { |
| 464 | cc := { |
| 465 | release_NW_MS := { |
| 466 | messageType := '101101'B, |
| 467 | nsd := '00'B, |
| 468 | cause := ?, |
| 469 | secondCause := *, |
| 470 | facility := *, |
| 471 | user_user := * |
| 472 | } |
| 473 | } |
| 474 | } |
| 475 | } |
Harald Welte | d748a05 | 2018-01-22 02:59:24 +0100 | [diff] [blame] | 476 | |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame^] | 477 | template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := { |
| 478 | discriminator := '0101'B, |
| 479 | tiOrSkip := { |
| 480 | skipIndicator := '0000'B |
| 481 | }, |
| 482 | msgs := { |
| 483 | mm := { |
| 484 | authenticationRequest := { |
| 485 | messageType := '010010'B, |
| 486 | nsd := '00'B, |
| 487 | cipheringKeySequenceNumber := ?, |
| 488 | spare2_4 := ?, |
| 489 | authenticationParRAND := rand, |
| 490 | authenticationParAUTN := * |
| 491 | } |
| 492 | } |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := { |
| 497 | discriminator := '0101'B, |
| 498 | tiOrSkip := { |
| 499 | skipIndicator := '0000'B |
| 500 | }, |
| 501 | msgs := { |
| 502 | mm := { |
| 503 | authenticationResponse := { |
| 504 | messageType := '010100'B, |
| 505 | nsd := '00'B, |
| 506 | authenticationParSRES := sres, |
| 507 | authenticationParSRESext := omit |
| 508 | } |
| 509 | } |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := { |
| 514 | discriminator := '0101'B, |
| 515 | tiOrSkip := { |
| 516 | skipIndicator := '0000'B |
| 517 | }, |
| 518 | msgs := { |
| 519 | mm := { |
| 520 | authenticationResponse := { |
| 521 | messageType := '010100'B, |
| 522 | nsd := '00'B, |
| 523 | authenticationParSRES := sres, |
| 524 | authenticationParSRESext := { |
| 525 | elementIdentifier := '21'O, |
| 526 | lengthIndicator := 0, /* overwritten */ |
| 527 | valueField := res |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | } |
| 532 | } |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 533 | |
| 534 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 535 | } |