blob: 2283e6fe5eaad1cafa36d23d70e6755c6de1a904 [file] [log] [blame]
Harald Welteea260342019-08-01 09:49:38 +02001module CBSP_Templates {
2
3import from Osmocom_Types all;
4import from BSSAP_Types all;
5import 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 :( */
12template (value) CBSP_IE ts_CBSP_IE(CBSP_IEI iei, template (value) CBSP_IE_Body body) := {
13 iei := iei,
14 body := body
15}
16
17template CBSP_IE tr_CBSP_IE(template CBSP_IE_Body body) := {
18 iei := ?,
19 body := body
20}
21
22
23template (value) CBSP_IE ts_CbspMsgId(template (value) uint16_t val) :=
24 ts_CBSP_IE(CBSP_IEI_MSG_ID, {msg_id := val});
25template CBSP_IE tr_CbspMsgId(template uint16_t val := ?) :=
26 tr_CBSP_IE({msg_id := val});
27
28template (value) CBSP_IE ts_NewSerNo(template (value) uint16_t val) :=
29 ts_CBSP_IE(CBSP_IEI_NEW_SERIAL_NR, {new_ser_nr := val});
30template CBSP_IE tr_NewSerNo(template uint16_t val := ?) :=
31 tr_CBSP_IE({new_ser_nr := val});
32
33template (value) CBSP_IE ts_OldSerNo(template (value) uint16_t val) :=
34 ts_CBSP_IE(CBSP_IEI_OLD_SERIAL_NR, {old_ser_nr := val});
35template CBSP_IE tr_OldSerNo(template uint16_t val := ?) :=
36 tr_CBSP_IE({old_ser_nr := val});
37
38template (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});
40template CBSP_IE tr_CbspKARepPeriod(template uint8_t rep_per := ?) :=
41 tr_CBSP_IE({keep_alive_rep_period := rep_per});
42
43function 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}
52function 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, "*")) {
57 ie := tr_CBSP_IE({channel_ind := ?}) ifpresent;
58 } else {
59 ie := tr_CBSP_IE({channel_ind := val});
60 }
61 return ie;
62}
63
64template (value) CBSP_IE ts_CbspCause(template (value) CBSP_Cause c) :=
65 ts_CBSP_IE(CBSP_IEI_CAUSE, {cause := c});
66template CBSP_IE tr_CbspCause(template CBSP_Cause c := ?) :=
67 tr_CBSP_IE({cause := c});
68
69template (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 }});
77template 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
86template (value) CBSP_IE ts_CbspCategory(template (value) CBSP_Category cat) :=
87 ts_CBSP_IE(CBSP_IEI_CATEGORY, {category := cat});
88template CBSP_IE tr_CbspCategory(template CBSP_Category cat := ?) :=
89 tr_CBSP_IE({category := cat});
90
91template (value) CBSP_IE ts_CbspRepetitionPeriod(template (value) uint16_t per) :=
92 ts_CBSP_IE(CBSP_IEI_REP_PERIOD, {rep_period := per});
93template CBSP_IE tr_CbspRepetitionPeriod(template uint16_t per := ?) :=
94 tr_CBSP_IE({rep_period := per});
95
96template (value) CBSP_IE ts_CbspNumBcastReq(template (value) uint16_t num) :=
97 ts_CBSP_IE(CBSP_IEI_NUM_BCAST_REQ, {num_bcast_req := num});
98template CBSP_IE tr_CbspNumBcastReq(template uint16_t num := ?) :=
99 tr_CBSP_IE({num_bcast_req := num});
100
101template (value) CBSP_IE ts_CbspNumPages(template (value) uint8_t num) :=
102 ts_CBSP_IE(CBSP_IEI_NUM_OF_PAGES, {num_of_pages := num});
103template CBSP_IE tr_CbspNumPages(template uint16_t num := ?) :=
104 tr_CBSP_IE({num_of_pages := num});
105
106template (value) CBSP_IE ts_EmergencyInd(template (value) uint8_t val) :=
107 ts_CBSP_IE(CBSP_IEI_EMERG_IND, {emerg_ind := val});
108template CBSP_IE tr_EmergencyInd(template uint8_t val := ?) :=
109 tr_CBSP_IE({emerg_ind := val});
110
111template (value) CBSP_IE ts_WarningType(template (value) uint16_t val) :=
112 ts_CBSP_IE(CBSP_IEI_WARN_TYPE, {warn_type := val});
113template CBSP_IE tr_WarningType(template uint16_t val) :=
114 tr_CBSP_IE({warn_type := val});
115
116template (value) CBSP_IE ts_WarnSecInfo(template (value) octetstring payl := ''O) :=
117 ts_CBSP_IE(CBSP_IEI_WARN_SEC_INFO, {warn_sec_info := payl});
118template CBSP_IE tr_WarnSecInfo(template octetstring payl := ?) :=
119 tr_CBSP_IE({warn_sec_info := payl});
120
121template (value) CBSP_IE ts_WarningPeriod(template (value) uint8_t val) :=
122 ts_CBSP_IE(CBSP_IEI_WARNING_PERIOD, {warning_period := val});
123template CBSP_IE tr_WarningPeriod(template uint8_t val := ?) :=
124 tr_CBSP_IE({warning_period := val});
125
126template (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 }});
131template CBSP_IE tr_CbspFailList(template CBSP_FailureListItems items := ?) :=
132 tr_CBSP_IE({failure_list := {
Harald Welte09538f82019-08-01 09:50:25 +0200133 len := ?,
Harald Welteea260342019-08-01 09:49:38 +0200134 list := items
135 }});
136
137template (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});
139template CBSP_IE tr_CbspNumComplList(template CBSP_IE_NumBcastComplList list := ?) :=
140 tr_CBSP_IE({num_bcast_compl_list := list});
141
142template (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 }});
147template CBSP_IE tr_CbspBcastMsgType(template CBSP_BcastMsgType bi := ?) :=
148 tr_CBSP_IE({bcast_msg_type := {
149 spare1_4 := ?,
150 msg_type := bi
151 }});
152
153template (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 }});
158template CBSP_IE tr_CbspRecoveryInd(template CBSP_RecoveryInd ri) :=
159 tr_CBSP_IE({recovery_ind := {
160 spare1_4 := ?,
161 recovery := ri
162 }});
163
164template (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 }});
169template 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
175template (value) CBSP_IE ts_CbspDCS(template (value) uint8_t dcs) :=
176 ts_CBSP_IE(CBSP_IEI_DCS, {dcs := dcs});
177template CBSP_IE tr_CbspDCS(template uint8_t dcs := ?) :=
178 tr_CBSP_IE({dcs := dcs});
179
180
181template (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}
186template 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 */
195function 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}
217template 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
238function 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}
260template 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
282template (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,
286 template (value) uint16_t num_bcast_req,
287 template (value) uint8_t warn_per
288 ) :=
289 ts_CBSP(CBSP_MSGT_WRITE_REPLACE, {
290 ts_CbspMsgId(msg_id),
291 ts_NewSerNo(new_ser_nr),
292 ts_CbspCellList(cell_list),
293 ts_EmergencyInd(emerg_ind),
294 ts_WarningType(warn_type),
295 ts_WarnSecInfo,
296 ts_WarningPeriod(warn_per) });
297template CBSP_PDU tr_CBSP_WRITE_EMERG(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?,
298 template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
299 template uint8_t emerg_ind := ?,
300 template uint16_t warn_type := ?,
301 template uint16_t num_bcast_req := ?,
302 template uint8_t warn_per := ?
303 ) :=
304 tr_CBSP(CBSP_MSGT_WRITE_REPLACE, {
305 tr_CbspMsgId(msg_id),
306 tr_NewSerNo(new_ser_nr),
307 tr_CbspCellList(cell_list),
308 tr_EmergencyInd(emerg_ind),
309 tr_WarningType(warn_type),
310 tr_WarnSecInfo,
311 tr_WarningPeriod(warn_per) });
312
313
314template (value) CBSP_PDU ts_CBSP_REPLACE_EMERG(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr,
315 template (value) BSSMAP_FIELD_CellIdentificationList cell_list,
316 template (value) uint8_t emerg_ind,
317 template (value) uint16_t warn_type,
318 template (value) uint16_t num_bcast_req,
319 template (value) uint8_t warn_per
320 ) :=
321 ts_CBSP(CBSP_MSGT_WRITE_REPLACE, {
322 ts_CbspMsgId(msg_id),
323 ts_NewSerNo(new_ser_nr),
324 ts_OldSerNo(old_ser_nr),
325 ts_CbspCellList(cell_list),
326 ts_EmergencyInd(emerg_ind),
327 ts_WarningType(warn_type),
328 ts_WarnSecInfo,
329 ts_WarningPeriod(warn_per) });
330template CBSP_PDU tr_CBSP_REPLACE_EMERG(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?,
331 template uint16_t old_ser_nr := ?,
332 template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
333 template uint8_t emerg_ind := ?,
334 template uint16_t warn_type := ?,
335 template uint16_t num_bcast_req := ?,
336 template uint8_t warn_per := ?
337 ) :=
338 tr_CBSP(CBSP_MSGT_WRITE_REPLACE, {
339 tr_CbspMsgId(msg_id),
340 tr_NewSerNo(new_ser_nr),
341 tr_OldSerNo(old_ser_nr),
342 tr_CbspCellList(cell_list),
343 tr_EmergencyInd(emerg_ind),
344 tr_WarningType(warn_type),
345 tr_WarnSecInfo,
346 tr_WarningPeriod(warn_per) });
347
348/* 8.1.3.2 WRITE-REPLACE COMPLETE */
349function ts_CBSP_WRITE_CBS_COMPL(uint16_t msg_id, uint16_t new_ser_nr,
350 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
351 template (value) uint8_t channel_ind)
352return template (value) CBSP_PDU {
353 var template (value) CBSP_IEs ies := {
354 ts_CbspMsgId(msg_id),
355 ts_NewSerNo(new_ser_nr)
356 };
357 if (not istemplatekind(cell_list, "omit")) {
358 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
359 }
360 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
361 return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
362}
363function tr_CBSP_WRITE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr,
364 template BSSMAP_FIELD_CellIdentificationList cell_list,
365 template uint8_t channel_ind)
366return template CBSP_PDU {
367 var template CBSP_IEs ies := {
368 tr_CbspMsgId(msg_id),
369 tr_NewSerNo(new_ser_nr)
370 };
371 if (istemplatekind(cell_list, "*")) {
372 ies[lengthof(ies)] := tr_CbspCellList ifpresent;
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 }
378 ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
379 return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
380}
381
382
383function ts_CBSP_REPLACE_CBS_COMPL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr,
384 template (value) CBSP_IE_NumBcastComplList compl_list,
385 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
386 template (value) uint8_t channel_ind)
387return template (value) CBSP_PDU {
388 var template (value) CBSP_IEs ies := {
389 ts_CbspMsgId(msg_id),
390 ts_NewSerNo(new_ser_nr),
391 ts_OldSerNo(old_ser_nr),
392 ts_CbspNumComplList(compl_list)
393 };
394 if (not istemplatekind(cell_list, "omit")) {
395 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
396 }
397 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
398 return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
399}
400function tr_CBSP_REPLACE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr,
401 template uint16_t old_ser_nr,
402 template CBSP_IE_NumBcastComplList compl_list,
403 template BSSMAP_FIELD_CellIdentificationList cell_list,
404 template uint8_t channel_ind)
405return template CBSP_PDU {
406 var template CBSP_IEs ies := {
407 tr_CbspMsgId(msg_id),
408 tr_NewSerNo(new_ser_nr),
409 tr_OldSerNo(old_ser_nr),
410 tr_CbspNumComplList(compl_list)
411 };
412 if (istemplatekind(cell_list, "*")) {
413 ies[lengthof(ies)] := tr_CbspCellList ifpresent;
414 } else if (istemplatekind(cell_list, "?")) {
415 ies[lengthof(ies)] := tr_CbspCellList(?);
416 } else if (not istemplatekind(cell_list, "omit")) {
417 ies[lengthof(ies)] := tr_CbspCellList(cell_list);
418 }
419 ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
420 return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
421}
422
423
424/* 8.1.3.3 WRITE-REPLACE FAILURE */
425function ts_CBSP_WRITE_CBS_FAIL(uint16_t msg_id, uint16_t new_ser_nr,
426 template (value) CBSP_FailureListItems fail_list,
427 template (omit) CBSP_IE_NumBcastComplList compl_list,
428 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
429 template (value) uint8_t channel_ind)
430return template (value) CBSP_PDU {
431 var template (value) CBSP_IEs ies := {
432 ts_CbspMsgId(msg_id),
433 ts_NewSerNo(new_ser_nr),
434 ts_CbspFailList(fail_list)
435 };
436 if (not istemplatekind(compl_list, "omit")) {
437 ies[lengthof(ies)] := ts_CbspNumComplList(compl_list);
438 }
439 if (not istemplatekind(cell_list, "omit")) {
440 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
441 }
442 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
443 return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies);
444}
445function tr_CBSP_WRITE_CBS_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr,
446 template CBSP_FailureListItems fail_list,
447 template CBSP_IE_NumBcastComplList compl_list,
448 template BSSMAP_FIELD_CellIdentificationList cell_list,
449 template uint8_t channel_ind)
450return template CBSP_PDU {
451 var template CBSP_IEs ies := {
452 tr_CbspMsgId(msg_id),
453 tr_NewSerNo(new_ser_nr),
454 tr_CbspFailList(fail_list)
455 };
456 if (istemplatekind(compl_list, "*")) {
Harald Welteb5223232019-09-05 11:13:56 +0200457 //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200458 } else if (istemplatekind(compl_list, "?")) {
459 ies[lengthof(ies)] := tr_CbspNumComplList(?);
460 } else if (not istemplatekind(compl_list, "omit")) {
461 ies[lengthof(ies)] := tr_CbspNumComplList(compl_list);
462 }
463 if (istemplatekind(cell_list, "*")) {
464 ies[lengthof(ies)] := tr_CbspCellList ifpresent;
465 } else if (istemplatekind(cell_list, "?")) {
466 ies[lengthof(ies)] := tr_CbspCellList(?);
467 } else if (not istemplatekind(cell_list, "omit")) {
468 ies[lengthof(ies)] := tr_CbspCellList(cell_list);
469 }
470 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
471 return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies);
472}
473
474
475function ts_CBSP_REPLACE_CBS_FAIL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr,
476 template (value) CBSP_FailureListItems fail_list,
477 template (omit) CBSP_IE_NumBcastComplList compl_list,
478 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
479 template (value) uint8_t channel_ind)
480return template (value) CBSP_PDU {
481 var template (value) CBSP_IEs ies := {
482 ts_CbspMsgId(msg_id),
483 ts_NewSerNo(new_ser_nr),
484 ts_OldSerNo(old_ser_nr),
485 ts_CbspFailList(fail_list)
486 };
487 if (not istemplatekind(compl_list, "omit")) {
488 ies[lengthof(ies)] := ts_CbspNumComplList(compl_list);
489 }
490 if (not istemplatekind(cell_list, "omit")) {
491 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
492 }
493 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
494 return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies);
495}
496function tr_CBSP_REPLACE_CBS_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr,
497 template uint16_t old_ser_nr,
498 template CBSP_FailureListItems fail_list,
499 template CBSP_IE_NumBcastComplList compl_list,
500 template BSSMAP_FIELD_CellIdentificationList cell_list,
501 template uint8_t channel_ind)
502return template CBSP_PDU {
503 var template CBSP_IEs ies := {
504 tr_CbspMsgId(msg_id),
505 tr_NewSerNo(new_ser_nr),
506 tr_OldSerNo(old_ser_nr),
507 tr_CbspFailList(fail_list)
508 };
509 if (istemplatekind(compl_list, "*")) {
Harald Welteb5223232019-09-05 11:13:56 +0200510 //ies[lengthof(ies)] := tr_CbspCellList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200511 } else if (istemplatekind(compl_list, "?")) {
512 ies[lengthof(ies)] := tr_CbspNumComplList(?);
513 } else if (not istemplatekind(compl_list, "omit")) {
514 ies[lengthof(ies)] := tr_CbspNumComplList(compl_list);
515 }
516 if (istemplatekind(cell_list, "*")) {
Harald Welteb5223232019-09-05 11:13:56 +0200517 //ies[lengthof(ies)] := tr_CbspCellList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200518 } else if (istemplatekind(cell_list, "?")) {
519 ies[lengthof(ies)] := tr_CbspCellList(?);
520 } else if (not istemplatekind(cell_list, "omit")) {
521 ies[lengthof(ies)] := tr_CbspCellList(cell_list);
522 }
523 ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
524 return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies);
525}
526
527/* 8.1.3.4 KILL */
528template (value) CBSP_PDU ts_CBSP_KILL(template (value) uint16_t msg_id,
529 template (value) uint16_t old_ser_nr,
530 template (value) BSSMAP_FIELD_CellIdentificationList cell_list,
531 template (omit) uint8_t channel_ind) :=
532 ts_CBSP(CBSP_MSGT_KILL, {
533 ts_CbspMsgId(msg_id),
534 ts_OldSerNo(old_ser_nr),
535 ts_CbspCellList(cell_list),
536 ts_CbspChannelInd(channel_ind)});
537template CBSP_PDU tr_CBSP_KILL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?,
538 template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
539 template uint8_t channel_ind := ?) :=
540 tr_CBSP(CBSP_MSGT_KILL, {
541 tr_CbspMsgId(msg_id),
542 tr_OldSerNo(old_ser_nr),
543 tr_CbspCellList(cell_list),
544 tr_CbspChannelInd(channel_ind) });
545
546/* 8.1.3.5 KILL COMPLETE */
547function ts_CBSP_KILL_COMPL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr,
548 template (omit) CBSP_IE_NumBcastComplList compl_list,
549 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
550 template (omit) uint8_t channel_ind)
551return template (value) CBSP_PDU {
552 var template (value) CBSP_IEs ies := {
553 ts_CbspMsgId(msg_id),
554 ts_OldSerNo(old_ser_nr)
555 };
556 if (not istemplatekind(compl_list, "omit")) {
557 ies[lengthof(ies)] := ts_CbspNumComplList(compl_list);
558 }
559 if (not istemplatekind(cell_list, "omit")) {
560 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
561 }
562 if (not istemplatekind(channel_ind, "omit")) {
563 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
564 }
565 return ts_CBSP(CBSP_MSGT_KILL_COMPL, ies);
566}
567function tr_CBSP_KILL_COMPL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?,
568 template CBSP_IE_NumBcastComplList compl_list := ?,
569 template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
570 template uint8_t channel_ind)
571return template CBSP_PDU {
572 var template CBSP_IEs ies := {
573 tr_CbspMsgId(msg_id),
574 tr_OldSerNo(old_ser_nr)
575 };
576 if (istemplatekind(compl_list, "*")) {
577 ies[lengthof(ies)] := *;
578 } else if (not istemplatekind(compl_list, "omit")) {
579 ies[lengthof(ies)] := tr_CbspNumComplList(compl_list);
580 }
581 if (istemplatekind(cell_list, "*")) {
582 ies[lengthof(ies)] := *;
583 } else if (not istemplatekind(cell_list, "omit")) {
584 ies[lengthof(ies)] := tr_CbspCellList(cell_list);
585 }
586 if (istemplatekind(channel_ind, "*")) {
587 ies[lengthof(ies)] := *;
588 } else if (not istemplatekind(channel_ind, "omit")) {
589 ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
590 }
591 return tr_CBSP(CBSP_MSGT_KILL_COMPL, ies);
592}
593
594/* 8.1.3.6 KILL FAILURE */
595function ts_CBSP_KILL_FAIL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr,
596 template (value) CBSP_FailureListItems fail_list,
597 template (omit) CBSP_IE_NumBcastComplList compl_list,
598 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
599 template (omit) uint8_t channel_ind)
600return template (value) CBSP_PDU {
601 var template (value) CBSP_IEs ies := {
602 ts_CbspMsgId(msg_id),
603 ts_OldSerNo(old_ser_nr),
604 ts_CbspFailList(fail_list)
605 };
606 if (not istemplatekind(compl_list, "omit")) {
607 ies[lengthof(ies)] := ts_CbspNumComplList(compl_list);
608 }
609 if (not istemplatekind(cell_list, "omit")) {
610 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
611 }
612 if (not istemplatekind(channel_ind, "omit")) {
613 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
614 }
615 return ts_CBSP(CBSP_MSGT_KILL_FAIL, ies);
616}
617function tr_CBSP_KILL_FAIL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?,
618 template CBSP_FailureListItems fail_list := ?,
619 template CBSP_IE_NumBcastComplList compl_list := *,
620 template BSSMAP_FIELD_CellIdentificationList cell_list := *,
621 template uint8_t channel_ind := *)
622return template CBSP_PDU {
623 var template CBSP_IEs ies := {
624 tr_CbspMsgId(msg_id),
625 tr_OldSerNo(old_ser_nr),
626 tr_CbspFailList(fail_list)
627 };
628 if (istemplatekind(compl_list, "*")) {
Harald Welteb5223232019-09-05 11:13:56 +0200629 //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200630 } else if (not istemplatekind(compl_list, "omit")) {
631 ies[lengthof(ies)] := tr_CbspNumComplList(compl_list);
632 }
633 if (istemplatekind(compl_list, "*")) {
Harald Welteb5223232019-09-05 11:13:56 +0200634 //ies[lengthof(ies)] := tr_CbspCellList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200635 } else if (not istemplatekind(cell_list, "omit")) {
636 ies[lengthof(ies)] := tr_CbspCellList(cell_list);
637 }
638 if (istemplatekind(channel_ind, "*")) {
639 ies[lengthof(ies)] := tr_CbspChannelInd(?) ifpresent;
640 } else if (not istemplatekind(channel_ind, "omit")) {
641 ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
642 }
643 return tr_CBSP(CBSP_MSGT_KILL_FAIL, ies);
644}
645
646
647/* 8.1.3.16 RESET */
648template (value) CBSP_PDU ts_CBSP_RESET(template (value) BSSMAP_FIELD_CellIdentificationList cell_list) :=
649 ts_CBSP(CBSP_MSGT_RESET, {
650 ts_CbspCellList(cell_list)
651 });
652template CBSP_PDU tr_CBSP_RESET(template BSSMAP_FIELD_CellIdentificationList cell_list := ?) :=
653 tr_CBSP(CBSP_MSGT_RESET, {
654 tr_CbspCellList(cell_list)
655 });
656
657/* 8.1.3.17 RESET COMPLETE */
658template (value) CBSP_PDU ts_CBSP_RESET_COMPL(template (value) BSSMAP_FIELD_CellIdentificationList cell_list) :=
659 ts_CBSP(CBSP_MSGT_RESET_COMPL, {
660 ts_CbspCellList(cell_list)
661 });
662template CBSP_PDU tr_CBSP_RESET_COMPL(template BSSMAP_FIELD_CellIdentificationList cell_list := ?) :=
663 tr_CBSP(CBSP_MSGT_RESET_COMPL, {
664 tr_CbspCellList(cell_list)
665 });
666
667/* 8.1.3.18 RESET FAILURE */
668template (value) CBSP_PDU ts_CBSP_RESET_FAIL(template (value) BSSMAP_FIELD_CellIdentificationList cell_list,
669 template (value) CBSP_FailureListItems fail_items) :=
670 ts_CBSP(CBSP_MSGT_RESET_FAIL, {
671 ts_CbspFailList(fail_items),
672 ts_CbspCellList(cell_list)
673 });
674
675template CBSP_PDU tr_CBSP_RESET_FAIL(template BSSMAP_FIELD_CellIdentificationList cell_list,
676 template CBSP_FailureListItems fail_items) :=
677 tr_CBSP(CBSP_MSGT_RESET_FAIL, {
678 tr_CbspFailList(fail_items),
679 tr_CbspCellList(cell_list)
680 });
681
682/* 8.1.3.18a KEEP-ALIVE */
683template (value) CBSP_PDU ts_CBSP_KEEP_ALIVE(uint8_t rep_period) :=
684 ts_CBSP(CBSP_MSGT_KEEP_ALIVE, {ts_CbspKARepPeriod(rep_period)});
685template CBSP_PDU tr_CBSP_KEEP_ALIVE(template uint8_t rep_period := ?) :=
686 tr_CBSP(CBSP_MSGT_KEEP_ALIVE, {tr_CbspKARepPeriod(rep_period)});
687
688/* 8.1.3.18b KEEP-ALIVE COMPLETE */
689template (value) CBSP_PDU ts_CBSP_KEEP_ALIVE_COMPL :=
690 ts_CBSP(CBSP_MSGT_KEEP_ALIVE_COMPL, {});
691template CBSP_PDU tr_CBSP_KEEP_ALIVE_COMPL :=
692 tr_CBSP(CBSP_MSGT_KEEP_ALIVE_COMPL, {});
693
694/* 8.1.3.19 RESTART */
695template (value) CBSP_PDU ts_CBSP_RESTART(template (value) BSSMAP_FIELD_CellIdentificationList cell_list,
696 template (value) CBSP_BcastMsgType msg_type,
697 template (value) CBSP_RecoveryInd rec_ind) :=
698 ts_CBSP(CBSP_MSGT_RESTART, {
699 ts_CbspCellList(cell_list),
700 ts_CbspBcastMsgType(msg_type),
701 ts_CbspRecoveryInd(rec_ind)
702 });
703template CBSP_PDU tr_CBSP_RESTART(template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
704 template CBSP_BcastMsgType msg_type := ?,
705 template CBSP_RecoveryInd rec_ind := ?) :=
706 tr_CBSP(CBSP_MSGT_RESTART, {
707 tr_CbspCellList(cell_list),
708 tr_CbspBcastMsgType(msg_type),
709 tr_CbspRecoveryInd(rec_ind)
710 });
711
712/* 8.1.3.20 FAILURE */
713template (value) CBSP_PDU ts_CBSP_FAILURE(template (value) CBSP_FailureListItems fail_list,
714 template (value) CBSP_BcastMsgType msg_type) :=
715 ts_CBSP(CBSP_MSGT_FAILURE, {
716 ts_CbspFailList(fail_list),
717 ts_CbspBcastMsgType(msg_type)
718 });
719template CBSP_PDU tr_CBSP_FAILURE(template CBSP_FailureListItems fail_list := ?,
720 template CBSP_BcastMsgType msg_type := ?) :=
721 tr_CBSP(CBSP_MSGT_FAILURE, {
722 tr_CbspFailList(fail_list),
723 tr_CbspBcastMsgType(msg_type)
724 });
725
726/* 8.1.3.21 ERROR INDICATION */
727template (value) CBSP_PDU ts_CBSP_ERROR_IND(CBSP_Cause cause) :=
728 ts_CBSP(CBSP_MSGT_ERROR_IND, {ts_CbspCause(cause)});
729template CBSP_PDU tr_CBSP_ERROR_IND(template CBSP_Cause cause) :=
730 tr_CBSP(CBSP_MSGT_ERROR_IND, {tr_CbspCause(cause), *});
731
732
733function f_cbsp_find_ie(CBSP_PDU msg, CBSP_IEI iei, out CBSP_IE ret) return boolean {
734 for (var integer i := 0; i < sizeof(msg.ies); i := i+1) {
735 if (msg.ies[i].iei == iei) {
736 ret := msg.ies[i];
737 return true;
738 }
739 }
740 return false;
741}
742
743
744}