Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 1 | module CBSP_Templates { |
| 2 | |
| 3 | import from Osmocom_Types all; |
| 4 | import from BSSAP_Types all; |
| 5 | import from CBSP_Types all; |
| 6 | |
| 7 | /* TODO: receive templates must match IEs in any arbitrary order */ |
| 8 | |
| 9 | /* For some reason the TTCN-3 RAW codec cannot automatically figure out the IEI |
| 10 | * that it needs to set for a given union-choice (body). So we have to explicitly |
| 11 | * specify the IEI by the caller :( */ |
| 12 | template (value) CBSP_IE ts_CBSP_IE(CBSP_IEI iei, template (value) CBSP_IE_Body body) := { |
| 13 | iei := iei, |
| 14 | body := body |
| 15 | } |
| 16 | |
| 17 | template CBSP_IE tr_CBSP_IE(template CBSP_IE_Body body) := { |
| 18 | iei := ?, |
| 19 | body := body |
| 20 | } |
| 21 | |
| 22 | |
| 23 | template (value) CBSP_IE ts_CbspMsgId(template (value) uint16_t val) := |
| 24 | ts_CBSP_IE(CBSP_IEI_MSG_ID, {msg_id := val}); |
| 25 | template CBSP_IE tr_CbspMsgId(template uint16_t val := ?) := |
| 26 | tr_CBSP_IE({msg_id := val}); |
| 27 | |
| 28 | template (value) CBSP_IE ts_NewSerNo(template (value) uint16_t val) := |
| 29 | ts_CBSP_IE(CBSP_IEI_NEW_SERIAL_NR, {new_ser_nr := val}); |
| 30 | template CBSP_IE tr_NewSerNo(template uint16_t val := ?) := |
| 31 | tr_CBSP_IE({new_ser_nr := val}); |
| 32 | |
| 33 | template (value) CBSP_IE ts_OldSerNo(template (value) uint16_t val) := |
| 34 | ts_CBSP_IE(CBSP_IEI_OLD_SERIAL_NR, {old_ser_nr := val}); |
| 35 | template CBSP_IE tr_OldSerNo(template uint16_t val := ?) := |
| 36 | tr_CBSP_IE({old_ser_nr := val}); |
| 37 | |
| 38 | template (value) CBSP_IE ts_CbspKARepPeriod(template (value) uint8_t rep_per) := |
| 39 | ts_CBSP_IE(CBSP_IEI_KEEP_ALIVE_REP_PERIOD, {keep_alive_rep_period := rep_per}); |
| 40 | template CBSP_IE tr_CbspKARepPeriod(template uint8_t rep_per := ?) := |
| 41 | tr_CBSP_IE({keep_alive_rep_period := rep_per}); |
| 42 | |
| 43 | function ts_CbspChannelInd(template (omit) uint8_t val) return template (omit) CBSP_IE { |
| 44 | var template (omit) CBSP_IE ie; |
| 45 | if (istemplatekind(val, "omit")) { |
| 46 | ie := omit; |
| 47 | } else { |
| 48 | ie := ts_CBSP_IE(CBSP_IEI_CHANNEL_IND, {channel_ind := val}); |
| 49 | } |
| 50 | return ie; |
| 51 | } |
| 52 | function tr_CbspChannelInd(template uint8_t val := ?) return template CBSP_IE { |
| 53 | var template CBSP_IE ie; |
| 54 | if (istemplatekind(val, "omit")) { |
| 55 | ie := omit; |
| 56 | } else if (istemplatekind(val, "*")) { |
Harald Welte | 0833230 | 2019-08-01 09:54:40 +0200 | [diff] [blame] | 57 | ie := tr_CBSP_IE({channel_ind := ?}); //ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 58 | } else { |
| 59 | ie := tr_CBSP_IE({channel_ind := val}); |
| 60 | } |
| 61 | return ie; |
| 62 | } |
| 63 | |
| 64 | template (value) CBSP_IE ts_CbspCause(template (value) CBSP_Cause c) := |
| 65 | ts_CBSP_IE(CBSP_IEI_CAUSE, {cause := c}); |
| 66 | template CBSP_IE tr_CbspCause(template CBSP_Cause c := ?) := |
| 67 | tr_CBSP_IE({cause := c}); |
| 68 | |
| 69 | template (value) CBSP_IE ts_CbspCellList(template (value) BSSMAP_FIELD_CellIdentificationList list) := |
| 70 | ts_CBSP_IE(CBSP_IEI_CELL_LIST, { |
| 71 | cell_list := { |
| 72 | len := 0, |
| 73 | spare1_4 := '0000'B, |
| 74 | cell_id_discr := '0000'B, |
| 75 | cell_id := list |
| 76 | }}); |
| 77 | template CBSP_IE tr_CbspCellList(template BSSMAP_FIELD_CellIdentificationList list := ?) := |
| 78 | tr_CBSP_IE({ |
| 79 | cell_list := { |
| 80 | len := ?, |
| 81 | spare1_4 := ?, |
| 82 | cell_id_discr := ?, |
| 83 | cell_id := list |
| 84 | }}); |
| 85 | |
| 86 | template (value) CBSP_IE ts_CbspCategory(template (value) CBSP_Category cat) := |
| 87 | ts_CBSP_IE(CBSP_IEI_CATEGORY, {category := cat}); |
| 88 | template CBSP_IE tr_CbspCategory(template CBSP_Category cat := ?) := |
| 89 | tr_CBSP_IE({category := cat}); |
| 90 | |
| 91 | template (value) CBSP_IE ts_CbspRepetitionPeriod(template (value) uint16_t per) := |
| 92 | ts_CBSP_IE(CBSP_IEI_REP_PERIOD, {rep_period := per}); |
| 93 | template CBSP_IE tr_CbspRepetitionPeriod(template uint16_t per := ?) := |
| 94 | tr_CBSP_IE({rep_period := per}); |
| 95 | |
| 96 | template (value) CBSP_IE ts_CbspNumBcastReq(template (value) uint16_t num) := |
| 97 | ts_CBSP_IE(CBSP_IEI_NUM_BCAST_REQ, {num_bcast_req := num}); |
| 98 | template CBSP_IE tr_CbspNumBcastReq(template uint16_t num := ?) := |
| 99 | tr_CBSP_IE({num_bcast_req := num}); |
| 100 | |
| 101 | template (value) CBSP_IE ts_CbspNumPages(template (value) uint8_t num) := |
| 102 | ts_CBSP_IE(CBSP_IEI_NUM_OF_PAGES, {num_of_pages := num}); |
| 103 | template CBSP_IE tr_CbspNumPages(template uint16_t num := ?) := |
| 104 | tr_CBSP_IE({num_of_pages := num}); |
| 105 | |
| 106 | template (value) CBSP_IE ts_EmergencyInd(template (value) uint8_t val) := |
| 107 | ts_CBSP_IE(CBSP_IEI_EMERG_IND, {emerg_ind := val}); |
| 108 | template CBSP_IE tr_EmergencyInd(template uint8_t val := ?) := |
| 109 | tr_CBSP_IE({emerg_ind := val}); |
| 110 | |
| 111 | template (value) CBSP_IE ts_WarningType(template (value) uint16_t val) := |
| 112 | ts_CBSP_IE(CBSP_IEI_WARN_TYPE, {warn_type := val}); |
| 113 | template CBSP_IE tr_WarningType(template uint16_t val) := |
| 114 | tr_CBSP_IE({warn_type := val}); |
| 115 | |
| 116 | template (value) CBSP_IE ts_WarnSecInfo(template (value) octetstring payl := ''O) := |
| 117 | ts_CBSP_IE(CBSP_IEI_WARN_SEC_INFO, {warn_sec_info := payl}); |
| 118 | template CBSP_IE tr_WarnSecInfo(template octetstring payl := ?) := |
| 119 | tr_CBSP_IE({warn_sec_info := payl}); |
| 120 | |
| 121 | template (value) CBSP_IE ts_WarningPeriod(template (value) uint8_t val) := |
| 122 | ts_CBSP_IE(CBSP_IEI_WARNING_PERIOD, {warning_period := val}); |
| 123 | template CBSP_IE tr_WarningPeriod(template uint8_t val := ?) := |
| 124 | tr_CBSP_IE({warning_period := val}); |
| 125 | |
| 126 | template (value) CBSP_IE ts_CbspFailList(template (value) CBSP_FailureListItems items) := |
| 127 | ts_CBSP_IE(CBSP_IEI_FAILURE_LIST, {failure_list := { |
| 128 | len := 0, |
| 129 | list := items |
| 130 | }}); |
| 131 | template CBSP_IE tr_CbspFailList(template CBSP_FailureListItems items := ?) := |
| 132 | tr_CBSP_IE({failure_list := { |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 133 | len := ?, |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 134 | list := items |
| 135 | }}); |
| 136 | |
Pau Espin Pedrol | 696fbe7 | 2022-07-14 20:32:43 +0200 | [diff] [blame] | 137 | template (present) CBSP_FailureListItem CBSP_FailureListItem_CGI( |
| 138 | template (present) BSSMAP_FIELD_CellIdentification_CGI cgi := ?, |
| 139 | template (present) CBSP_Cause cause := ?) := |
| 140 | { |
| 141 | spare1_4 := '0000'B, |
| 142 | cell_id_discr := '0000'B, |
| 143 | cell_id := { |
| 144 | cI_CGI := cgi |
| 145 | }, |
| 146 | cause := cause |
| 147 | }; |
| 148 | |
Pau Espin Pedrol | 2b33d4e | 2022-06-10 17:00:30 +0200 | [diff] [blame] | 149 | template (present) CBSP_FailureListItem CBSP_FailureListItem_LAC_CI( |
| 150 | template (present) BSSMAP_FIELD_CellIdentification_LAC_CI lac_ci := ?, |
| 151 | template (present) CBSP_Cause cause := ?) := |
| 152 | { |
| 153 | spare1_4 := '0000'B, |
| 154 | cell_id_discr := '0001'B, |
| 155 | cell_id := { |
| 156 | cI_LAC_CI := lac_ci |
| 157 | }, |
| 158 | cause := cause |
| 159 | }; |
| 160 | |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 161 | template (value) CBSP_IE ts_CbspNumComplList(template (value) CBSP_IE_NumBcastComplList list) := |
| 162 | ts_CBSP_IE(CBSP_IEI_NUM_BCAST_COMPL_LIST, {num_bcast_compl_list := list}); |
| 163 | template CBSP_IE tr_CbspNumComplList(template CBSP_IE_NumBcastComplList list := ?) := |
| 164 | tr_CBSP_IE({num_bcast_compl_list := list}); |
| 165 | |
| 166 | template (value) CBSP_IE ts_CbspBcastMsgType(template (value) CBSP_BcastMsgType bi) := |
| 167 | ts_CBSP_IE(CBSP_IEI_BCAST_MSG_TYPE, {bcast_msg_type := { |
| 168 | spare1_4 := '0000'B, |
| 169 | msg_type := bi |
| 170 | }}); |
| 171 | template CBSP_IE tr_CbspBcastMsgType(template CBSP_BcastMsgType bi := ?) := |
| 172 | tr_CBSP_IE({bcast_msg_type := { |
| 173 | spare1_4 := ?, |
| 174 | msg_type := bi |
| 175 | }}); |
| 176 | |
| 177 | template (value) CBSP_IE ts_CbspRecoveryInd(template (value) CBSP_RecoveryInd ri) := |
| 178 | ts_CBSP_IE(CBSP_IEI_RECOVERY_IND, {recovery_ind := { |
| 179 | spare1_4 := '0000'B, |
| 180 | recovery := ri |
| 181 | }}); |
| 182 | template CBSP_IE tr_CbspRecoveryInd(template CBSP_RecoveryInd ri) := |
| 183 | tr_CBSP_IE({recovery_ind := { |
| 184 | spare1_4 := ?, |
| 185 | recovery := ri |
| 186 | }}); |
| 187 | |
| 188 | template (value) CBSP_IE ts_CbspMsgContent(template (value) octetstring payload, uint8_t user_len) := |
| 189 | ts_CBSP_IE(CBSP_IEI_MSG_CONTENT, {msg_content := { |
| 190 | user_len := user_len, |
| 191 | val := payload |
| 192 | }}); |
| 193 | template CBSP_IE tr_CbspMsgContent(template octetstring payload := ?, template uint8_t user_len := ?) := |
| 194 | tr_CBSP_IE({msg_content := { |
| 195 | user_len := user_len, |
| 196 | val := payload |
| 197 | }}); |
| 198 | |
| 199 | template (value) CBSP_IE ts_CbspDCS(template (value) uint8_t dcs) := |
| 200 | ts_CBSP_IE(CBSP_IEI_DCS, {dcs := dcs}); |
| 201 | template CBSP_IE tr_CbspDCS(template uint8_t dcs := ?) := |
| 202 | tr_CBSP_IE({dcs := dcs}); |
| 203 | |
| 204 | |
| 205 | template (value) CBSP_PDU ts_CBSP(CBSP_MessageType msg_type, template (value) CBSP_IEs ies) := { |
| 206 | msg_type := msg_type, |
| 207 | len := 0, /* overwritten */ |
| 208 | ies := ies |
| 209 | } |
| 210 | template CBSP_PDU tr_CBSP(template CBSP_MessageType msg_type := ?, template CBSP_IEs ies := *) := { |
| 211 | msg_type := msg_type, |
| 212 | len := ?, |
| 213 | ies := ies |
| 214 | } |
| 215 | |
| 216 | |
| 217 | |
| 218 | /* 8.1.3.1 WRITE REPLACE */ |
| 219 | function ts_CBSP_WRITE_CBS(template (value) uint16_t msg_id, |
| 220 | template (value) uint16_t new_ser_nr, |
| 221 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 222 | template (value) uint8_t channel_ind, |
| 223 | template (value) CBSP_Category category, |
| 224 | template (value) uint16_t rep_period, |
| 225 | template (value) uint16_t num_bcast_req, |
| 226 | template (value) uint8_t dcs, |
| 227 | template (value) CBSP_IEs content) return template (value) CBSP_PDU { |
| 228 | var template (value) CBSP_IEs ies := { |
| 229 | ts_CbspMsgId(msg_id), |
| 230 | ts_NewSerNo(new_ser_nr), |
| 231 | ts_CbspCellList(cell_list), |
| 232 | ts_CbspChannelInd(channel_ind), |
| 233 | ts_CbspCategory(category), |
| 234 | ts_CbspRepetitionPeriod(rep_period), |
| 235 | ts_CbspNumBcastReq(num_bcast_req), |
| 236 | ts_CbspDCS(dcs), |
| 237 | ts_CbspNumPages(lengthof(content)) |
| 238 | }; |
| 239 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE, valueof(ies) & valueof(content)); |
| 240 | } |
| 241 | template CBSP_PDU tr_CBSP_WRITE_CBS(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?, |
| 242 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 243 | template uint8_t channel_ind := ?, |
| 244 | template CBSP_Category category := ?, |
| 245 | template uint16_t rep_period := ?, |
| 246 | template uint16_t num_bcast_req := ?, |
| 247 | template uint8_t dcs := ?, |
| 248 | template CBSP_IEs content := ? |
| 249 | ) := |
| 250 | tr_CBSP(CBSP_MSGT_WRITE_REPLACE, ({ |
| 251 | tr_CbspMsgId(msg_id), |
| 252 | tr_NewSerNo(new_ser_nr), |
| 253 | tr_CbspCellList(cell_list), |
| 254 | tr_CbspChannelInd(channel_ind), |
| 255 | tr_CbspCategory(category), |
| 256 | tr_CbspRepetitionPeriod(rep_period), |
| 257 | tr_CbspNumBcastReq(num_bcast_req), |
| 258 | tr_CbspDCS(dcs), |
| 259 | tr_CbspNumPages(lengthof(content)), all from content })); |
| 260 | |
| 261 | |
| 262 | function ts_CBSP_REPLACE_CBS(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr, |
| 263 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 264 | template (value) uint8_t channel_ind, |
| 265 | template (value) CBSP_Category category, |
| 266 | template (value) uint16_t rep_period, |
| 267 | template (value) uint16_t num_bcast_req, |
| 268 | template (value) uint8_t dcs, |
| 269 | template (value) CBSP_IEs content) return template (value) CBSP_PDU { |
| 270 | var template (value) CBSP_IEs ies := { |
| 271 | ts_CbspMsgId(msg_id), |
| 272 | ts_NewSerNo(new_ser_nr), |
| 273 | ts_OldSerNo(old_ser_nr), |
| 274 | ts_CbspCellList(cell_list), |
| 275 | ts_CbspChannelInd(channel_ind), |
| 276 | ts_CbspCategory(category), |
| 277 | ts_CbspRepetitionPeriod(rep_period), |
| 278 | ts_CbspNumBcastReq(num_bcast_req), |
| 279 | ts_CbspDCS(dcs), |
| 280 | ts_CbspNumPages(lengthof(content)) |
| 281 | }; |
| 282 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE, valueof(ies) & valueof(content)); |
| 283 | } |
| 284 | template CBSP_PDU tr_CBSP_REPLACE_CBS(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?, |
| 285 | template uint16_t old_ser_nr := ?, |
| 286 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 287 | template uint8_t channel_ind := ?, |
| 288 | template CBSP_Category category := ?, |
| 289 | template uint16_t rep_period := ?, |
| 290 | template uint16_t num_bcast_req := ?, |
| 291 | template uint8_t dcs := ?, |
| 292 | template CBSP_IEs content := ? |
| 293 | ) := |
| 294 | tr_CBSP(CBSP_MSGT_WRITE_REPLACE, ({ |
| 295 | tr_CbspMsgId(msg_id), |
| 296 | tr_NewSerNo(new_ser_nr), |
| 297 | tr_OldSerNo(old_ser_nr), |
| 298 | tr_CbspCellList(cell_list), |
| 299 | tr_CbspChannelInd(channel_ind), |
| 300 | tr_CbspCategory(category), |
| 301 | tr_CbspRepetitionPeriod(rep_period), |
| 302 | tr_CbspNumBcastReq(num_bcast_req), |
| 303 | tr_CbspDCS(dcs), |
| 304 | tr_CbspNumPages(lengthof(content)), all from content })); |
| 305 | |
| 306 | template (value) CBSP_PDU ts_CBSP_WRITE_EMERG(uint16_t msg_id, uint16_t new_ser_nr, |
| 307 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 308 | template (value) uint8_t emerg_ind, |
| 309 | template (value) uint16_t warn_type, |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 310 | template (value) uint8_t warn_per |
| 311 | ) := |
| 312 | ts_CBSP(CBSP_MSGT_WRITE_REPLACE, { |
| 313 | ts_CbspMsgId(msg_id), |
| 314 | ts_NewSerNo(new_ser_nr), |
| 315 | ts_CbspCellList(cell_list), |
| 316 | ts_EmergencyInd(emerg_ind), |
| 317 | ts_WarningType(warn_type), |
| 318 | ts_WarnSecInfo, |
| 319 | ts_WarningPeriod(warn_per) }); |
| 320 | template CBSP_PDU tr_CBSP_WRITE_EMERG(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?, |
| 321 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 322 | template uint8_t emerg_ind := ?, |
| 323 | template uint16_t warn_type := ?, |
| 324 | template uint16_t num_bcast_req := ?, |
| 325 | template uint8_t warn_per := ? |
| 326 | ) := |
| 327 | tr_CBSP(CBSP_MSGT_WRITE_REPLACE, { |
| 328 | tr_CbspMsgId(msg_id), |
| 329 | tr_NewSerNo(new_ser_nr), |
| 330 | tr_CbspCellList(cell_list), |
| 331 | tr_EmergencyInd(emerg_ind), |
| 332 | tr_WarningType(warn_type), |
| 333 | tr_WarnSecInfo, |
| 334 | tr_WarningPeriod(warn_per) }); |
| 335 | |
| 336 | |
| 337 | template (value) CBSP_PDU ts_CBSP_REPLACE_EMERG(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr, |
| 338 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 339 | template (value) uint8_t emerg_ind, |
| 340 | template (value) uint16_t warn_type, |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 341 | template (value) uint8_t warn_per |
| 342 | ) := |
| 343 | ts_CBSP(CBSP_MSGT_WRITE_REPLACE, { |
| 344 | ts_CbspMsgId(msg_id), |
| 345 | ts_NewSerNo(new_ser_nr), |
| 346 | ts_OldSerNo(old_ser_nr), |
| 347 | ts_CbspCellList(cell_list), |
| 348 | ts_EmergencyInd(emerg_ind), |
| 349 | ts_WarningType(warn_type), |
| 350 | ts_WarnSecInfo, |
| 351 | ts_WarningPeriod(warn_per) }); |
| 352 | template CBSP_PDU tr_CBSP_REPLACE_EMERG(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?, |
| 353 | template uint16_t old_ser_nr := ?, |
| 354 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 355 | template uint8_t emerg_ind := ?, |
| 356 | template uint16_t warn_type := ?, |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 357 | template uint8_t warn_per := ? |
| 358 | ) := |
| 359 | tr_CBSP(CBSP_MSGT_WRITE_REPLACE, { |
| 360 | tr_CbspMsgId(msg_id), |
| 361 | tr_NewSerNo(new_ser_nr), |
| 362 | tr_OldSerNo(old_ser_nr), |
| 363 | tr_CbspCellList(cell_list), |
| 364 | tr_EmergencyInd(emerg_ind), |
| 365 | tr_WarningType(warn_type), |
| 366 | tr_WarnSecInfo, |
| 367 | tr_WarningPeriod(warn_per) }); |
| 368 | |
| 369 | /* 8.1.3.2 WRITE-REPLACE COMPLETE */ |
| 370 | function ts_CBSP_WRITE_CBS_COMPL(uint16_t msg_id, uint16_t new_ser_nr, |
| 371 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 372 | template (value) uint8_t channel_ind) |
| 373 | return template (value) CBSP_PDU { |
| 374 | var template (value) CBSP_IEs ies := { |
| 375 | ts_CbspMsgId(msg_id), |
| 376 | ts_NewSerNo(new_ser_nr) |
| 377 | }; |
| 378 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 379 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 380 | } |
| 381 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 382 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 383 | } |
| 384 | function tr_CBSP_WRITE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 385 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
| 386 | template uint8_t channel_ind) |
| 387 | return template CBSP_PDU { |
| 388 | var template CBSP_IEs ies := { |
| 389 | tr_CbspMsgId(msg_id), |
| 390 | tr_NewSerNo(new_ser_nr) |
| 391 | }; |
| 392 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 393 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 394 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 395 | } else if (istemplatekind(cell_list, "?")) { |
| 396 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 397 | } else if (not istemplatekind(cell_list, "omit")) { |
| 398 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 399 | } |
Harald Welte | 25a6075 | 2019-09-06 23:08:23 +0200 | [diff] [blame] | 400 | if (not istemplatekind(channel_ind, "omit")) { |
| 401 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 402 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 403 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 404 | } |
| 405 | |
| 406 | |
| 407 | function ts_CBSP_REPLACE_CBS_COMPL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr, |
| 408 | template (value) CBSP_IE_NumBcastComplList compl_list, |
| 409 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 410 | template (value) uint8_t channel_ind) |
| 411 | return template (value) CBSP_PDU { |
| 412 | var template (value) CBSP_IEs ies := { |
| 413 | ts_CbspMsgId(msg_id), |
| 414 | ts_NewSerNo(new_ser_nr), |
| 415 | ts_OldSerNo(old_ser_nr), |
| 416 | ts_CbspNumComplList(compl_list) |
| 417 | }; |
| 418 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 419 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 420 | } |
| 421 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 422 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 423 | } |
| 424 | function tr_CBSP_REPLACE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 425 | template uint16_t old_ser_nr, |
| 426 | template CBSP_IE_NumBcastComplList compl_list, |
| 427 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
| 428 | template uint8_t channel_ind) |
| 429 | return template CBSP_PDU { |
| 430 | var template CBSP_IEs ies := { |
| 431 | tr_CbspMsgId(msg_id), |
| 432 | tr_NewSerNo(new_ser_nr), |
Harald Welte | d686941 | 2022-04-27 17:50:13 +0200 | [diff] [blame] | 433 | tr_OldSerNo(old_ser_nr) |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 434 | }; |
Harald Welte | d686941 | 2022-04-27 17:50:13 +0200 | [diff] [blame] | 435 | if (istemplatekind(compl_list, "*")) { |
| 436 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 437 | //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent; |
| 438 | } else if (istemplatekind(compl_list, "?")) { |
| 439 | ies[lengthof(ies)] := tr_CbspNumComplList(?); |
| 440 | } else if (not istemplatekind(compl_list, "omit")) { |
| 441 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 442 | } |
| 443 | |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 444 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 445 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 446 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 447 | } else if (istemplatekind(cell_list, "?")) { |
| 448 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 449 | } else if (not istemplatekind(cell_list, "omit")) { |
| 450 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 451 | } |
Harald Welte | 25a6075 | 2019-09-06 23:08:23 +0200 | [diff] [blame] | 452 | if (not istemplatekind(channel_ind, "omit")) { |
| 453 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 454 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 455 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 456 | } |
| 457 | |
| 458 | |
| 459 | /* 8.1.3.3 WRITE-REPLACE FAILURE */ |
| 460 | function ts_CBSP_WRITE_CBS_FAIL(uint16_t msg_id, uint16_t new_ser_nr, |
| 461 | template (value) CBSP_FailureListItems fail_list, |
| 462 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 463 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 464 | template (value) uint8_t channel_ind) |
| 465 | return template (value) CBSP_PDU { |
| 466 | var template (value) CBSP_IEs ies := { |
| 467 | ts_CbspMsgId(msg_id), |
| 468 | ts_NewSerNo(new_ser_nr), |
| 469 | ts_CbspFailList(fail_list) |
| 470 | }; |
| 471 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 472 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 473 | } |
| 474 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 475 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 476 | } |
| 477 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 478 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 479 | } |
| 480 | function tr_CBSP_WRITE_CBS_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 481 | template CBSP_FailureListItems fail_list, |
| 482 | template CBSP_IE_NumBcastComplList compl_list, |
| 483 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
| 484 | template uint8_t channel_ind) |
| 485 | return template CBSP_PDU { |
| 486 | var template CBSP_IEs ies := { |
| 487 | tr_CbspMsgId(msg_id), |
| 488 | tr_NewSerNo(new_ser_nr), |
| 489 | tr_CbspFailList(fail_list) |
| 490 | }; |
| 491 | if (istemplatekind(compl_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 492 | //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 493 | } else if (istemplatekind(compl_list, "?")) { |
| 494 | ies[lengthof(ies)] := tr_CbspNumComplList(?); |
| 495 | } else if (not istemplatekind(compl_list, "omit")) { |
| 496 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 497 | } |
| 498 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 499 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 500 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 501 | } else if (istemplatekind(cell_list, "?")) { |
| 502 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 503 | } else if (not istemplatekind(cell_list, "omit")) { |
| 504 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 505 | } |
Harald Welte | 25a6075 | 2019-09-06 23:08:23 +0200 | [diff] [blame] | 506 | if (not istemplatekind(channel_ind, "omit")) { |
| 507 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 508 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 509 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 510 | } |
| 511 | |
| 512 | |
| 513 | function ts_CBSP_REPLACE_CBS_FAIL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr, |
| 514 | template (value) CBSP_FailureListItems fail_list, |
| 515 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 516 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 517 | template (value) uint8_t channel_ind) |
| 518 | return template (value) CBSP_PDU { |
| 519 | var template (value) CBSP_IEs ies := { |
| 520 | ts_CbspMsgId(msg_id), |
| 521 | ts_NewSerNo(new_ser_nr), |
| 522 | ts_OldSerNo(old_ser_nr), |
| 523 | ts_CbspFailList(fail_list) |
| 524 | }; |
| 525 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 526 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 527 | } |
| 528 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 529 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 530 | } |
| 531 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 532 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 533 | } |
| 534 | function tr_CBSP_REPLACE_CBS_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 535 | template uint16_t old_ser_nr, |
| 536 | template CBSP_FailureListItems fail_list, |
| 537 | template CBSP_IE_NumBcastComplList compl_list, |
| 538 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
| 539 | template uint8_t channel_ind) |
| 540 | return template CBSP_PDU { |
| 541 | var template CBSP_IEs ies := { |
| 542 | tr_CbspMsgId(msg_id), |
| 543 | tr_NewSerNo(new_ser_nr), |
| 544 | tr_OldSerNo(old_ser_nr), |
| 545 | tr_CbspFailList(fail_list) |
| 546 | }; |
| 547 | if (istemplatekind(compl_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 548 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 549 | } else if (istemplatekind(compl_list, "?")) { |
| 550 | ies[lengthof(ies)] := tr_CbspNumComplList(?); |
| 551 | } else if (not istemplatekind(compl_list, "omit")) { |
| 552 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 553 | } |
| 554 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 555 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 556 | } else if (istemplatekind(cell_list, "?")) { |
| 557 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 558 | } else if (not istemplatekind(cell_list, "omit")) { |
| 559 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 560 | } |
| 561 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 562 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 563 | } |
| 564 | |
| 565 | /* 8.1.3.4 KILL */ |
Harald Welte | 4a788a0 | 2022-04-27 16:57:24 +0200 | [diff] [blame] | 566 | function ts_CBSP_KILL(template (value) uint16_t msg_id, |
| 567 | template (value) uint16_t old_ser_nr, |
| 568 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 569 | template (omit) uint8_t channel_ind) |
| 570 | return template (value) CBSP_PDU { |
| 571 | var template (value) CBSP_IEs ies := { |
| 572 | ts_CbspMsgId(msg_id), |
| 573 | ts_OldSerNo(old_ser_nr), |
| 574 | ts_CbspCellList(cell_list) |
| 575 | }; |
| 576 | if (not istemplatekind(channel_ind, "omit")) { |
| 577 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 578 | } |
| 579 | return ts_CBSP(CBSP_MSGT_KILL, ies); |
| 580 | } |
Harald Welte | 0833230 | 2019-08-01 09:54:40 +0200 | [diff] [blame] | 581 | function tr_CBSP_KILL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?, |
| 582 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 583 | template uint8_t channel_ind := ?) |
| 584 | return template (present) CBSP_PDU { |
| 585 | var template CBSP_IEs ies := { |
| 586 | tr_CbspMsgId(msg_id), |
| 587 | tr_OldSerNo(old_ser_nr), |
| 588 | tr_CbspCellList(cell_list) |
| 589 | }; |
| 590 | if (not istemplatekind(channel_ind, "omit")) { |
| 591 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 592 | } |
| 593 | return tr_CBSP(CBSP_MSGT_KILL, ies); |
| 594 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 595 | |
| 596 | /* 8.1.3.5 KILL COMPLETE */ |
| 597 | function ts_CBSP_KILL_COMPL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 598 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 599 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 600 | template (omit) uint8_t channel_ind) |
| 601 | return template (value) CBSP_PDU { |
| 602 | var template (value) CBSP_IEs ies := { |
| 603 | ts_CbspMsgId(msg_id), |
| 604 | ts_OldSerNo(old_ser_nr) |
| 605 | }; |
| 606 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 607 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 608 | } |
| 609 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 610 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 611 | } |
| 612 | if (not istemplatekind(channel_ind, "omit")) { |
| 613 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 614 | } |
| 615 | return ts_CBSP(CBSP_MSGT_KILL_COMPL, ies); |
| 616 | } |
| 617 | function tr_CBSP_KILL_COMPL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?, |
| 618 | template CBSP_IE_NumBcastComplList compl_list := ?, |
| 619 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 620 | template uint8_t channel_ind) |
| 621 | return template CBSP_PDU { |
| 622 | var template CBSP_IEs ies := { |
| 623 | tr_CbspMsgId(msg_id), |
| 624 | tr_OldSerNo(old_ser_nr) |
| 625 | }; |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 626 | /* As soon as adding a '*' IE item, lengthof() no longer works on the ies record. So keep track of the |
| 627 | * next index to use separately. */ |
| 628 | var integer next_idx := lengthof(ies); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 629 | if (istemplatekind(compl_list, "*")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 630 | ies[next_idx] := *; |
| 631 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 632 | } else if (not istemplatekind(compl_list, "omit")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 633 | ies[next_idx] := tr_CbspNumComplList(compl_list); |
| 634 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 635 | } |
| 636 | if (istemplatekind(cell_list, "*")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 637 | ies[next_idx] := *; |
| 638 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 639 | } else if (not istemplatekind(cell_list, "omit")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 640 | ies[next_idx] := tr_CbspCellList(cell_list); |
| 641 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 642 | } |
| 643 | if (istemplatekind(channel_ind, "*")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 644 | ies[next_idx] := *; |
| 645 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 646 | } else if (not istemplatekind(channel_ind, "omit")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 647 | ies[next_idx] := tr_CbspChannelInd(channel_ind); |
| 648 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 649 | } |
| 650 | return tr_CBSP(CBSP_MSGT_KILL_COMPL, ies); |
| 651 | } |
| 652 | |
| 653 | /* 8.1.3.6 KILL FAILURE */ |
| 654 | function ts_CBSP_KILL_FAIL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 655 | template (value) CBSP_FailureListItems fail_list, |
| 656 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 657 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 658 | template (omit) uint8_t channel_ind) |
| 659 | return template (value) CBSP_PDU { |
| 660 | var template (value) CBSP_IEs ies := { |
| 661 | ts_CbspMsgId(msg_id), |
| 662 | ts_OldSerNo(old_ser_nr), |
| 663 | ts_CbspFailList(fail_list) |
| 664 | }; |
| 665 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 666 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 667 | } |
| 668 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 669 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 670 | } |
| 671 | if (not istemplatekind(channel_ind, "omit")) { |
| 672 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 673 | } |
| 674 | return ts_CBSP(CBSP_MSGT_KILL_FAIL, ies); |
| 675 | } |
| 676 | function tr_CBSP_KILL_FAIL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?, |
| 677 | template CBSP_FailureListItems fail_list := ?, |
| 678 | template CBSP_IE_NumBcastComplList compl_list := *, |
| 679 | template BSSMAP_FIELD_CellIdentificationList cell_list := *, |
| 680 | template uint8_t channel_ind := *) |
| 681 | return template CBSP_PDU { |
| 682 | var template CBSP_IEs ies := { |
| 683 | tr_CbspMsgId(msg_id), |
| 684 | tr_OldSerNo(old_ser_nr), |
| 685 | tr_CbspFailList(fail_list) |
| 686 | }; |
| 687 | if (istemplatekind(compl_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 688 | //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 689 | } else if (not istemplatekind(compl_list, "omit")) { |
| 690 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 691 | } |
Harald Welte | 885de1c | 2020-04-20 17:50:22 +0200 | [diff] [blame] | 692 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 693 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 694 | } else if (not istemplatekind(cell_list, "omit")) { |
| 695 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 696 | } |
| 697 | if (istemplatekind(channel_ind, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 698 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 699 | //ies[lengthof(ies)] := tr_CbspChannelInd(?) ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 700 | } else if (not istemplatekind(channel_ind, "omit")) { |
| 701 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 702 | } |
| 703 | return tr_CBSP(CBSP_MSGT_KILL_FAIL, ies); |
| 704 | } |
| 705 | |
Harald Welte | 562d28e | 2022-03-28 21:29:04 +0200 | [diff] [blame] | 706 | /* 8.1.3.10 MESSAGE STATUS QUERY */ |
| 707 | template (value) CBSP_PDU |
| 708 | ts_CBSP_MSG_STATUS_QUERY(template (value) uint16_t msg_id, |
| 709 | template (value) uint16_t old_ser_nr, |
| 710 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 711 | template (value) uint8_t channel_ind) := |
| 712 | ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY, { |
| 713 | ts_CbspMsgId(msg_id), |
| 714 | ts_OldSerNo(old_ser_nr), |
| 715 | ts_CbspCellList(cell_list), |
| 716 | ts_CbspChannelInd(channel_ind)}); |
| 717 | template (present) CBSP_PDU |
| 718 | tr_CBSP_MSG_STATUS_QUERY(template (present) uint16_t msg_id := ?, |
| 719 | template (present) uint16_t old_ser_nr := ?, |
| 720 | template (present) BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 721 | template (present) uint8_t channel_ind := ?) := |
| 722 | ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY, { |
| 723 | ts_CbspMsgId(msg_id), |
| 724 | ts_OldSerNo(old_ser_nr), |
| 725 | ts_CbspCellList(cell_list), |
| 726 | ts_CbspChannelInd(channel_ind)}); |
| 727 | |
| 728 | /* 8.1.3.11 MESSAGE STATUS QUERY COMPLETE */ |
| 729 | template (value) CBSP_PDU |
| 730 | ts_CBSP_MSG_STATUS_QUERY_COMPL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 731 | template (value) CBSP_IE_NumBcastComplList compl_list, |
| 732 | template (value) uint8_t channel_ind) := |
| 733 | ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_COMPL, { |
| 734 | ts_CbspMsgId(msg_id), |
| 735 | ts_OldSerNo(old_ser_nr), |
| 736 | ts_CbspNumComplList(valueof(compl_list)), |
| 737 | ts_CbspChannelInd(channel_ind)}); |
| 738 | template (present) CBSP_PDU |
| 739 | tr_CBSP_MSG_STATUS_QUERY_COMPL(template (present) uint16_t msg_id, template (present) uint16_t old_ser_nr, |
| 740 | template (present) CBSP_IE_NumBcastComplList compl_list, |
| 741 | template (present) uint8_t channel_ind) := |
| 742 | tr_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_COMPL, { |
| 743 | tr_CbspMsgId(msg_id), |
| 744 | tr_OldSerNo(old_ser_nr), |
| 745 | tr_CbspNumComplList(compl_list), |
| 746 | tr_CbspChannelInd(channel_ind)}); |
| 747 | |
| 748 | /* 8.1.3.12 MESSAGE STATUS QUERY FAILURE */ |
| 749 | function ts_CBSP_MSG_STATUS_QUERY_FAIL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 750 | template (value) CBSP_FailureListItems fail_list, |
| 751 | template (value) uint8_t channel_ind, |
| 752 | template (omit) CBSP_IE_NumBcastComplList compl_list) |
| 753 | return template (value) CBSP_PDU { |
| 754 | var template (value) CBSP_IEs ies := { |
| 755 | ts_CbspMsgId(msg_id), |
| 756 | ts_OldSerNo(old_ser_nr), |
| 757 | ts_CbspFailList(fail_list), |
| 758 | ts_CbspChannelInd(channel_ind) |
| 759 | }; |
| 760 | if (not istemplatekind(compl_list, "omit")) { |
| 761 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
| 762 | } |
| 763 | return ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_FAIL, ies); |
| 764 | } |
| 765 | function tr_CBSP_MSG_STATUS_QUERY_FAIL(template (present) uint16_t msg_id := ?, template (present) uint16_t old_ser_nr := ?, |
| 766 | template (present) CBSP_FailureListItems fail_list := ?, |
| 767 | template (present) uint8_t channel_ind := ?, |
| 768 | template CBSP_IE_NumBcastComplList compl_list := *) |
| 769 | return template (present) CBSP_PDU { |
| 770 | var template (present) CBSP_IEs ies := { |
| 771 | tr_CbspMsgId(msg_id), |
| 772 | tr_OldSerNo(old_ser_nr), |
| 773 | tr_CbspFailList(fail_list), |
| 774 | tr_CbspChannelInd(channel_ind) |
| 775 | }; |
| 776 | if (istemplatekind(compl_list, "*")) { |
| 777 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 778 | //ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
| 779 | } else if (not istemplatekind(compl_list, "omit")) { |
| 780 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 781 | } |
| 782 | return tr_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_FAIL, ies); |
| 783 | } |
| 784 | |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 785 | |
| 786 | /* 8.1.3.16 RESET */ |
| 787 | template (value) CBSP_PDU ts_CBSP_RESET(template (value) BSSMAP_FIELD_CellIdentificationList cell_list) := |
| 788 | ts_CBSP(CBSP_MSGT_RESET, { |
| 789 | ts_CbspCellList(cell_list) |
| 790 | }); |
| 791 | template CBSP_PDU tr_CBSP_RESET(template BSSMAP_FIELD_CellIdentificationList cell_list := ?) := |
| 792 | tr_CBSP(CBSP_MSGT_RESET, { |
| 793 | tr_CbspCellList(cell_list) |
| 794 | }); |
| 795 | |
| 796 | /* 8.1.3.17 RESET COMPLETE */ |
| 797 | template (value) CBSP_PDU ts_CBSP_RESET_COMPL(template (value) BSSMAP_FIELD_CellIdentificationList cell_list) := |
| 798 | ts_CBSP(CBSP_MSGT_RESET_COMPL, { |
| 799 | ts_CbspCellList(cell_list) |
| 800 | }); |
| 801 | template CBSP_PDU tr_CBSP_RESET_COMPL(template BSSMAP_FIELD_CellIdentificationList cell_list := ?) := |
| 802 | tr_CBSP(CBSP_MSGT_RESET_COMPL, { |
| 803 | tr_CbspCellList(cell_list) |
| 804 | }); |
| 805 | |
| 806 | /* 8.1.3.18 RESET FAILURE */ |
| 807 | template (value) CBSP_PDU ts_CBSP_RESET_FAIL(template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 808 | template (value) CBSP_FailureListItems fail_items) := |
| 809 | ts_CBSP(CBSP_MSGT_RESET_FAIL, { |
| 810 | ts_CbspFailList(fail_items), |
| 811 | ts_CbspCellList(cell_list) |
| 812 | }); |
| 813 | |
| 814 | template CBSP_PDU tr_CBSP_RESET_FAIL(template BSSMAP_FIELD_CellIdentificationList cell_list, |
| 815 | template CBSP_FailureListItems fail_items) := |
| 816 | tr_CBSP(CBSP_MSGT_RESET_FAIL, { |
| 817 | tr_CbspFailList(fail_items), |
| 818 | tr_CbspCellList(cell_list) |
| 819 | }); |
| 820 | |
| 821 | /* 8.1.3.18a KEEP-ALIVE */ |
| 822 | template (value) CBSP_PDU ts_CBSP_KEEP_ALIVE(uint8_t rep_period) := |
| 823 | ts_CBSP(CBSP_MSGT_KEEP_ALIVE, {ts_CbspKARepPeriod(rep_period)}); |
| 824 | template CBSP_PDU tr_CBSP_KEEP_ALIVE(template uint8_t rep_period := ?) := |
| 825 | tr_CBSP(CBSP_MSGT_KEEP_ALIVE, {tr_CbspKARepPeriod(rep_period)}); |
| 826 | |
| 827 | /* 8.1.3.18b KEEP-ALIVE COMPLETE */ |
| 828 | template (value) CBSP_PDU ts_CBSP_KEEP_ALIVE_COMPL := |
| 829 | ts_CBSP(CBSP_MSGT_KEEP_ALIVE_COMPL, {}); |
| 830 | template CBSP_PDU tr_CBSP_KEEP_ALIVE_COMPL := |
| 831 | tr_CBSP(CBSP_MSGT_KEEP_ALIVE_COMPL, {}); |
| 832 | |
| 833 | /* 8.1.3.19 RESTART */ |
| 834 | template (value) CBSP_PDU ts_CBSP_RESTART(template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 835 | template (value) CBSP_BcastMsgType msg_type, |
| 836 | template (value) CBSP_RecoveryInd rec_ind) := |
| 837 | ts_CBSP(CBSP_MSGT_RESTART, { |
| 838 | ts_CbspCellList(cell_list), |
| 839 | ts_CbspBcastMsgType(msg_type), |
| 840 | ts_CbspRecoveryInd(rec_ind) |
| 841 | }); |
| 842 | template CBSP_PDU tr_CBSP_RESTART(template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 843 | template CBSP_BcastMsgType msg_type := ?, |
| 844 | template CBSP_RecoveryInd rec_ind := ?) := |
| 845 | tr_CBSP(CBSP_MSGT_RESTART, { |
| 846 | tr_CbspCellList(cell_list), |
| 847 | tr_CbspBcastMsgType(msg_type), |
| 848 | tr_CbspRecoveryInd(rec_ind) |
| 849 | }); |
| 850 | |
| 851 | /* 8.1.3.20 FAILURE */ |
| 852 | template (value) CBSP_PDU ts_CBSP_FAILURE(template (value) CBSP_FailureListItems fail_list, |
| 853 | template (value) CBSP_BcastMsgType msg_type) := |
| 854 | ts_CBSP(CBSP_MSGT_FAILURE, { |
| 855 | ts_CbspFailList(fail_list), |
| 856 | ts_CbspBcastMsgType(msg_type) |
| 857 | }); |
| 858 | template CBSP_PDU tr_CBSP_FAILURE(template CBSP_FailureListItems fail_list := ?, |
| 859 | template CBSP_BcastMsgType msg_type := ?) := |
| 860 | tr_CBSP(CBSP_MSGT_FAILURE, { |
| 861 | tr_CbspFailList(fail_list), |
| 862 | tr_CbspBcastMsgType(msg_type) |
| 863 | }); |
| 864 | |
| 865 | /* 8.1.3.21 ERROR INDICATION */ |
| 866 | template (value) CBSP_PDU ts_CBSP_ERROR_IND(CBSP_Cause cause) := |
| 867 | ts_CBSP(CBSP_MSGT_ERROR_IND, {ts_CbspCause(cause)}); |
| 868 | template CBSP_PDU tr_CBSP_ERROR_IND(template CBSP_Cause cause) := |
| 869 | tr_CBSP(CBSP_MSGT_ERROR_IND, {tr_CbspCause(cause), *}); |
| 870 | |
| 871 | |
| 872 | function f_cbsp_find_ie(CBSP_PDU msg, CBSP_IEI iei, out CBSP_IE ret) return boolean { |
| 873 | for (var integer i := 0; i < sizeof(msg.ies); i := i+1) { |
| 874 | if (msg.ies[i].iei == iei) { |
| 875 | ret := msg.ies[i]; |
| 876 | return true; |
| 877 | } |
| 878 | } |
| 879 | return false; |
| 880 | } |
| 881 | |
| 882 | |
| 883 | } |