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 | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame^] | 105 | template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := { |
| 106 | discriminator := '0101'B, |
| 107 | tiOrSkip := { |
| 108 | skipIndicator := '0000'B |
| 109 | }, |
| 110 | msgs := { |
| 111 | mm := { |
| 112 | cMServiceReject := { |
| 113 | messageType := '100010'B, |
| 114 | nsd := ?, |
| 115 | rejectCause := rej_cause, |
| 116 | t3246_Value := * |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 122 | /* Send template for PAGING RESPONSE */ |
| 123 | template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := { |
| 124 | discriminator := '0000'B, /* overwritten */ |
| 125 | tiOrSkip := { |
| 126 | skipIndicator := '0000'B |
| 127 | }, |
| 128 | msgs := { |
| 129 | rrm := { |
| 130 | pagingResponse := { |
| 131 | messageType := '00000000'B, /* overwritten */ |
| 132 | cipheringKeySequenceNumber := { '000'B, '0'B }, |
| 133 | spare1_4 := '0000'B, |
| 134 | mobileStationClassmark := ts_CM2, |
| 135 | mobileIdentity := mi_lv, |
| 136 | additionalUpdateParameters := omit |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | |
Harald Welte | 1516614 | 2017-12-16 23:02:08 +0100 | [diff] [blame] | 142 | template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := { |
| 143 | discriminator := '0000'B, /* overwritten */ |
| 144 | tiOrSkip := { |
| 145 | skipIndicator := '0000'B |
| 146 | }, |
| 147 | msgs := { |
| 148 | rrm := { |
| 149 | channelModeModifyAck := { |
| 150 | messageType := '00010111'B, |
| 151 | channelDescription := desc, |
| 152 | channelMode := mode, |
| 153 | extendedTSCSet := omit |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | |
Harald Welte | 73cd271 | 2017-12-17 00:44:52 +0100 | [diff] [blame] | 159 | template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := { |
| 160 | discriminator := '0000'B, /* overwritten */ |
| 161 | tiOrSkip := { |
| 162 | skipIndicator := '0000'B |
| 163 | }, |
| 164 | msgs := { |
| 165 | rrm := { |
| 166 | cipheringModeComplete := { |
| 167 | messageType := '00110010'B, |
| 168 | mobileEquipmentIdentity := omit |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
Harald Welte | 1516614 | 2017-12-16 23:02:08 +0100 | [diff] [blame] | 174 | |
Harald Welte | cb6cc33 | 2018-01-21 13:59:08 +0100 | [diff] [blame^] | 175 | template PDU_ML3_MS_NW ts_ML3_MO := { |
| 176 | discriminator := '0000'B, |
| 177 | tiOrSkip := { |
| 178 | skipIndicator := '0000'B |
| 179 | }, |
| 180 | msgs := ? |
| 181 | } |
| 182 | |
| 183 | template LocationUpdatingType ts_ML3_IE_LuType := { |
| 184 | lut := ?, |
| 185 | spare1_1 := '0'B, |
| 186 | fop := '0'B |
| 187 | } |
| 188 | |
| 189 | template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := { |
| 190 | lut := '00'B |
| 191 | } |
| 192 | |
| 193 | template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := { |
| 194 | lut := '01'B |
| 195 | } |
| 196 | |
| 197 | template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := { |
| 198 | lut := '10'B |
| 199 | } |
| 200 | |
| 201 | template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := { |
| 202 | keySequence := int2bit(cksn, 3), |
| 203 | spare := '0'B |
| 204 | } |
| 205 | |
| 206 | template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai, |
| 207 | MobileIdentityLV mi, MobileStationClassmark1_V cm1) |
| 208 | modifies ts_ML3_MO := { |
| 209 | msgs := { |
| 210 | mm := { |
| 211 | locationUpdateRequest := { |
| 212 | messageType := '001000'B, |
| 213 | nsd := '00'B, /* ? */ |
| 214 | locationUpdatingType := lu_type, |
| 215 | cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0), |
| 216 | locationAreaIdentification := lai, |
| 217 | mobileStationClassmark1 := cm1, |
| 218 | mobileIdentityLV := mi, |
| 219 | classmarkInformationType2_forUMTS := omit, |
| 220 | additionalUpdateParameterTV := omit, |
| 221 | deviceProperties := omit, |
| 222 | mS_NetworkFeatureSupport := omit |
| 223 | } |
| 224 | } |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | |
| 229 | |
Harald Welte | c76f29f | 2017-11-22 12:46:46 +0100 | [diff] [blame] | 230 | } |