blob: d6e0867ed431521961e0a1b7b7f76824176b7f6b [file] [log] [blame]
Harald Welte34b5a952019-05-27 11:54:11 +02001/* Osmocom PCU Interface Types, as per osmo-pcu/include/osmocom/pcu/pcuif_proto.h
2 * (C) 2018-2019 Harald Welte <laforge@gnumonks.org>
3 * contributions by Vadim Yanitskiy <axilirator@gmail.com>
4 * All rights reserved.
5 *
6 * Released under the terms of GNU General Public License, Version 2 or
7 * (at your option) any later version.
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
Harald Welte883340c2018-02-28 18:59:29 +010012module PCUIF_Types {
13
14import from General_Types all;
15import from Osmocom_Types all;
Alexander Couzens1e5dc482020-07-28 15:38:46 +020016import from Native_Functions all;
Harald Welte883340c2018-02-28 18:59:29 +010017
Vadim Yanitskiyc1559302020-07-19 16:39:12 +070018modulepar {
19 /* PCUIF version supported by the IUT */
Vadim Yanitskiybefa21c2020-09-22 00:53:16 +070020 PCUIF_Version mp_pcuif_version := 10;
Vadim Yanitskiy220fa202020-09-15 19:15:01 +070021 /* Whether to pad outgoing messages */
22 boolean mp_pcuif_padding := true;
Vadim Yanitskiyc1559302020-07-19 16:39:12 +070023};
24
Harald Welte883340c2018-02-28 18:59:29 +010025const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts";
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +070026type integer PCUIF_Version (9..10); /* supported versions */
Harald Welte883340c2018-02-28 18:59:29 +010027
28type enumerated PCUIF_MsgType {
29 PCU_IF_MSG_DATA_REQ ('00'O),
30 PCU_IF_MSG_DATA_CNF ('01'O),
31 PCU_IF_MSG_DATA_IND ('02'O),
32 PCU_IF_MSG_SUSP_REQ ('03'O),
Harald Welte11b734c2019-09-05 14:17:54 +020033 PCU_IF_MSG_APP_INFO_REQ ('04'O),
Harald Welte883340c2018-02-28 18:59:29 +010034 PCU_IF_MSG_RTS_REQ ('10'O),
35 PCU_IF_MSG_DATA_CNF_DT ('11'O),
36 PCU_IF_MSG_RACH_IND ('22'O),
37 PCU_IF_MSG_INFO_IND ('32'O),
38 PCU_IF_MSG_ACT_REQ ('40'O),
39 PCU_IF_MSG_TIME_IND ('52'O),
40 PCU_IF_MSG_PAG_REQ ('60'O),
41 PCU_IF_MSG_TXT_IND ('70'O)
42} with { variant "FIELDLENGTH(8)" };
43
44type enumerated PCUIF_Sapi {
45 PCU_IF_SAPI_UNKNOWN ('00'O),
46 PCU_IF_SAPI_RACH ('01'O),
47 PCU_IF_SAPI_AGCH ('02'O),
48 PCU_IF_SAPI_PCH ('03'O),
49 PCU_IF_SAPI_BCCH ('04'O),
50 PCU_IF_SAPI_PDTCH ('05'O),
51 PCU_IF_SAPI_PRACH ('06'O),
52 PCU_IF_SAPI_PTCCH ('07'O),
53 PCU_IF_SAPI_AGCH_DT ('08'O)
54} with { variant "FIELDLENGTH(8)" };
55
56type record PCUIF_Flags {
57 boolean bts_active,
58 boolean sysmo_direct_dsp,
59 BIT14 spare,
60 boolean cs1,
61 boolean cs2,
62 boolean cs3,
63 boolean cs4,
64 boolean mcs1,
65 boolean mcs2,
66 boolean mcs3,
67 boolean mcs4,
68 boolean mcs5,
69 boolean mcs6,
70 boolean mcs7,
71 boolean mcs8,
72 boolean mcs9,
73 BIT3 spare2
74} with { variant "" };
75
76type enumerated PCUIF_TextType {
77 PCU_VERSION (0),
78 PCU_OML_ALERT (1)
79} with { variant "FIELDLENGTH(8)" };
80
Vadim Yanitskiye1527f72019-09-09 02:15:33 +020081type charstring PCUIF_Text length(128) with { variant "FIELDLENGTH(null_terminated)" };
Harald Welte883340c2018-02-28 18:59:29 +010082
83type record PCUIF_txt_ind {
84 PCUIF_TextType txt_type,
85 PCUIF_Text text
86} with { variant "" };
87
Harald Welte883340c2018-02-28 18:59:29 +010088type record PCUIF_data {
89 PCUIF_Sapi sapi,
90 uint8_t len,
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +020091 octetstring data length(162),
Harald Welte883340c2018-02-28 18:59:29 +010092 uint32_t fn,
93 uint16_t arfcn,
94 uint8_t trx_nr,
95 uint8_t ts_nr,
96 uint8_t block_nr,
97 int8_t rssi,
98 uint16_t ber10k,
99 int16_t ta_offs_qbits,
100 int16_t lqual_cb
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +0200101} with { variant (data) "FIELDLENGTH(162), ALIGN(left)" };
Harald Welte883340c2018-02-28 18:59:29 +0100102
103type record PCUIF_data_cnf_dt {
104 PCUIF_Sapi sapi,
105 OCT4 tlli,
106 uint32_t fn,
107 uint16_t arfcn,
108 uint8_t trx_nr,
109 uint8_t ts_nr,
110 uint8_t block_nr,
111 int8_t rssi,
112 uint16_t ber10k,
113 int16_t ta_offs_qbits,
114 int16_t lqual_cb
115} with { variant "" };
116
117type record PCUIF_rts_req {
118 PCUIF_Sapi sapi,
119 OCT3 spare,
120 uint32_t fn,
121 uint16_t arfcn,
122 uint8_t trx_nr,
123 uint8_t ts_nr,
124 uint8_t block_nr
125} with { variant "" };
126
Harald Welte913bbf62019-03-01 00:39:19 +0100127type enumerated PCUIF_BurstType {
128 BURST_TYPE_NONE (0),
129 BURST_TYPE_0 (1),
130 BURST_TYPE_1 (2),
131 BURST_TYPE_2 (3)
132} with { variant "FIELDLENGTH(8)" };
133
Harald Welte883340c2018-02-28 18:59:29 +0100134type record PCUIF_rach_ind {
135 PCUIF_Sapi sapi,
136 uint16_t ra,
137 int16_t qta,
138 uint32_t fn,
139 uint16_t arfcn,
140 uint8_t is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700141 PCUIF_BurstType burst_type,
142 uint8_t trx_nr,
143 uint8_t ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100144} with { variant "" };
145
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700146type record PCUIF_InfoTrxTs {
147 uint8_t tsc,
148 uint8_t hopping,
149 uint8_t hsn,
150 uint8_t maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700151 uint8_t ma_bit_len,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700152 bitstring ma length(64)
153} with { variant (ma) "BYTEORDER(first), BITORDER(msb)" };
154private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList;
155
156/* Version >= 10 specific coding */
157private type record PCUIF_InfoV10Trx {
158 uint16_t arfcn,
159 BIT8 pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700160 OCT1 spare,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700161 uint32_t hLayer1,
162 PCUIF_InfoTrxTsList ts
163} with { variant (pdch_mask) "BITORDER(msb)" };
164private type record length(8) of PCUIF_InfoV10Trx PCUIF_InfoV10TrxList;
165
166/* Version <= 9 specific coding */
167private type record PCUIF_InfoV09Trx {
Harald Welte883340c2018-02-28 18:59:29 +0100168 uint16_t arfcn,
169 BIT8 pdch_mask,
170 OCT1 spare,
171 OCT8 tsc,
172 uint32_t hLayer1
Harald Weltef1486592018-04-04 19:26:41 +0200173} with { variant (pdch_mask) "BITORDER(msb)" };
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700174private type record length(8) of PCUIF_InfoV09Trx PCUIF_InfoV09TrxList;
175
176type union PCUIF_InfoTrxs {
177 PCUIF_InfoV09TrxList v09,
178 PCUIF_InfoV10TrxList v10
179} with { variant "" };
Harald Welte883340c2018-02-28 18:59:29 +0100180
181type record PCUIF_info_ind {
182 uint32_t version,
183 PCUIF_Flags flags,
Harald Weltee1fd9162019-02-18 19:47:53 +0100184 PCUIF_InfoTrxs trx,
Harald Welte883340c2018-02-28 18:59:29 +0100185 uint8_t bsic,
186
187 uint16_t mcc,
188 uint16_t mnc,
Harald Welte3568dc72018-03-13 17:06:51 +0100189 uint8_t mnc_3_digits,
Harald Welte883340c2018-02-28 18:59:29 +0100190 uint16_t lac,
191 uint16_t rac,
192
193 uint16_t nsei,
194 record length(7) of uint8_t nse_timer,
195 record length(11) of uint8_t cell_timer,
196
197 uint16_t cell_id,
198 uint16_t repeat_time,
199 uint8_t repeat_count,
200 uint16_t bvci,
201 uint8_t t3142,
202 uint8_t t3169,
203 uint8_t t3191,
204 uint8_t t3193_10ms,
205 uint8_t t3195,
206 uint8_t t3101,
207 uint8_t t3103,
208 uint8_t t3105,
209 uint8_t cv_countdown,
210 uint16_t dl_tbf_ext,
211 uint16_t ul_tbf_ext,
212 uint8_t initial_cs,
213 uint8_t initial_mcs,
214
215 record length(2) of uint16_t nsvci,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700216 record length(2) of uint16_t local_port,
Harald Welte883340c2018-02-28 18:59:29 +0100217 record length(2) of uint16_t remote_port,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200218 PCUIF_RemoteAddr remote_addr
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700219} with {
220 /* NOTE: TITAN is not smart enough to handle 'version < 10' and 'version > 9',
221 * so we cannot support more than two versions at the same time here. Sigh. */
222 variant (trx) "CROSSTAG(v09, version = 9; v10, version = 10)"
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200223 variant (remote_addr) "CROSSTAG(v09, version = 9; v10, version = 10)"
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700224};
Harald Welte883340c2018-02-28 18:59:29 +0100225
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200226type union PCUIF_RemoteAddr {
227 PCUIF_RemoteAddrV09 v09,
228 PCUIF_RemoteAddrV10 v10
229} with { variant "" };
230
231type record PCUIF_RemoteAddrV09 {
232 record length(2) of OCT4 addr
233} with { variant "" };
234
235type enumerated PCUIF_AddrType {
236 PCUIF_ADDR_TYPE_UNSPEC ('00'O),
237 PCUIF_ADDR_TYPE_IPV4 ('04'O),
238 PCUIF_ADDR_TYPE_IPV6 ('29'O)
239} with { variant "FIELDLENGTH(8)" };
240
241type record PCUIF_RemoteAddrV10 {
242 record length(2) of PCUIF_AddrType addr_type,
243 record length(2) of octetstring addr length(16)
244} with { variant "" };
245
Harald Welte883340c2018-02-28 18:59:29 +0100246type record PCUIF_act_req {
247 uint8_t is_activate,
248 uint8_t trx_nr,
249 uint8_t ts_nr,
250 OCT1 spare
251} with { variant "" };
252
253type record PCUIF_time_ind {
254 uint32_t fn
255} with { variant "" };
256
257type record PCUIF_pag_req {
258 PCUIF_Sapi sapi,
259 uint8_t chan_needed,
260 OCT9 identity_lv
261} with { variant "" };
262
Harald Welte11b734c2019-09-05 14:17:54 +0200263type record PCUIF_app_info_req {
264 uint8_t application_type,
265 uint8_t len,
266 octetstring data
267} with {
268 variant (len) "LENGTHTO(data)"
269}
270
Harald Welte883340c2018-02-28 18:59:29 +0100271type record PCUIF_susp_req {
272 OCT4 tlli,
273 OCT6 ra_id,
274 uint8_t cause
Harald Welteeaa9a862019-05-26 23:01:08 +0200275} with {
276 variant (tlli) "BYTEORDER(last)"
277};
Harald Welte883340c2018-02-28 18:59:29 +0100278
279
280type union PCUIF_MsgUnion {
281 PCUIF_data data_req,
282 PCUIF_data data_cnf,
283 PCUIF_data_cnf_dt data_cnf_dt,
284 PCUIF_data data_ind,
285 PCUIF_susp_req susp_req,
286 PCUIF_rts_req rts_req,
287 PCUIF_rach_ind rach_ind,
288 PCUIF_txt_ind txt_ind,
289 PCUIF_info_ind info_ind,
290 PCUIF_act_req act_req,
291 PCUIF_time_ind time_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200292 PCUIF_pag_req pag_req,
293 PCUIF_app_info_req app_info_req
Harald Welte883340c2018-02-28 18:59:29 +0100294} with { variant "" };
295
296type record PCUIF_Message {
297 PCUIF_MsgType msg_type,
298 uint8_t bts_nr,
299 OCT2 spare,
300 PCUIF_MsgUnion u
301} with { variant (u) "CROSSTAG(
302 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
303 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
304 data_cnf_dt, msg_type = PCU_IF_MSG_DATA_CNF_DT;
305 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
306 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
307 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
308 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
309 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
310 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
311 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
312 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200313 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
314 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ)"
Harald Welte883340c2018-02-28 18:59:29 +0100315};
316
317external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
318 with { extension "prototype(convert) encode(RAW)" };
319external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
320 with { extension "prototype(convert) decode(RAW)" };
321
Vadim Yanitskiy220fa202020-09-15 19:15:01 +0700322function enc_pad_PCUIF_Message(in PCUIF_Message pdu)
323return octetstring {
324 var octetstring stream;
325 var integer len;
326
327 stream := enc_PCUIF_Message(pdu);
328 if (not mp_pcuif_padding) {
329 return stream;
330 }
331
332 select (mp_pcuif_version) {
333 case (9) { len := 212; }
334 /* FIXME: 1006 % 4 > 0 (alignment) */
335 case (10) { len := 1006; }
336 case else { len := 0; }
337 }
338
339 return f_pad_oct(stream, len, '00'O);
340}
341
Harald Welte883340c2018-02-28 18:59:29 +0100342
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200343/* Generic template for matching messages by type and/or the BTS number */
344template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
345 template uint8_t bts_nr := ?) := {
346 msg_type := msg_type,
347 bts_nr := bts_nr,
348 spare := ?,
349 u := ?
350}
351
Harald Weltee1fd9162019-02-18 19:47:53 +0100352template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
353 template (value) uint8_t trx_nr,
354 template (value) uint8_t ts_nr,
355 template (value) PCUIF_Sapi sapi,
356 template (value) uint32_t fn,
357 template (value) uint16_t arfcn,
358 template (value) uint8_t block_nr
359 ) := {
360 msg_type := PCU_IF_MSG_RTS_REQ,
361 bts_nr := bts_nr,
362 spare := '0000'O,
363 u := {
364 rts_req := {
365 sapi := sapi,
366 spare := '000000'O,
367 fn := fn,
368 arfcn := arfcn,
369 trx_nr := trx_nr,
370 ts_nr := ts_nr,
371 block_nr := block_nr
372 }
373 }
374}
Harald Welte883340c2018-02-28 18:59:29 +0100375template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
376 template uint8_t trx_nr := ?,
377 template uint8_t ts_nr := ?,
378 template PCUIF_Sapi sapi := ?,
379 template uint32_t fn := ?,
380 template uint8_t block_nr := ?
381 ) := {
382 msg_type := PCU_IF_MSG_RTS_REQ,
383 bts_nr := bts_nr,
384 spare := ?,
385 u := {
386 rts_req := {
387 sapi := sapi,
388 spare := ?,
389 fn := fn,
390 arfcn := ?,
391 trx_nr := trx_nr,
392 ts_nr := ts_nr,
393 block_nr := block_nr
394 }
395 }
396}
397
398template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
399 msg_type := PCU_IF_MSG_TXT_IND,
400 bts_nr := bts_nr,
401 spare := '0000'O,
402 u := {
403 txt_ind := {
404 txt_type := tt,
405 text := text
406 }
407 }
408}
Harald Weltee1fd9162019-02-18 19:47:53 +0100409template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
410 template charstring text := ?) := {
411 msg_type := PCU_IF_MSG_TXT_IND,
412 bts_nr := bts_nr,
413 spare := '0000'O,
414 u := {
415 txt_ind := {
416 txt_type := tt,
417 text := text
418 }
419 }
420}
421
422
Harald Welte883340c2018-02-28 18:59:29 +0100423
424template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
425 msg_type := PCU_IF_MSG_ACT_REQ,
426 bts_nr := bts_nr,
427 spare := '0000'O,
428 u := {
429 act_req := {
430 is_activate := 1,
431 trx_nr := trx_nr,
432 ts_nr := ts_nr,
433 spare := '00'O
434 }
435 }
436}
Harald Weltee1fd9162019-02-18 19:47:53 +0100437template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
438 template uint8_t ts_nr) := {
439 msg_type := PCU_IF_MSG_ACT_REQ,
440 bts_nr := bts_nr,
441 spare := '0000'O,
442 u := {
443 act_req := {
444 is_activate := 1,
445 trx_nr := trx_nr,
446 ts_nr := ts_nr,
447 spare := '00'O
448 }
449 }
450}
Harald Welte883340c2018-02-28 18:59:29 +0100451
452template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
453 msg_type := PCU_IF_MSG_ACT_REQ,
454 bts_nr := bts_nr,
455 spare := '0000'O,
456 u := {
457 act_req := {
458 is_activate := 0,
459 trx_nr := trx_nr,
460 ts_nr := ts_nr,
461 spare := '00'O
462 }
463 }
464}
Harald Weltee1fd9162019-02-18 19:47:53 +0100465template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
466 template uint8_t ts_nr) := {
467 msg_type := PCU_IF_MSG_ACT_REQ,
468 bts_nr := bts_nr,
469 spare := '0000'O,
470 u := {
471 act_req := {
472 is_activate := 0,
473 trx_nr := trx_nr,
474 ts_nr := ts_nr,
475 spare := '00'O
476 }
477 }
478}
Harald Welte883340c2018-02-28 18:59:29 +0100479
Harald Weltee1fd9162019-02-18 19:47:53 +0100480template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
481 template (value) uint8_t trx_nr,
482 template (value) uint8_t ts_nr,
483 template (value) uint8_t block_nr,
484 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700485 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100486 template (value) uint32_t fn,
487 template (value) uint16_t arfcn,
488 template (value) int8_t rssi := -80,
489 template (value) uint16_t ber10k := 0,
490 template (value) int16_t ta_offs_qbits := 0,
491 template (value) uint16_t lqual_cb := 10) := {
492 msg_type := PCU_IF_MSG_DATA_IND,
493 bts_nr := bts_nr,
494 spare := '0000'O,
495 u := {
496 data_ind := {
497 sapi := sapi,
498 len := lengthof(valueof(data)),
499 data := data,
500 fn := fn,
501 arfcn := arfcn,
502 trx_nr := trx_nr,
503 ts_nr := ts_nr,
504 block_nr := block_nr,
505 rssi := rssi,
506 ber10k := ber10k,
507 ta_offs_qbits := ta_offs_qbits,
508 lqual_cb := lqual_cb
509 }
510 }
511}
Harald Welte883340c2018-02-28 18:59:29 +0100512template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
513 template uint8_t trx_nr := ?,
514 template uint8_t ts_nr := ?,
515 template uint8_t block_nr := ?,
516 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700517 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100518 msg_type := PCU_IF_MSG_DATA_IND,
519 bts_nr := bts_nr,
520 spare := ?,
521 u := {
522 data_ind := {
523 sapi := sapi,
524 len := ?,
525 data := data,
526 fn := ?,
527 arfcn := ?,
528 trx_nr := trx_nr,
529 ts_nr := ts_nr,
530 block_nr := block_nr,
531 rssi := ?,
532 ber10k := ?,
533 ta_offs_qbits := ?,
534 lqual_cb := ?
535 }
536 }
537}
538
539template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
540 uint8_t ts_nr, uint8_t block_nr,
541 uint32_t fn, PCUIF_Sapi sapi,
542 octetstring data) := {
543 msg_type := PCU_IF_MSG_DATA_REQ,
544 bts_nr := bts_nr,
545 spare := '0000'O,
546 u := {
547 data_req := {
548 sapi := sapi,
549 len := lengthof(data),
550 data := data,
551 fn := fn,
552 arfcn := 0, /* unused in BTS */
553 trx_nr := trx_nr,
554 ts_nr := ts_nr,
555 block_nr := block_nr,
556 /* measurement parameters below unused on Tx */
557 rssi := 0,
558 ber10k := 0,
559 ta_offs_qbits := 0,
560 lqual_cb := 0
561 }
562 }
563}
Harald Weltee1fd9162019-02-18 19:47:53 +0100564template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
565 template uint8_t trx_nr,
566 template uint8_t ts_nr,
567 template uint8_t block_nr := ?,
568 template uint32_t fn := ?,
569 template PCUIF_Sapi sapi := ?,
570 template octetstring data := ?) := {
571 msg_type := PCU_IF_MSG_DATA_REQ,
572 bts_nr := bts_nr,
573 spare := '0000'O,
574 u := {
575 data_req := {
576 sapi := sapi,
577 len := ?,
578 data := data,
579 fn := fn,
Harald Welte0a3d63f2019-03-02 00:02:07 +0100580 arfcn := ?, /* unused in BTS */
Harald Weltee1fd9162019-02-18 19:47:53 +0100581 trx_nr := trx_nr,
582 ts_nr := ts_nr,
583 block_nr := block_nr,
584 /* measurement parameters below unused on Tx */
585 rssi := 0,
586 ber10k := 0,
587 ta_offs_qbits := 0,
588 lqual_cb := 0
589 }
590 }
591}
Harald Welte883340c2018-02-28 18:59:29 +0100592
Harald Weltee1fd9162019-02-18 19:47:53 +0100593template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
594 template (value) uint8_t trx_nr,
595 template (value) uint8_t ts_nr,
596 template (value) uint8_t block_nr,
597 template (value) uint32_t fn,
598 template (value) uint16_t arfcn,
599 template (value) PCUIF_Sapi sapi,
600 template (value) octetstring data) := {
601 msg_type := PCU_IF_MSG_DATA_CNF,
602 bts_nr := bts_nr,
603 spare := '0000'O,
604 u := {
605 data_cnf := {
606 sapi := sapi,
607 len := 0, /* overwritten */
608 data := data,
609 fn := fn,
610 arfcn := arfcn,
611 trx_nr := trx_nr,
612 ts_nr := ts_nr,
613 block_nr := block_nr,
614 rssi := 0,
615 ber10k := 0,
616 ta_offs_qbits := 0,
617 lqual_cb := 0
618 }
619 }
620}
Harald Welte883340c2018-02-28 18:59:29 +0100621template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
622 template uint8_t trx_nr := ?,
623 template uint8_t ts_nr := ?,
624 template PCUIF_Sapi sapi := ?,
625 template octetstring data := ?) := {
626 msg_type := PCU_IF_MSG_DATA_CNF,
627 bts_nr := bts_nr,
628 spare := ?,
629 u := {
630 data_cnf := {
631 sapi := sapi,
632 len := ?,
633 data := data,
634 fn := ?,
635 arfcn := ?,
636 trx_nr := trx_nr,
637 ts_nr := ts_nr,
638 block_nr := ?,
639 rssi := ?,
640 ber10k := ?,
641 ta_offs_qbits := ?,
642 lqual_cb := ?
643 }
644 }
645}
646
Harald Weltee1fd9162019-02-18 19:47:53 +0100647template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700648 template (value) uint8_t trx_nr,
649 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100650 template (value) uint16_t ra,
651 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100652 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100653 template (value) uint32_t fn,
654 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700655 template (value) int16_t qta := 0,
656 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100657) := {
658 msg_type := PCU_IF_MSG_RACH_IND,
659 bts_nr := bts_nr,
660 spare := '0000'O,
661 u := {
662 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700663 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100664 ra := ra,
665 qta := qta,
666 fn := fn,
667 arfcn := arfcn,
668 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700669 burst_type := burst_type,
670 trx_nr := trx_nr,
671 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100672 }
673 }
674}
Harald Welte883340c2018-02-28 18:59:29 +0100675template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700676 template uint8_t trx_nr := ?,
677 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100678 template uint16_t ra := ?,
679 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100680 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700681 template uint32_t fn := ?,
682 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100683 msg_type := PCU_IF_MSG_RACH_IND,
684 bts_nr := bts_nr,
685 spare := ?,
686 u := {
687 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700688 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100689 ra := ra,
690 qta := ?,
691 fn := fn,
692 arfcn := ?,
693 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700694 burst_type := burst_type,
695 trx_nr := trx_nr,
696 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100697 }
698 }
699}
700
Harald Weltee1fd9162019-02-18 19:47:53 +0100701template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
702 template (value) OCT9 id_lv,
703 template (value) uint8_t chan_needed,
704 template (value) PCUIF_Sapi sapi) := {
705 msg_type := PCU_IF_MSG_PAG_REQ,
706 bts_nr := bts_nr,
707 spare := '0000'O,
708 u := {
709 pag_req := {
710 sapi := sapi,
711 chan_needed := chan_needed,
712 identity_lv := id_lv
713 }
714 }
715}
Harald Welte883340c2018-02-28 18:59:29 +0100716template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
717 template OCT9 id_lv := ?,
718 template uint8_t chan_needed := ?,
719 template PCUIF_Sapi sapi := ?) := {
720 msg_type := PCU_IF_MSG_PAG_REQ,
721 bts_nr := bts_nr,
722 spare := ?,
723 u := {
724 pag_req := {
725 sapi := ?,
726 chan_needed := chan_needed,
727 identity_lv := id_lv
728 }
729 }
730}
731
Harald Weltee1fd9162019-02-18 19:47:53 +0100732const PCUIF_Flags c_PCUIF_Flags_default := {
733 bts_active := true,
734 sysmo_direct_dsp := false,
735 spare := '00000000000000'B,
736 cs1 := true,
737 cs2 := true,
738 cs3 := true,
739 cs4 := true,
740 mcs1 := true,
741 mcs2 := true,
742 mcs3 := true,
743 mcs4 := true,
744 mcs5 := true,
745 mcs6 := true,
746 mcs7 := true,
747 mcs8 := true,
748 mcs9 := true,
749 spare2 := '000'B
750};
751
Pau Espin Pedrol745a48b2020-10-30 15:31:07 +0100752const PCUIF_Flags c_PCUIF_Flags_noMCS := {
753 bts_active := true,
754 sysmo_direct_dsp := false,
755 spare := '00000000000000'B,
756 cs1 := true,
757 cs2 := true,
758 cs3 := true,
759 cs4 := true,
760 mcs1 := false,
761 mcs2 := false,
762 mcs3 := false,
763 mcs4 := false,
764 mcs5 := false,
765 mcs6 := false,
766 mcs7 := false,
767 mcs8 := false,
768 mcs9 := false,
769 spare2 := '000'B
770};
771
772function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean {
773 return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or
774 flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or
775 flags.mcs9;
776}
777
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700778template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
779 tsc := tsc,
780 hopping := 0,
781 hsn := 0, maio := 0,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700782 ma_bit_len := 0,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700783 ma := f_pad_bit(''B, 64, '0'B)
784};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700785template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
786 tsc := tsc,
787 hopping := 0,
788 hsn := ?, maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700789 ma_bit_len := ?,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700790 ma := ?
791};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700792
793template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
794 template (value) uint6_t hsn := 0,
795 template (value) uint6_t maio := 0,
796 template (value) bitstring ma := ''B) := {
797 tsc := tsc,
798 hopping := 1,
799 hsn := hsn,
800 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700801 ma_bit_len := lengthof(valueof(ma)),
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700802 ma := f_pad_bit(valueof(ma), 64, '0'B)
803};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700804template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
805 template uint6_t hsn := ?,
806 template uint6_t maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700807 template bitstring ma := ?,
808 template uint8_t ma_bit_len := ?) := {
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700809 tsc := tsc,
810 hopping := 1,
811 hsn := hsn,
812 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700813 ma_bit_len := ma_bit_len,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700814 ma := ma
815};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700816
817template (value) PCUIF_InfoV10Trx ts_PCUIF_InfoV10Trx(template (value) uint16_t arfcn := 871,
818 template (value) BIT8 pdch_mask := '00000001'B,
819 template (value) uint3_t tsc := 7) := {
820 arfcn := arfcn,
821 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700822 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700823 hLayer1 := 0,
824 ts := {
825 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
826 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
827 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
828 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
829 }
830};
831
832template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09Trx(template (value) uint16_t arfcn := 871,
833 template (value) BIT8 pdch_mask := '00000001'B,
834 OCT1 tsc := '07'O) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100835 arfcn := arfcn,
836 pdch_mask := pdch_mask,
837 spare := '00'O,
838 tsc := tsc & tsc & tsc & tsc & tsc & tsc & tsc & tsc,
839 hLayer1 := 0
840}
841
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700842template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09TrxNULL := ts_PCUIF_InfoV09Trx(0, '00000000'B, '00'O);
Harald Weltee1fd9162019-02-18 19:47:53 +0100843
Pau Espin Pedrol2aead382020-10-29 20:46:47 +0100844template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def(uint16_t base_arfcn) := {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700845 v09 := {
Pau Espin Pedrol2aead382020-10-29 20:46:47 +0100846 ts_PCUIF_InfoV09Trx(arfcn := base_arfcn + 0), ts_PCUIF_InfoV09TrxNULL,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700847 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
848 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
849 ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL
850 }
851};
852
Pau Espin Pedrol2aead382020-10-29 20:46:47 +0100853template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def(uint16_t base_arfcn) := {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700854 v10 := {
Pau Espin Pedrol2aead382020-10-29 20:46:47 +0100855 ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 0), ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 1),
856 ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 2), ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 3),
857 ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 4), ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 5),
858 ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 6), ts_PCUIF_InfoV10Trx(arfcn := base_arfcn + 7)
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700859 }
860};
Harald Weltee1fd9162019-02-18 19:47:53 +0100861
Harald Weltee1fd9162019-02-18 19:47:53 +0100862template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200863 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100864 msg_type := PCU_IF_MSG_INFO_IND,
865 bts_nr := bts_nr,
866 spare := '0000'O,
867 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200868 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100869 }
870}
Harald Welted378a252018-03-13 17:02:14 +0100871template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
872 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700873 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100874 msg_type := PCU_IF_MSG_INFO_IND,
875 bts_nr := bts_nr,
876 spare := ?,
877 u := {
878 info_ind := {
879 version := version,
880 flags := flags,
881 trx := ?,
882 bsic := ?,
883 mcc := ?,
884 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100885 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100886 lac := ?,
887 rac := ?,
888 nsei := ?,
889 nse_timer := ?,
890 cell_timer := ?,
891 cell_id := ?,
892 repeat_time := ?,
893 repeat_count := ?,
894 bvci := ?,
895 t3142 := ?,
896 t3169 := ?,
897 t3191 := ?,
898 t3193_10ms := ?,
899 t3195 := ?,
900 t3101 := ?,
901 t3103 := ?,
902 t3105 := ?,
903 cv_countdown := ?,
904 dl_tbf_ext := ?,
905 ul_tbf_ext := ?,
906 initial_cs := ?,
907 initial_mcs := ?,
908 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700909 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100910 remote_port := ?,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200911 remote_addr := ?
Harald Welted378a252018-03-13 17:02:14 +0100912 }
913 }
914}
915
Harald Weltea3219812019-03-02 00:02:28 +0100916template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
917 template (value) uint32_t fn) := {
918 msg_type := PCU_IF_MSG_TIME_IND,
919 bts_nr := bts_nr,
920 spare := '0000'O,
921 u := {
922 time_ind := {
923 fn := fn
924 }
925 }
926}
927template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
928 template uint32_t fn) := {
929 msg_type := PCU_IF_MSG_TIME_IND,
930 bts_nr := bts_nr,
931 spare := ?,
932 u := {
933 time_ind := {
934 fn := fn
935 }
936 }
937}
Harald Welte883340c2018-02-28 18:59:29 +0100938
Harald Welte4bff40a2019-03-21 21:34:10 +0100939template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
940 template (value) OCT4 tlli,
941 template (value) OCT6 ra_id,
942 template (value) uint8_t cause) := {
943 msg_type := PCU_IF_MSG_SUSP_REQ,
944 bts_nr := bts_nr,
945 spare := '0000'O,
946 u := {
947 susp_req := {
948 tlli := tlli,
949 ra_id := ra_id,
950 cause := cause
951 }
952 }
953}
954template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
955 template OCT4 tlli,
956 template OCT6 ra_id,
957 template uint8_t cause) := {
958 msg_type := PCU_IF_MSG_SUSP_REQ,
959 bts_nr := bts_nr,
960 spare := '0000'O,
961 u := {
962 susp_req := {
963 tlli := tlli,
964 ra_id := ra_id,
965 cause := cause
966 }
967 }
968}
969
Harald Welte11b734c2019-09-05 14:17:54 +0200970template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
971 template (value) uint8_t app_type,
972 template (value) octetstring app_data) := {
973 msg_type := PCU_IF_MSG_APP_INFO_REQ,
974 bts_nr := bts_nr,
975 spare := '0000'O,
976 u := {
977 app_info_req := {
978 application_type := app_type,
979 len := 0, /* overwritten */
980 data := app_data
981 }
982 }
983}
984template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
985 template (present) uint8_t app_type,
986 template (present) octetstring app_data) := {
987 msg_type := PCU_IF_MSG_APP_INFO_REQ,
988 bts_nr := bts_nr,
989 spare := '0000'O,
990 u := {
991 app_info_req := {
992 application_type := app_type,
993 len := ?,
994 data := app_data
995 }
996 }
997}
998
Harald Welte4bff40a2019-03-21 21:34:10 +0100999
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001000/* TODO: remove this as soon as we drop version 9 support */
Pau Espin Pedrol2aead382020-10-29 20:46:47 +01001001function f_PCUIF_ver_INFO_Trxs(uint16_t base_arfcn)
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001002return PCUIF_InfoTrxs {
1003 if (PCUIF_Types.mp_pcuif_version >= 10) {
Pau Espin Pedrol2aead382020-10-29 20:46:47 +01001004 return valueof(ts_PCUIF_InfoV10Trxs_def(base_arfcn));
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001005 } else {
Pau Espin Pedrol2aead382020-10-29 20:46:47 +01001006 return valueof(ts_PCUIF_InfoV09Trxs_def(base_arfcn));
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001007 }
1008}
1009
Vadim Yanitskiy2f8ee5a2020-10-31 20:15:21 +07001010function f_PCUIF_ver_INFO_PDCHMask_get(in PCUIF_info_ind info, uint8_t trx_nr)
Vadim Yanitskiy2a9acce2020-10-31 20:19:06 +07001011return BIT8 {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001012 if (PCUIF_Types.mp_pcuif_version >= 10) {
1013 return info.trx.v10[trx_nr].pdch_mask;
1014 } else {
1015 return info.trx.v09[trx_nr].pdch_mask;
1016 }
1017}
1018
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001019function f_PCUIF_ver_INFO_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
1020 template (present) uint8_t trx_nr := ?)
1021{
1022 if (PCUIF_Types.mp_pcuif_version >= 10) {
1023 for (var integer nr := 0; nr < lengthof(info.trx.v10); nr := nr + 1) {
1024 if (match(nr, trx_nr)) {
1025 info.trx.v10[nr].pdch_mask := pdch_mask;
1026 }
1027 }
1028 } else {
1029 for (var integer nr := 0; nr < lengthof(info.trx.v09); nr := nr + 1) {
1030 if (match(nr, trx_nr)) {
1031 info.trx.v09[nr].pdch_mask := pdch_mask;
1032 }
1033 }
1034 }
1035}
1036
Alexander Couzense0f7c542020-09-13 17:25:18 +02001037function f_PCUIF_AF2addr_type(AddressFamily address_family)
1038return PCUIF_AddrType {
1039 if (address_family == AF_INET) {
1040 return PCUIF_ADDR_TYPE_IPV4;
1041 } else if (address_family == AF_INET6) {
1042 return PCUIF_ADDR_TYPE_IPV6;
1043 } else {
1044 return PCUIF_ADDR_TYPE_UNSPEC;
1045 }
1046}
1047
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001048/* TODO: second (redundant) NSVC connection is not (yet) supported */
1049function f_PCUIF_ver_INFO_RemoteAddr(PCUIF_AddrType addr_type,
1050 charstring addr)
1051return PCUIF_RemoteAddr {
1052 var PCUIF_RemoteAddr remote_addr;
1053
1054 if (PCUIF_Types.mp_pcuif_version >= 10) {
1055 remote_addr.v10.addr_type[0] := addr_type;
1056 if (addr_type == PCUIF_ADDR_TYPE_IPV4) {
1057 remote_addr.v10.addr[0] := f_inet_addr(addr);
1058 } else {
1059 remote_addr.v10.addr[0] := f_inet6_addr(addr);
1060 }
1061 remote_addr.v10.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
1062 remote_addr.v10.addr[1] := f_pad_oct(''O, 16, '00'O);
1063 } else {
1064 if (addr_type != PCUIF_ADDR_TYPE_IPV4) {
1065 testcase.stop("NSVC address type := ", addr_type,
1066 "is not supported in version := ",
1067 PCUIF_Types.mp_pcuif_version);
1068 }
1069 /* v9 requires the IP in host byte order */
1070 remote_addr.v09.addr[0] := f_inet_haddr(addr);
Alexander Couzensefca79d2020-09-16 04:57:47 +02001071 remote_addr.v09.addr[1] := f_pad_oct(''O, 4, '00'O);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001072 }
1073
1074 return remote_addr;
1075}
1076
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001077
Harald Welte883340c2018-02-28 18:59:29 +01001078} with { encode "RAW" variant "BYTEORDER(first)" };