Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 1 | module L3_Templates { |
| 2 | |
Harald Welte | 35bb716 | 2018-01-03 21:07:52 +0100 | [diff] [blame] | 3 | /* L3 Templates, building on top of MobileL3*_Types from Ericsson. |
| 4 | * |
| 5 | * (C) 2017 by Harald Welte <laforge@gnumonks.org> |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Released under the terms of GNU General Public License, Version 2 or |
| 9 | * (at your option) any later version. |
| 10 | */ |
| 11 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 12 | import from General_Types all; |
| 13 | import from MobileL3_Types all; |
| 14 | import from MobileL3_CommonIE_Types all; |
| 15 | import from MobileL3_MM_Types all; |
| 16 | import from MobileL3_RRM_Types all; |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 17 | import from MobileL3_CC_Types all; |
| 18 | //import from MobileL3_GMM_SM_Types all; |
| 19 | //import from MobileL3_SMS_Types all; |
| 20 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 21 | |
| 22 | type enumerated CmServiceType { |
| 23 | CM_TYPE_MO_CALL ('0001'B), |
| 24 | CM_TYPE_EMERG_CALL ('0010'B), |
| 25 | CM_TYPE_MO_SMS ('0100'B), |
| 26 | CM_TYPE_SS_ACT ('1000'B) |
| 27 | } |
| 28 | |
| 29 | |
| 30 | /* send template fro Mobile Identity (TMSI) */ |
| 31 | template MobileIdentityLV ts_MI_TMSI_LV(OCT4 tmsi) := { |
| 32 | lengthIndicator := 0, /* overwritten */ |
| 33 | mobileIdentityV := { |
| 34 | typeOfIdentity := '000'B, /* overwritten */ |
| 35 | oddEvenInd_identity := { |
| 36 | tmsi_ptmsi := { |
| 37 | oddevenIndicator := '0'B, |
| 38 | fillerDigit := '1111'B, |
| 39 | octets := tmsi |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 { |
| 46 | var IMSI_L3 l3; |
| 47 | var integer len := lengthof(digits); |
| 48 | if (len rem 2 == 1) { /* modulo remainder */ |
Harald Welte | 365f4ed | 2017-11-23 00:00:43 +0100 | [diff] [blame] | 49 | l3.oddevenIndicator := '1'B; |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 50 | l3.fillerDigit := '1111'B; |
| 51 | } else { |
Harald Welte | 365f4ed | 2017-11-23 00:00:43 +0100 | [diff] [blame] | 52 | l3.oddevenIndicator := '0'B; |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 53 | l3.fillerDigit := omit; |
| 54 | } |
| 55 | l3.digits := digits; |
| 56 | return l3; |
| 57 | } |
| 58 | |
| 59 | /* send template fro Mobile Identity (IMSI) */ |
| 60 | template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := { |
| 61 | lengthIndicator := 0, /* overwritten */ |
| 62 | mobileIdentityV := { |
| 63 | typeOfIdentity := '000'B, /* overwritten */ |
| 64 | oddEvenInd_identity := { |
| 65 | imsi := f_enc_IMSI_L3(imsi_digits) |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /* Send template for Classmark 2 */ |
| 71 | template (value) MobileStationClassmark2_LV ts_CM2 := { |
| 72 | lengthIndicator := 0, |
| 73 | rf_PowerCapability := '000'B, |
| 74 | a5_1 := '0'B, |
| 75 | esind := '1'B, |
| 76 | revisionLevel := '10'B, |
| 77 | spare1_1 := '0'B, |
| 78 | mobileStationClassmark2_oct4 := omit, |
| 79 | mobileStationClassmark2_oct5 := omit |
| 80 | }; |
| 81 | |
| 82 | /* Send template for CM SERVICE REQUEST */ |
| 83 | template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(BIT4 serv_type, MobileIdentityLV mi_lv) := { |
| 84 | discriminator := '0000'B, /* overwritten */ |
| 85 | tiOrSkip := { |
| 86 | skipIndicator := '0000'B |
| 87 | }, |
| 88 | msgs := { |
| 89 | mm := { |
| 90 | cMServiceRequest := { |
| 91 | messageType := '000000'B, /* overwritten */ |
| 92 | nsd := '00'B, |
| 93 | cm_ServiceType := serv_type, |
| 94 | cipheringKeySequenceNumber := { '000'B, '0'B }, |
| 95 | mobileStationClassmark2 := ts_CM2, |
| 96 | mobileIdentity := mi_lv, |
| 97 | priorityLevel := omit, |
| 98 | additionalUpdateParameterTV := omit, |
| 99 | deviceProperties := omit |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 105 | template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := { |
| 106 | discriminator := discr, |
| 107 | tiOrSkip := { |
| 108 | skipIndicator := '0000'B |
| 109 | }, |
| 110 | msgs := ? |
| 111 | } |
| 112 | |
| 113 | |
| 114 | template PDU_ML3_NW_MS tr_CM_SERV_ACC := { |
| 115 | discriminator := '0101'B, |
| 116 | tiOrSkip := { |
| 117 | skipIndicator := '0000'B |
| 118 | }, |
| 119 | msgs := { |
| 120 | mm := { |
| 121 | cMServiceAccept := { |
| 122 | messageType := '100001'B, |
| 123 | nsd := ? |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 130 | template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := { |
| 131 | discriminator := '0101'B, |
| 132 | tiOrSkip := { |
| 133 | skipIndicator := '0000'B |
| 134 | }, |
| 135 | msgs := { |
| 136 | mm := { |
| 137 | cMServiceReject := { |
| 138 | messageType := '100010'B, |
| 139 | nsd := ?, |
| 140 | rejectCause := rej_cause, |
| 141 | t3246_Value := * |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 147 | /* Send template for PAGING RESPONSE */ |
| 148 | template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := { |
| 149 | discriminator := '0000'B, /* overwritten */ |
| 150 | tiOrSkip := { |
| 151 | skipIndicator := '0000'B |
| 152 | }, |
| 153 | msgs := { |
| 154 | rrm := { |
| 155 | pagingResponse := { |
| 156 | messageType := '00000000'B, /* overwritten */ |
| 157 | cipheringKeySequenceNumber := { '000'B, '0'B }, |
| 158 | spare1_4 := '0000'B, |
| 159 | mobileStationClassmark := ts_CM2, |
| 160 | mobileIdentity := mi_lv, |
| 161 | additionalUpdateParameters := omit |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
Harald Welte | 1516614 | 2017-12-16 23:02:08 +0100 | [diff] [blame] | 167 | template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := { |
| 168 | discriminator := '0000'B, /* overwritten */ |
| 169 | tiOrSkip := { |
| 170 | skipIndicator := '0000'B |
| 171 | }, |
| 172 | msgs := { |
| 173 | rrm := { |
| 174 | channelModeModifyAck := { |
| 175 | messageType := '00010111'B, |
| 176 | channelDescription := desc, |
| 177 | channelMode := mode, |
| 178 | extendedTSCSet := omit |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | } |
| 183 | |
Harald Welte | 73cd271 | 2017-12-17 00:44:52 +0100 | [diff] [blame] | 184 | template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := { |
| 185 | discriminator := '0000'B, /* overwritten */ |
| 186 | tiOrSkip := { |
| 187 | skipIndicator := '0000'B |
| 188 | }, |
| 189 | msgs := { |
| 190 | rrm := { |
| 191 | cipheringModeComplete := { |
| 192 | messageType := '00110010'B, |
| 193 | mobileEquipmentIdentity := omit |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
Harald Welte | 1516614 | 2017-12-16 23:02:08 +0100 | [diff] [blame] | 199 | |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 200 | template PDU_ML3_MS_NW ts_ML3_MO := { |
| 201 | discriminator := '0000'B, |
| 202 | tiOrSkip := { |
| 203 | skipIndicator := '0000'B |
| 204 | }, |
| 205 | msgs := ? |
| 206 | } |
| 207 | |
| 208 | template LocationUpdatingType ts_ML3_IE_LuType := { |
| 209 | lut := ?, |
| 210 | spare1_1 := '0'B, |
| 211 | fop := '0'B |
| 212 | } |
| 213 | |
| 214 | template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := { |
| 215 | lut := '00'B |
| 216 | } |
| 217 | |
| 218 | template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := { |
| 219 | lut := '01'B |
| 220 | } |
| 221 | |
| 222 | template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := { |
| 223 | lut := '10'B |
| 224 | } |
| 225 | |
| 226 | template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := { |
| 227 | keySequence := int2bit(cksn, 3), |
| 228 | spare := '0'B |
| 229 | } |
| 230 | |
| 231 | template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai, |
| 232 | MobileIdentityLV mi, MobileStationClassmark1_V cm1) |
| 233 | modifies ts_ML3_MO := { |
| 234 | msgs := { |
| 235 | mm := { |
| 236 | locationUpdateRequest := { |
| 237 | messageType := '001000'B, |
| 238 | nsd := '00'B, /* ? */ |
| 239 | locationUpdatingType := lu_type, |
| 240 | cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0), |
| 241 | locationAreaIdentification := lai, |
| 242 | mobileStationClassmark1 := cm1, |
| 243 | mobileIdentityLV := mi, |
| 244 | classmarkInformationType2_forUMTS := omit, |
| 245 | additionalUpdateParameterTV := omit, |
| 246 | deviceProperties := omit, |
| 247 | mS_NetworkFeatureSupport := omit |
| 248 | } |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 253 | template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := { |
| 254 | msgs := { |
| 255 | mm := { |
| 256 | tmsiReallocComplete := { |
| 257 | messageType := '011011'B, |
| 258 | nsd := '00'B |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := { |
| 265 | discriminator := '0101'B, |
| 266 | tiOrSkip := { |
| 267 | skipIndicator := '0000'B |
| 268 | }, |
| 269 | msgs := { |
| 270 | mm := { |
| 271 | locationUpdateAccept := { |
| 272 | messageType := '000010'B, |
| 273 | nsd := '00'B, |
| 274 | locationAreaIdentification := ?, |
| 275 | mobileIdentityTLV := *, |
| 276 | followOnProceed := *, |
| 277 | cTS_Permission := *, |
| 278 | equivalentPLMNs := *, |
| 279 | emergencyNumberList := *, |
| 280 | perMS_T3212 := * |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := { |
| 287 | discriminator := '0101'B, |
| 288 | tiOrSkip := { |
| 289 | skipIndicator := '0000'B |
| 290 | }, |
| 291 | msgs := { |
| 292 | mm := { |
| 293 | locationUpdateReject := { |
| 294 | messageType := '000100'B, |
| 295 | nsd := '00'B, |
| 296 | rejectCause := cause, |
| 297 | t3246_Value := * |
| 298 | } |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame] | 303 | |
| 304 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 305 | } |