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 | } |
Pau Espin Pedrol | ad5d2db | 2022-08-03 14:02:02 +0200 | [diff] [blame] | 384 | function ts_CBSP_WRITE_EMERG_COMPL(uint16_t msg_id, uint16_t new_ser_nr, |
| 385 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list) |
| 386 | return template (value) CBSP_PDU { |
| 387 | var template (value) CBSP_IEs ies := { |
| 388 | ts_CbspMsgId(msg_id), |
| 389 | ts_NewSerNo(new_ser_nr) |
| 390 | }; |
| 391 | if (not istemplatekind(cell_list, "omit")) { |
| 392 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
| 393 | } |
| 394 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 395 | } |
| 396 | |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 397 | function tr_CBSP_WRITE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 398 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
Pau Espin Pedrol | f14e3ec | 2022-08-09 12:51:56 +0200 | [diff] [blame] | 399 | template (present) uint8_t channel_ind) |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 400 | return template CBSP_PDU { |
| 401 | var template CBSP_IEs ies := { |
| 402 | tr_CbspMsgId(msg_id), |
| 403 | tr_NewSerNo(new_ser_nr) |
| 404 | }; |
| 405 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 406 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 407 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 408 | } else if (istemplatekind(cell_list, "?")) { |
| 409 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 410 | } else if (not istemplatekind(cell_list, "omit")) { |
| 411 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 412 | } |
Pau Espin Pedrol | ad5d2db | 2022-08-03 14:02:02 +0200 | [diff] [blame] | 413 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 414 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 415 | } |
| 416 | function tr_CBSP_WRITE_EMERG_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 417 | template BSSMAP_FIELD_CellIdentificationList cell_list) |
| 418 | return template CBSP_PDU { |
| 419 | var template CBSP_IEs ies := { |
| 420 | tr_CbspMsgId(msg_id), |
| 421 | tr_NewSerNo(new_ser_nr) |
| 422 | }; |
| 423 | if (istemplatekind(cell_list, "*")) { |
| 424 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 425 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
| 426 | } else if (istemplatekind(cell_list, "?")) { |
| 427 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 428 | } else if (not istemplatekind(cell_list, "omit")) { |
| 429 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
Harald Welte | 25a6075 | 2019-09-06 23:08:23 +0200 | [diff] [blame] | 430 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 431 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 432 | } |
| 433 | |
| 434 | |
| 435 | function ts_CBSP_REPLACE_CBS_COMPL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr, |
| 436 | template (value) CBSP_IE_NumBcastComplList compl_list, |
| 437 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 438 | template (value) uint8_t channel_ind) |
| 439 | return template (value) CBSP_PDU { |
| 440 | var template (value) CBSP_IEs ies := { |
| 441 | ts_CbspMsgId(msg_id), |
| 442 | ts_NewSerNo(new_ser_nr), |
| 443 | ts_OldSerNo(old_ser_nr), |
| 444 | ts_CbspNumComplList(compl_list) |
| 445 | }; |
| 446 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 447 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 448 | } |
| 449 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 450 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 451 | } |
Pau Espin Pedrol | ad5d2db | 2022-08-03 14:02:02 +0200 | [diff] [blame] | 452 | function ts_CBSP_REPLACE_EMERG_COMPL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr, |
| 453 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list) |
| 454 | return template (value) CBSP_PDU { |
| 455 | var template (value) CBSP_IEs ies := { |
| 456 | ts_CbspMsgId(msg_id), |
| 457 | ts_NewSerNo(new_ser_nr), |
| 458 | ts_OldSerNo(old_ser_nr) |
| 459 | }; |
| 460 | if (not istemplatekind(cell_list, "omit")) { |
| 461 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
| 462 | } |
| 463 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 464 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 465 | function tr_CBSP_REPLACE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 466 | template uint16_t old_ser_nr, |
| 467 | template CBSP_IE_NumBcastComplList compl_list, |
| 468 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
Pau Espin Pedrol | f14e3ec | 2022-08-09 12:51:56 +0200 | [diff] [blame] | 469 | template (present) uint8_t channel_ind) |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 470 | return template CBSP_PDU { |
| 471 | var template CBSP_IEs ies := { |
| 472 | tr_CbspMsgId(msg_id), |
| 473 | tr_NewSerNo(new_ser_nr), |
Harald Welte | d686941 | 2022-04-27 17:50:13 +0200 | [diff] [blame] | 474 | tr_OldSerNo(old_ser_nr) |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 475 | }; |
Harald Welte | d686941 | 2022-04-27 17:50:13 +0200 | [diff] [blame] | 476 | if (istemplatekind(compl_list, "*")) { |
| 477 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 478 | //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent; |
| 479 | } else if (istemplatekind(compl_list, "?")) { |
| 480 | ies[lengthof(ies)] := tr_CbspNumComplList(?); |
| 481 | } else if (not istemplatekind(compl_list, "omit")) { |
| 482 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 483 | } |
| 484 | |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 485 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 486 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 487 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 488 | } else if (istemplatekind(cell_list, "?")) { |
| 489 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 490 | } else if (not istemplatekind(cell_list, "omit")) { |
| 491 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 492 | } |
Harald Welte | 25a6075 | 2019-09-06 23:08:23 +0200 | [diff] [blame] | 493 | if (not istemplatekind(channel_ind, "omit")) { |
| 494 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 495 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 496 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 497 | } |
Pau Espin Pedrol | ad5d2db | 2022-08-03 14:02:02 +0200 | [diff] [blame] | 498 | function tr_CBSP_REPLACE_EMERG_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 499 | template uint16_t old_ser_nr, |
| 500 | template BSSMAP_FIELD_CellIdentificationList cell_list) |
| 501 | return template CBSP_PDU { |
| 502 | var template CBSP_IEs ies := { |
| 503 | tr_CbspMsgId(msg_id), |
| 504 | tr_NewSerNo(new_ser_nr), |
| 505 | tr_OldSerNo(old_ser_nr) |
| 506 | }; |
| 507 | |
| 508 | if (istemplatekind(cell_list, "*")) { |
| 509 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 510 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
| 511 | } else if (istemplatekind(cell_list, "?")) { |
| 512 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 513 | } else if (not istemplatekind(cell_list, "omit")) { |
| 514 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 515 | } |
| 516 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 517 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 518 | |
| 519 | |
| 520 | /* 8.1.3.3 WRITE-REPLACE FAILURE */ |
| 521 | function ts_CBSP_WRITE_CBS_FAIL(uint16_t msg_id, uint16_t new_ser_nr, |
| 522 | template (value) CBSP_FailureListItems fail_list, |
| 523 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 524 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 525 | template (value) uint8_t channel_ind) |
| 526 | return template (value) CBSP_PDU { |
| 527 | var template (value) CBSP_IEs ies := { |
| 528 | ts_CbspMsgId(msg_id), |
| 529 | ts_NewSerNo(new_ser_nr), |
| 530 | ts_CbspFailList(fail_list) |
| 531 | }; |
| 532 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 533 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 534 | } |
| 535 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 536 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 537 | } |
| 538 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 539 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 540 | } |
| 541 | function tr_CBSP_WRITE_CBS_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 542 | template CBSP_FailureListItems fail_list, |
| 543 | template CBSP_IE_NumBcastComplList compl_list, |
| 544 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
Pau Espin Pedrol | f14e3ec | 2022-08-09 12:51:56 +0200 | [diff] [blame] | 545 | template (present) uint8_t channel_ind) |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 546 | return template CBSP_PDU { |
| 547 | var template CBSP_IEs ies := { |
| 548 | tr_CbspMsgId(msg_id), |
| 549 | tr_NewSerNo(new_ser_nr), |
| 550 | tr_CbspFailList(fail_list) |
| 551 | }; |
| 552 | if (istemplatekind(compl_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 553 | //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 554 | } else if (istemplatekind(compl_list, "?")) { |
| 555 | ies[lengthof(ies)] := tr_CbspNumComplList(?); |
| 556 | } else if (not istemplatekind(compl_list, "omit")) { |
| 557 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 558 | } |
| 559 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 560 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 561 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 562 | } else if (istemplatekind(cell_list, "?")) { |
| 563 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 564 | } else if (not istemplatekind(cell_list, "omit")) { |
| 565 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 566 | } |
Pau Espin Pedrol | f14e3ec | 2022-08-09 12:51:56 +0200 | [diff] [blame] | 567 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 568 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 569 | } |
| 570 | function tr_CBSP_WRITE_EMERG_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 571 | template CBSP_FailureListItems fail_list, |
| 572 | template CBSP_IE_NumBcastComplList compl_list, |
| 573 | template BSSMAP_FIELD_CellIdentificationList cell_list) |
| 574 | return template CBSP_PDU { |
| 575 | var template CBSP_IEs ies := { |
| 576 | tr_CbspMsgId(msg_id), |
| 577 | tr_NewSerNo(new_ser_nr), |
| 578 | tr_CbspFailList(fail_list) |
| 579 | }; |
| 580 | if (istemplatekind(compl_list, "*")) { |
| 581 | //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent; |
| 582 | } else if (istemplatekind(compl_list, "?")) { |
| 583 | ies[lengthof(ies)] := tr_CbspNumComplList(?); |
| 584 | } else if (not istemplatekind(compl_list, "omit")) { |
| 585 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 586 | } |
| 587 | if (istemplatekind(cell_list, "*")) { |
| 588 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 589 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
| 590 | } else if (istemplatekind(cell_list, "?")) { |
| 591 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 592 | } else if (not istemplatekind(cell_list, "omit")) { |
| 593 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
Harald Welte | 25a6075 | 2019-09-06 23:08:23 +0200 | [diff] [blame] | 594 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 595 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 596 | } |
| 597 | |
| 598 | |
| 599 | function ts_CBSP_REPLACE_CBS_FAIL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr, |
| 600 | template (value) CBSP_FailureListItems fail_list, |
| 601 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 602 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 603 | template (value) uint8_t channel_ind) |
| 604 | return template (value) CBSP_PDU { |
| 605 | var template (value) CBSP_IEs ies := { |
| 606 | ts_CbspMsgId(msg_id), |
| 607 | ts_NewSerNo(new_ser_nr), |
| 608 | ts_OldSerNo(old_ser_nr), |
| 609 | ts_CbspFailList(fail_list) |
| 610 | }; |
| 611 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 612 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 613 | } |
| 614 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 615 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 616 | } |
| 617 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 618 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 619 | } |
| 620 | function tr_CBSP_REPLACE_CBS_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 621 | template uint16_t old_ser_nr, |
| 622 | template CBSP_FailureListItems fail_list, |
| 623 | template CBSP_IE_NumBcastComplList compl_list, |
| 624 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
Pau Espin Pedrol | f14e3ec | 2022-08-09 12:51:56 +0200 | [diff] [blame] | 625 | template (present) uint8_t channel_ind) |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 626 | return template CBSP_PDU { |
| 627 | var template CBSP_IEs ies := { |
| 628 | tr_CbspMsgId(msg_id), |
| 629 | tr_NewSerNo(new_ser_nr), |
| 630 | tr_OldSerNo(old_ser_nr), |
| 631 | tr_CbspFailList(fail_list) |
| 632 | }; |
| 633 | if (istemplatekind(compl_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 634 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 635 | } else if (istemplatekind(compl_list, "?")) { |
| 636 | ies[lengthof(ies)] := tr_CbspNumComplList(?); |
| 637 | } else if (not istemplatekind(compl_list, "omit")) { |
| 638 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 639 | } |
| 640 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 641 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 642 | } else if (istemplatekind(cell_list, "?")) { |
| 643 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 644 | } else if (not istemplatekind(cell_list, "omit")) { |
| 645 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 646 | } |
| 647 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 648 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 649 | } |
Pau Espin Pedrol | f14e3ec | 2022-08-09 12:51:56 +0200 | [diff] [blame] | 650 | function tr_CBSP_REPLACE_EMERG_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 651 | template uint16_t old_ser_nr, |
| 652 | template CBSP_FailureListItems fail_list, |
| 653 | template CBSP_IE_NumBcastComplList compl_list, |
| 654 | template BSSMAP_FIELD_CellIdentificationList cell_list) |
| 655 | return template CBSP_PDU { |
| 656 | var template CBSP_IEs ies := { |
| 657 | tr_CbspMsgId(msg_id), |
| 658 | tr_NewSerNo(new_ser_nr), |
| 659 | tr_OldSerNo(old_ser_nr), |
| 660 | tr_CbspFailList(fail_list) |
| 661 | }; |
| 662 | if (istemplatekind(compl_list, "*")) { |
| 663 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
| 664 | } else if (istemplatekind(compl_list, "?")) { |
| 665 | ies[lengthof(ies)] := tr_CbspNumComplList(?); |
| 666 | } else if (not istemplatekind(compl_list, "omit")) { |
| 667 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 668 | } |
| 669 | if (istemplatekind(cell_list, "*")) { |
| 670 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
| 671 | } else if (istemplatekind(cell_list, "?")) { |
| 672 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 673 | } else if (not istemplatekind(cell_list, "omit")) { |
| 674 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 675 | } |
| 676 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 677 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 678 | |
| 679 | /* 8.1.3.4 KILL */ |
Harald Welte | 4a788a0 | 2022-04-27 16:57:24 +0200 | [diff] [blame] | 680 | function ts_CBSP_KILL(template (value) uint16_t msg_id, |
| 681 | template (value) uint16_t old_ser_nr, |
| 682 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 683 | template (omit) uint8_t channel_ind) |
| 684 | return template (value) CBSP_PDU { |
| 685 | var template (value) CBSP_IEs ies := { |
| 686 | ts_CbspMsgId(msg_id), |
| 687 | ts_OldSerNo(old_ser_nr), |
| 688 | ts_CbspCellList(cell_list) |
| 689 | }; |
| 690 | if (not istemplatekind(channel_ind, "omit")) { |
| 691 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 692 | } |
| 693 | return ts_CBSP(CBSP_MSGT_KILL, ies); |
| 694 | } |
Harald Welte | 0833230 | 2019-08-01 09:54:40 +0200 | [diff] [blame] | 695 | function tr_CBSP_KILL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?, |
| 696 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 697 | template uint8_t channel_ind := ?) |
| 698 | return template (present) CBSP_PDU { |
| 699 | var template CBSP_IEs ies := { |
| 700 | tr_CbspMsgId(msg_id), |
| 701 | tr_OldSerNo(old_ser_nr), |
| 702 | tr_CbspCellList(cell_list) |
| 703 | }; |
| 704 | if (not istemplatekind(channel_ind, "omit")) { |
| 705 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 706 | } |
| 707 | return tr_CBSP(CBSP_MSGT_KILL, ies); |
| 708 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 709 | |
| 710 | /* 8.1.3.5 KILL COMPLETE */ |
| 711 | function ts_CBSP_KILL_COMPL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 712 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 713 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 714 | template (omit) uint8_t channel_ind) |
| 715 | return template (value) CBSP_PDU { |
| 716 | var template (value) CBSP_IEs ies := { |
| 717 | ts_CbspMsgId(msg_id), |
| 718 | ts_OldSerNo(old_ser_nr) |
| 719 | }; |
| 720 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 721 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 722 | } |
| 723 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 724 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 725 | } |
| 726 | if (not istemplatekind(channel_ind, "omit")) { |
| 727 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 728 | } |
| 729 | return ts_CBSP(CBSP_MSGT_KILL_COMPL, ies); |
| 730 | } |
| 731 | function tr_CBSP_KILL_COMPL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?, |
| 732 | template CBSP_IE_NumBcastComplList compl_list := ?, |
| 733 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 734 | template uint8_t channel_ind) |
| 735 | return template CBSP_PDU { |
| 736 | var template CBSP_IEs ies := { |
| 737 | tr_CbspMsgId(msg_id), |
| 738 | tr_OldSerNo(old_ser_nr) |
| 739 | }; |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 740 | /* As soon as adding a '*' IE item, lengthof() no longer works on the ies record. So keep track of the |
| 741 | * next index to use separately. */ |
| 742 | var integer next_idx := lengthof(ies); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 743 | if (istemplatekind(compl_list, "*")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 744 | ies[next_idx] := *; |
| 745 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 746 | } else if (not istemplatekind(compl_list, "omit")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 747 | ies[next_idx] := tr_CbspNumComplList(compl_list); |
| 748 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 749 | } |
| 750 | if (istemplatekind(cell_list, "*")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 751 | ies[next_idx] := *; |
| 752 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 753 | } else if (not istemplatekind(cell_list, "omit")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 754 | ies[next_idx] := tr_CbspCellList(cell_list); |
| 755 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 756 | } |
| 757 | if (istemplatekind(channel_ind, "*")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 758 | ies[next_idx] := *; |
| 759 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 760 | } else if (not istemplatekind(channel_ind, "omit")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 761 | ies[next_idx] := tr_CbspChannelInd(channel_ind); |
| 762 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 763 | } |
| 764 | return tr_CBSP(CBSP_MSGT_KILL_COMPL, ies); |
| 765 | } |
| 766 | |
| 767 | /* 8.1.3.6 KILL FAILURE */ |
| 768 | function ts_CBSP_KILL_FAIL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 769 | template (value) CBSP_FailureListItems fail_list, |
| 770 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 771 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 772 | template (omit) uint8_t channel_ind) |
| 773 | return template (value) CBSP_PDU { |
| 774 | var template (value) CBSP_IEs ies := { |
| 775 | ts_CbspMsgId(msg_id), |
| 776 | ts_OldSerNo(old_ser_nr), |
| 777 | ts_CbspFailList(fail_list) |
| 778 | }; |
| 779 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 780 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 781 | } |
| 782 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 783 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 784 | } |
| 785 | if (not istemplatekind(channel_ind, "omit")) { |
| 786 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 787 | } |
| 788 | return ts_CBSP(CBSP_MSGT_KILL_FAIL, ies); |
| 789 | } |
| 790 | function tr_CBSP_KILL_FAIL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?, |
| 791 | template CBSP_FailureListItems fail_list := ?, |
| 792 | template CBSP_IE_NumBcastComplList compl_list := *, |
| 793 | template BSSMAP_FIELD_CellIdentificationList cell_list := *, |
| 794 | template uint8_t channel_ind := *) |
| 795 | return template CBSP_PDU { |
| 796 | var template CBSP_IEs ies := { |
| 797 | tr_CbspMsgId(msg_id), |
| 798 | tr_OldSerNo(old_ser_nr), |
| 799 | tr_CbspFailList(fail_list) |
| 800 | }; |
| 801 | if (istemplatekind(compl_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 802 | //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 803 | } else if (not istemplatekind(compl_list, "omit")) { |
| 804 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 805 | } |
Harald Welte | 885de1c | 2020-04-20 17:50:22 +0200 | [diff] [blame] | 806 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 807 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 808 | } else if (not istemplatekind(cell_list, "omit")) { |
| 809 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 810 | } |
| 811 | if (istemplatekind(channel_ind, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 812 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 813 | //ies[lengthof(ies)] := tr_CbspChannelInd(?) ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 814 | } else if (not istemplatekind(channel_ind, "omit")) { |
| 815 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 816 | } |
| 817 | return tr_CBSP(CBSP_MSGT_KILL_FAIL, ies); |
| 818 | } |
| 819 | |
Harald Welte | 562d28e | 2022-03-28 21:29:04 +0200 | [diff] [blame] | 820 | /* 8.1.3.10 MESSAGE STATUS QUERY */ |
| 821 | template (value) CBSP_PDU |
| 822 | ts_CBSP_MSG_STATUS_QUERY(template (value) uint16_t msg_id, |
| 823 | template (value) uint16_t old_ser_nr, |
| 824 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 825 | template (value) uint8_t channel_ind) := |
| 826 | ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY, { |
| 827 | ts_CbspMsgId(msg_id), |
| 828 | ts_OldSerNo(old_ser_nr), |
| 829 | ts_CbspCellList(cell_list), |
| 830 | ts_CbspChannelInd(channel_ind)}); |
| 831 | template (present) CBSP_PDU |
| 832 | tr_CBSP_MSG_STATUS_QUERY(template (present) uint16_t msg_id := ?, |
| 833 | template (present) uint16_t old_ser_nr := ?, |
| 834 | template (present) BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 835 | template (present) uint8_t channel_ind := ?) := |
| 836 | ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY, { |
| 837 | ts_CbspMsgId(msg_id), |
| 838 | ts_OldSerNo(old_ser_nr), |
| 839 | ts_CbspCellList(cell_list), |
| 840 | ts_CbspChannelInd(channel_ind)}); |
| 841 | |
| 842 | /* 8.1.3.11 MESSAGE STATUS QUERY COMPLETE */ |
| 843 | template (value) CBSP_PDU |
| 844 | ts_CBSP_MSG_STATUS_QUERY_COMPL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 845 | template (value) CBSP_IE_NumBcastComplList compl_list, |
| 846 | template (value) uint8_t channel_ind) := |
| 847 | ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_COMPL, { |
| 848 | ts_CbspMsgId(msg_id), |
| 849 | ts_OldSerNo(old_ser_nr), |
| 850 | ts_CbspNumComplList(valueof(compl_list)), |
| 851 | ts_CbspChannelInd(channel_ind)}); |
| 852 | template (present) CBSP_PDU |
| 853 | tr_CBSP_MSG_STATUS_QUERY_COMPL(template (present) uint16_t msg_id, template (present) uint16_t old_ser_nr, |
| 854 | template (present) CBSP_IE_NumBcastComplList compl_list, |
| 855 | template (present) uint8_t channel_ind) := |
| 856 | tr_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_COMPL, { |
| 857 | tr_CbspMsgId(msg_id), |
| 858 | tr_OldSerNo(old_ser_nr), |
| 859 | tr_CbspNumComplList(compl_list), |
| 860 | tr_CbspChannelInd(channel_ind)}); |
| 861 | |
| 862 | /* 8.1.3.12 MESSAGE STATUS QUERY FAILURE */ |
| 863 | function ts_CBSP_MSG_STATUS_QUERY_FAIL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 864 | template (value) CBSP_FailureListItems fail_list, |
| 865 | template (value) uint8_t channel_ind, |
| 866 | template (omit) CBSP_IE_NumBcastComplList compl_list) |
| 867 | return template (value) CBSP_PDU { |
| 868 | var template (value) CBSP_IEs ies := { |
| 869 | ts_CbspMsgId(msg_id), |
| 870 | ts_OldSerNo(old_ser_nr), |
| 871 | ts_CbspFailList(fail_list), |
| 872 | ts_CbspChannelInd(channel_ind) |
| 873 | }; |
| 874 | if (not istemplatekind(compl_list, "omit")) { |
| 875 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
| 876 | } |
| 877 | return ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_FAIL, ies); |
| 878 | } |
| 879 | function tr_CBSP_MSG_STATUS_QUERY_FAIL(template (present) uint16_t msg_id := ?, template (present) uint16_t old_ser_nr := ?, |
| 880 | template (present) CBSP_FailureListItems fail_list := ?, |
| 881 | template (present) uint8_t channel_ind := ?, |
| 882 | template CBSP_IE_NumBcastComplList compl_list := *) |
| 883 | return template (present) CBSP_PDU { |
| 884 | var template (present) CBSP_IEs ies := { |
| 885 | tr_CbspMsgId(msg_id), |
| 886 | tr_OldSerNo(old_ser_nr), |
| 887 | tr_CbspFailList(fail_list), |
| 888 | tr_CbspChannelInd(channel_ind) |
| 889 | }; |
| 890 | if (istemplatekind(compl_list, "*")) { |
| 891 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 892 | //ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
| 893 | } else if (not istemplatekind(compl_list, "omit")) { |
| 894 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 895 | } |
| 896 | return tr_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_FAIL, ies); |
| 897 | } |
| 898 | |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 899 | |
| 900 | /* 8.1.3.16 RESET */ |
| 901 | template (value) CBSP_PDU ts_CBSP_RESET(template (value) BSSMAP_FIELD_CellIdentificationList cell_list) := |
| 902 | ts_CBSP(CBSP_MSGT_RESET, { |
| 903 | ts_CbspCellList(cell_list) |
| 904 | }); |
| 905 | template CBSP_PDU tr_CBSP_RESET(template BSSMAP_FIELD_CellIdentificationList cell_list := ?) := |
| 906 | tr_CBSP(CBSP_MSGT_RESET, { |
| 907 | tr_CbspCellList(cell_list) |
| 908 | }); |
| 909 | |
| 910 | /* 8.1.3.17 RESET COMPLETE */ |
| 911 | template (value) CBSP_PDU ts_CBSP_RESET_COMPL(template (value) BSSMAP_FIELD_CellIdentificationList cell_list) := |
| 912 | ts_CBSP(CBSP_MSGT_RESET_COMPL, { |
| 913 | ts_CbspCellList(cell_list) |
| 914 | }); |
| 915 | template CBSP_PDU tr_CBSP_RESET_COMPL(template BSSMAP_FIELD_CellIdentificationList cell_list := ?) := |
| 916 | tr_CBSP(CBSP_MSGT_RESET_COMPL, { |
| 917 | tr_CbspCellList(cell_list) |
| 918 | }); |
| 919 | |
| 920 | /* 8.1.3.18 RESET FAILURE */ |
| 921 | template (value) CBSP_PDU ts_CBSP_RESET_FAIL(template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 922 | template (value) CBSP_FailureListItems fail_items) := |
| 923 | ts_CBSP(CBSP_MSGT_RESET_FAIL, { |
| 924 | ts_CbspFailList(fail_items), |
| 925 | ts_CbspCellList(cell_list) |
| 926 | }); |
| 927 | |
| 928 | template CBSP_PDU tr_CBSP_RESET_FAIL(template BSSMAP_FIELD_CellIdentificationList cell_list, |
| 929 | template CBSP_FailureListItems fail_items) := |
| 930 | tr_CBSP(CBSP_MSGT_RESET_FAIL, { |
| 931 | tr_CbspFailList(fail_items), |
| 932 | tr_CbspCellList(cell_list) |
| 933 | }); |
| 934 | |
| 935 | /* 8.1.3.18a KEEP-ALIVE */ |
| 936 | template (value) CBSP_PDU ts_CBSP_KEEP_ALIVE(uint8_t rep_period) := |
| 937 | ts_CBSP(CBSP_MSGT_KEEP_ALIVE, {ts_CbspKARepPeriod(rep_period)}); |
| 938 | template CBSP_PDU tr_CBSP_KEEP_ALIVE(template uint8_t rep_period := ?) := |
| 939 | tr_CBSP(CBSP_MSGT_KEEP_ALIVE, {tr_CbspKARepPeriod(rep_period)}); |
| 940 | |
| 941 | /* 8.1.3.18b KEEP-ALIVE COMPLETE */ |
| 942 | template (value) CBSP_PDU ts_CBSP_KEEP_ALIVE_COMPL := |
| 943 | ts_CBSP(CBSP_MSGT_KEEP_ALIVE_COMPL, {}); |
| 944 | template CBSP_PDU tr_CBSP_KEEP_ALIVE_COMPL := |
| 945 | tr_CBSP(CBSP_MSGT_KEEP_ALIVE_COMPL, {}); |
| 946 | |
| 947 | /* 8.1.3.19 RESTART */ |
| 948 | template (value) CBSP_PDU ts_CBSP_RESTART(template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 949 | template (value) CBSP_BcastMsgType msg_type, |
| 950 | template (value) CBSP_RecoveryInd rec_ind) := |
| 951 | ts_CBSP(CBSP_MSGT_RESTART, { |
| 952 | ts_CbspCellList(cell_list), |
| 953 | ts_CbspBcastMsgType(msg_type), |
| 954 | ts_CbspRecoveryInd(rec_ind) |
| 955 | }); |
| 956 | template CBSP_PDU tr_CBSP_RESTART(template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 957 | template CBSP_BcastMsgType msg_type := ?, |
| 958 | template CBSP_RecoveryInd rec_ind := ?) := |
| 959 | tr_CBSP(CBSP_MSGT_RESTART, { |
| 960 | tr_CbspCellList(cell_list), |
| 961 | tr_CbspBcastMsgType(msg_type), |
| 962 | tr_CbspRecoveryInd(rec_ind) |
| 963 | }); |
| 964 | |
| 965 | /* 8.1.3.20 FAILURE */ |
| 966 | template (value) CBSP_PDU ts_CBSP_FAILURE(template (value) CBSP_FailureListItems fail_list, |
| 967 | template (value) CBSP_BcastMsgType msg_type) := |
| 968 | ts_CBSP(CBSP_MSGT_FAILURE, { |
| 969 | ts_CbspFailList(fail_list), |
| 970 | ts_CbspBcastMsgType(msg_type) |
| 971 | }); |
| 972 | template CBSP_PDU tr_CBSP_FAILURE(template CBSP_FailureListItems fail_list := ?, |
| 973 | template CBSP_BcastMsgType msg_type := ?) := |
| 974 | tr_CBSP(CBSP_MSGT_FAILURE, { |
| 975 | tr_CbspFailList(fail_list), |
| 976 | tr_CbspBcastMsgType(msg_type) |
| 977 | }); |
| 978 | |
| 979 | /* 8.1.3.21 ERROR INDICATION */ |
| 980 | template (value) CBSP_PDU ts_CBSP_ERROR_IND(CBSP_Cause cause) := |
| 981 | ts_CBSP(CBSP_MSGT_ERROR_IND, {ts_CbspCause(cause)}); |
| 982 | template CBSP_PDU tr_CBSP_ERROR_IND(template CBSP_Cause cause) := |
| 983 | tr_CBSP(CBSP_MSGT_ERROR_IND, {tr_CbspCause(cause), *}); |
| 984 | |
| 985 | |
| 986 | function f_cbsp_find_ie(CBSP_PDU msg, CBSP_IEI iei, out CBSP_IE ret) return boolean { |
| 987 | for (var integer i := 0; i < sizeof(msg.ies); i := i+1) { |
| 988 | if (msg.ies[i].iei == iei) { |
| 989 | ret := msg.ies[i]; |
| 990 | return true; |
| 991 | } |
| 992 | } |
| 993 | return false; |
| 994 | } |
| 995 | |
| 996 | |
| 997 | } |