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