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