blob: 1e57fb28359ee33b14515a774ac3dee8cf8f011d [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 Yanitskiyc1559302020-07-19 16:39:12 +070021};
22
Harald Welte883340c2018-02-28 18:59:29 +010023const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts";
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +070024type integer PCUIF_Version (9..10); /* supported versions */
Harald Welte883340c2018-02-28 18:59:29 +010025
26type enumerated PCUIF_MsgType {
27 PCU_IF_MSG_DATA_REQ ('00'O),
28 PCU_IF_MSG_DATA_CNF ('01'O),
29 PCU_IF_MSG_DATA_IND ('02'O),
30 PCU_IF_MSG_SUSP_REQ ('03'O),
Harald Welte11b734c2019-09-05 14:17:54 +020031 PCU_IF_MSG_APP_INFO_REQ ('04'O),
Harald Welte883340c2018-02-28 18:59:29 +010032 PCU_IF_MSG_RTS_REQ ('10'O),
33 PCU_IF_MSG_DATA_CNF_DT ('11'O),
34 PCU_IF_MSG_RACH_IND ('22'O),
35 PCU_IF_MSG_INFO_IND ('32'O),
36 PCU_IF_MSG_ACT_REQ ('40'O),
37 PCU_IF_MSG_TIME_IND ('52'O),
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +020038 PCU_IF_MSG_INTERF_IND ('53'O),
Harald Welte883340c2018-02-28 18:59:29 +010039 PCU_IF_MSG_PAG_REQ ('60'O),
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +020040 PCU_IF_MSG_TXT_IND ('70'O),
41 PCU_IF_MSG_CONTAINER ('80'O)
Harald Welte883340c2018-02-28 18:59:29 +010042} 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
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100156private type record PCUIF_InfoTrx {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700157 uint16_t arfcn,
158 BIT8 pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700159 OCT1 spare,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700160 uint32_t hLayer1,
161 PCUIF_InfoTrxTsList ts
162} with { variant (pdch_mask) "BITORDER(msb)" };
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100163type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs;
Harald Welte883340c2018-02-28 18:59:29 +0100164
165type record PCUIF_info_ind {
166 uint32_t version,
167 PCUIF_Flags flags,
Harald Weltee1fd9162019-02-18 19:47:53 +0100168 PCUIF_InfoTrxs trx,
Harald Welte883340c2018-02-28 18:59:29 +0100169 uint8_t bsic,
170
171 uint16_t mcc,
172 uint16_t mnc,
Harald Welte3568dc72018-03-13 17:06:51 +0100173 uint8_t mnc_3_digits,
Harald Welte883340c2018-02-28 18:59:29 +0100174 uint16_t lac,
175 uint16_t rac,
176
177 uint16_t nsei,
178 record length(7) of uint8_t nse_timer,
179 record length(11) of uint8_t cell_timer,
180
181 uint16_t cell_id,
182 uint16_t repeat_time,
183 uint8_t repeat_count,
184 uint16_t bvci,
185 uint8_t t3142,
186 uint8_t t3169,
187 uint8_t t3191,
188 uint8_t t3193_10ms,
189 uint8_t t3195,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100190 uint8_t n3101,
191 uint8_t n3103,
192 uint8_t n3105,
Harald Welte883340c2018-02-28 18:59:29 +0100193 uint8_t cv_countdown,
194 uint16_t dl_tbf_ext,
195 uint16_t ul_tbf_ext,
196 uint8_t initial_cs,
197 uint8_t initial_mcs,
198
199 record length(2) of uint16_t nsvci,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700200 record length(2) of uint16_t local_port,
Harald Welte883340c2018-02-28 18:59:29 +0100201 record length(2) of uint16_t remote_port,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200202 PCUIF_RemoteAddr remote_addr
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200203} with { variant "" };
204
205type enumerated PCUIF_AddrType {
206 PCUIF_ADDR_TYPE_UNSPEC ('00'O),
207 PCUIF_ADDR_TYPE_IPV4 ('04'O),
208 PCUIF_ADDR_TYPE_IPV6 ('29'O)
209} with { variant "FIELDLENGTH(8)" };
210
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100211type record PCUIF_RemoteAddr {
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200212 record length(2) of PCUIF_AddrType addr_type,
213 record length(2) of octetstring addr length(16)
214} with { variant "" };
215
Harald Welte883340c2018-02-28 18:59:29 +0100216type record PCUIF_act_req {
217 uint8_t is_activate,
218 uint8_t trx_nr,
219 uint8_t ts_nr,
220 OCT1 spare
221} with { variant "" };
222
223type record PCUIF_time_ind {
224 uint32_t fn
225} with { variant "" };
226
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200227type record length(8) of uint8_t PCUIF_interf;
228type record PCUIF_interf_ind {
229 uint8_t trx_nr,
230 OCT3 spare,
231 uint32_t fn,
232 PCUIF_interf interf
233} with { variant "" };
234
Harald Welte883340c2018-02-28 18:59:29 +0100235type record PCUIF_pag_req {
236 PCUIF_Sapi sapi,
237 uint8_t chan_needed,
238 OCT9 identity_lv
239} with { variant "" };
240
Harald Welte11b734c2019-09-05 14:17:54 +0200241type record PCUIF_app_info_req {
242 uint8_t application_type,
243 uint8_t len,
244 octetstring data
245} with {
246 variant (len) "LENGTHTO(data)"
247}
248
Harald Welte883340c2018-02-28 18:59:29 +0100249type record PCUIF_susp_req {
250 OCT4 tlli,
251 OCT6 ra_id,
252 uint8_t cause
Harald Welteeaa9a862019-05-26 23:01:08 +0200253} with {
254 variant (tlli) "BYTEORDER(last)"
255};
Harald Welte883340c2018-02-28 18:59:29 +0100256
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200257type union PCUIF_ContainerMsgUnion {
258 /* This field can be removed once first container message is added, see
259 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=574469 */
260 octetstring tmp_fixme,
261 octetstring other
262} with { variant "" };
263
264type record PCUIF_container {
265 uint8_t msg_type,
266 OCT1 spare,
267 uint16_t len, /* network byte order */
268 PCUIF_ContainerMsgUnion u
269} with {
270 variant (len) "BYTEORDER(last)"
271 variant (len) "LENGTHTO(u)"
272 variant (u) "CROSSTAG(
273 tmp_fixme, msg_type = 255;
274 other, OTHERWISE)"
275};
276
Harald Welte883340c2018-02-28 18:59:29 +0100277
278type union PCUIF_MsgUnion {
279 PCUIF_data data_req,
280 PCUIF_data data_cnf,
281 PCUIF_data_cnf_dt data_cnf_dt,
282 PCUIF_data data_ind,
283 PCUIF_susp_req susp_req,
284 PCUIF_rts_req rts_req,
285 PCUIF_rach_ind rach_ind,
286 PCUIF_txt_ind txt_ind,
287 PCUIF_info_ind info_ind,
288 PCUIF_act_req act_req,
289 PCUIF_time_ind time_ind,
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200290 PCUIF_interf_ind interf_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200291 PCUIF_pag_req pag_req,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200292 PCUIF_app_info_req app_info_req,
293 PCUIF_container container
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;
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200313 interf_ind, msg_type = PCU_IF_MSG_INTERF_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200314 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200315 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ;
316 container, msg_type = PCU_IF_MSG_CONTAINER)"
Vadim Yanitskiy204fe622021-03-23 04:49:41 +0100317 /* PCUIFv10: 1006 * 8 = 8048 bits */
318 variant "PADDING(8048)"
Harald Welte883340c2018-02-28 18:59:29 +0100319};
320
321external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
322 with { extension "prototype(convert) encode(RAW)" };
323external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
324 with { extension "prototype(convert) decode(RAW)" };
325
326
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200327/* Generic template for matching messages by type and/or the BTS number */
328template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
329 template uint8_t bts_nr := ?) := {
330 msg_type := msg_type,
331 bts_nr := bts_nr,
332 spare := ?,
333 u := ?
334}
335
Harald Weltee1fd9162019-02-18 19:47:53 +0100336template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
337 template (value) uint8_t trx_nr,
338 template (value) uint8_t ts_nr,
339 template (value) PCUIF_Sapi sapi,
340 template (value) uint32_t fn,
341 template (value) uint16_t arfcn,
342 template (value) uint8_t block_nr
343 ) := {
344 msg_type := PCU_IF_MSG_RTS_REQ,
345 bts_nr := bts_nr,
346 spare := '0000'O,
347 u := {
348 rts_req := {
349 sapi := sapi,
350 spare := '000000'O,
351 fn := fn,
352 arfcn := arfcn,
353 trx_nr := trx_nr,
354 ts_nr := ts_nr,
355 block_nr := block_nr
356 }
357 }
358}
Harald Welte883340c2018-02-28 18:59:29 +0100359template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
360 template uint8_t trx_nr := ?,
361 template uint8_t ts_nr := ?,
362 template PCUIF_Sapi sapi := ?,
363 template uint32_t fn := ?,
364 template uint8_t block_nr := ?
365 ) := {
366 msg_type := PCU_IF_MSG_RTS_REQ,
367 bts_nr := bts_nr,
368 spare := ?,
369 u := {
370 rts_req := {
371 sapi := sapi,
372 spare := ?,
373 fn := fn,
374 arfcn := ?,
375 trx_nr := trx_nr,
376 ts_nr := ts_nr,
377 block_nr := block_nr
378 }
379 }
380}
381
382template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
383 msg_type := PCU_IF_MSG_TXT_IND,
384 bts_nr := bts_nr,
385 spare := '0000'O,
386 u := {
387 txt_ind := {
388 txt_type := tt,
389 text := text
390 }
391 }
392}
Harald Weltee1fd9162019-02-18 19:47:53 +0100393template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
394 template charstring text := ?) := {
395 msg_type := PCU_IF_MSG_TXT_IND,
396 bts_nr := bts_nr,
397 spare := '0000'O,
398 u := {
399 txt_ind := {
400 txt_type := tt,
401 text := text
402 }
403 }
404}
405
406
Harald Welte883340c2018-02-28 18:59:29 +0100407
408template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
409 msg_type := PCU_IF_MSG_ACT_REQ,
410 bts_nr := bts_nr,
411 spare := '0000'O,
412 u := {
413 act_req := {
414 is_activate := 1,
415 trx_nr := trx_nr,
416 ts_nr := ts_nr,
417 spare := '00'O
418 }
419 }
420}
Harald Weltee1fd9162019-02-18 19:47:53 +0100421template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
422 template uint8_t ts_nr) := {
423 msg_type := PCU_IF_MSG_ACT_REQ,
424 bts_nr := bts_nr,
425 spare := '0000'O,
426 u := {
427 act_req := {
428 is_activate := 1,
429 trx_nr := trx_nr,
430 ts_nr := ts_nr,
431 spare := '00'O
432 }
433 }
434}
Harald Welte883340c2018-02-28 18:59:29 +0100435
436template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
437 msg_type := PCU_IF_MSG_ACT_REQ,
438 bts_nr := bts_nr,
439 spare := '0000'O,
440 u := {
441 act_req := {
442 is_activate := 0,
443 trx_nr := trx_nr,
444 ts_nr := ts_nr,
445 spare := '00'O
446 }
447 }
448}
Harald Weltee1fd9162019-02-18 19:47:53 +0100449template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
450 template uint8_t ts_nr) := {
451 msg_type := PCU_IF_MSG_ACT_REQ,
452 bts_nr := bts_nr,
453 spare := '0000'O,
454 u := {
455 act_req := {
456 is_activate := 0,
457 trx_nr := trx_nr,
458 ts_nr := ts_nr,
459 spare := '00'O
460 }
461 }
462}
Harald Welte883340c2018-02-28 18:59:29 +0100463
Harald Weltee1fd9162019-02-18 19:47:53 +0100464template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
465 template (value) uint8_t trx_nr,
466 template (value) uint8_t ts_nr,
467 template (value) uint8_t block_nr,
468 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700469 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100470 template (value) uint32_t fn,
471 template (value) uint16_t arfcn,
472 template (value) int8_t rssi := -80,
473 template (value) uint16_t ber10k := 0,
474 template (value) int16_t ta_offs_qbits := 0,
Vadim Yanitskiy45749a82021-05-26 13:29:04 +0200475 template (value) int16_t lqual_cb := 10) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100476 msg_type := PCU_IF_MSG_DATA_IND,
477 bts_nr := bts_nr,
478 spare := '0000'O,
479 u := {
480 data_ind := {
481 sapi := sapi,
482 len := lengthof(valueof(data)),
483 data := data,
484 fn := fn,
485 arfcn := arfcn,
486 trx_nr := trx_nr,
487 ts_nr := ts_nr,
488 block_nr := block_nr,
489 rssi := rssi,
490 ber10k := ber10k,
491 ta_offs_qbits := ta_offs_qbits,
492 lqual_cb := lqual_cb
493 }
494 }
495}
Harald Welte883340c2018-02-28 18:59:29 +0100496template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
497 template uint8_t trx_nr := ?,
498 template uint8_t ts_nr := ?,
499 template uint8_t block_nr := ?,
500 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700501 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100502 msg_type := PCU_IF_MSG_DATA_IND,
503 bts_nr := bts_nr,
504 spare := ?,
505 u := {
506 data_ind := {
507 sapi := sapi,
508 len := ?,
509 data := data,
510 fn := ?,
511 arfcn := ?,
512 trx_nr := trx_nr,
513 ts_nr := ts_nr,
514 block_nr := block_nr,
515 rssi := ?,
516 ber10k := ?,
517 ta_offs_qbits := ?,
518 lqual_cb := ?
519 }
520 }
521}
522
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100523template PCUIF_data tr_PCUIF_DATA(template uint8_t trx_nr,
524 template uint8_t ts_nr,
525 template uint8_t block_nr := ?,
526 template uint32_t fn := ?,
527 template PCUIF_Sapi sapi := ?,
528 template octetstring data := ?) := {
529 sapi := sapi,
530 len := ?,
531 data := data,
532 fn := fn,
533 arfcn := ?, /* unused in BTS */
534 trx_nr := trx_nr,
535 ts_nr := ts_nr,
536 block_nr := block_nr,
537 /* measurement parameters below unused on Tx */
538 rssi := 0,
539 ber10k := 0,
540 ta_offs_qbits := 0,
541 lqual_cb := 0
542
543}
544
Harald Welte883340c2018-02-28 18:59:29 +0100545template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
546 uint8_t ts_nr, uint8_t block_nr,
547 uint32_t fn, PCUIF_Sapi sapi,
548 octetstring data) := {
549 msg_type := PCU_IF_MSG_DATA_REQ,
550 bts_nr := bts_nr,
551 spare := '0000'O,
552 u := {
553 data_req := {
554 sapi := sapi,
555 len := lengthof(data),
556 data := data,
557 fn := fn,
558 arfcn := 0, /* unused in BTS */
559 trx_nr := trx_nr,
560 ts_nr := ts_nr,
561 block_nr := block_nr,
562 /* measurement parameters below unused on Tx */
563 rssi := 0,
564 ber10k := 0,
565 ta_offs_qbits := 0,
566 lqual_cb := 0
567 }
568 }
569}
Harald Weltee1fd9162019-02-18 19:47:53 +0100570template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
571 template uint8_t trx_nr,
572 template uint8_t ts_nr,
573 template uint8_t block_nr := ?,
574 template uint32_t fn := ?,
575 template PCUIF_Sapi sapi := ?,
576 template octetstring data := ?) := {
577 msg_type := PCU_IF_MSG_DATA_REQ,
578 bts_nr := bts_nr,
579 spare := '0000'O,
580 u := {
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100581 data_req := tr_PCUIF_DATA(trx_nr, ts_nr, block_nr, fn, sapi, data)
Harald Weltee1fd9162019-02-18 19:47:53 +0100582 }
583}
Harald Welte883340c2018-02-28 18:59:29 +0100584
Harald Weltee1fd9162019-02-18 19:47:53 +0100585template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
586 template (value) uint8_t trx_nr,
587 template (value) uint8_t ts_nr,
588 template (value) uint8_t block_nr,
589 template (value) uint32_t fn,
590 template (value) uint16_t arfcn,
591 template (value) PCUIF_Sapi sapi,
592 template (value) octetstring data) := {
593 msg_type := PCU_IF_MSG_DATA_CNF,
594 bts_nr := bts_nr,
595 spare := '0000'O,
596 u := {
597 data_cnf := {
598 sapi := sapi,
599 len := 0, /* overwritten */
600 data := data,
601 fn := fn,
602 arfcn := arfcn,
603 trx_nr := trx_nr,
604 ts_nr := ts_nr,
605 block_nr := block_nr,
606 rssi := 0,
607 ber10k := 0,
608 ta_offs_qbits := 0,
609 lqual_cb := 0
610 }
611 }
612}
Harald Welte883340c2018-02-28 18:59:29 +0100613template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
614 template uint8_t trx_nr := ?,
615 template uint8_t ts_nr := ?,
616 template PCUIF_Sapi sapi := ?,
617 template octetstring data := ?) := {
618 msg_type := PCU_IF_MSG_DATA_CNF,
619 bts_nr := bts_nr,
620 spare := ?,
621 u := {
622 data_cnf := {
623 sapi := sapi,
624 len := ?,
625 data := data,
626 fn := ?,
627 arfcn := ?,
628 trx_nr := trx_nr,
629 ts_nr := ts_nr,
630 block_nr := ?,
631 rssi := ?,
632 ber10k := ?,
633 ta_offs_qbits := ?,
634 lqual_cb := ?
635 }
636 }
637}
638
Harald Weltee1fd9162019-02-18 19:47:53 +0100639template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700640 template (value) uint8_t trx_nr,
641 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100642 template (value) uint16_t ra,
643 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100644 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100645 template (value) uint32_t fn,
646 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700647 template (value) int16_t qta := 0,
648 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100649) := {
650 msg_type := PCU_IF_MSG_RACH_IND,
651 bts_nr := bts_nr,
652 spare := '0000'O,
653 u := {
654 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700655 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100656 ra := ra,
657 qta := qta,
658 fn := fn,
659 arfcn := arfcn,
660 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700661 burst_type := burst_type,
662 trx_nr := trx_nr,
663 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100664 }
665 }
666}
Harald Welte883340c2018-02-28 18:59:29 +0100667template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700668 template uint8_t trx_nr := ?,
669 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100670 template uint16_t ra := ?,
671 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100672 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700673 template uint32_t fn := ?,
674 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100675 msg_type := PCU_IF_MSG_RACH_IND,
676 bts_nr := bts_nr,
677 spare := ?,
678 u := {
679 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700680 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100681 ra := ra,
682 qta := ?,
683 fn := fn,
684 arfcn := ?,
685 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700686 burst_type := burst_type,
687 trx_nr := trx_nr,
688 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100689 }
690 }
691}
692
Harald Weltee1fd9162019-02-18 19:47:53 +0100693template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
694 template (value) OCT9 id_lv,
695 template (value) uint8_t chan_needed,
696 template (value) PCUIF_Sapi sapi) := {
697 msg_type := PCU_IF_MSG_PAG_REQ,
698 bts_nr := bts_nr,
699 spare := '0000'O,
700 u := {
701 pag_req := {
702 sapi := sapi,
703 chan_needed := chan_needed,
704 identity_lv := id_lv
705 }
706 }
707}
Harald Welte883340c2018-02-28 18:59:29 +0100708template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
709 template OCT9 id_lv := ?,
710 template uint8_t chan_needed := ?,
711 template PCUIF_Sapi sapi := ?) := {
712 msg_type := PCU_IF_MSG_PAG_REQ,
713 bts_nr := bts_nr,
714 spare := ?,
715 u := {
716 pag_req := {
717 sapi := ?,
718 chan_needed := chan_needed,
719 identity_lv := id_lv
720 }
721 }
722}
723
Harald Weltee1fd9162019-02-18 19:47:53 +0100724const PCUIF_Flags c_PCUIF_Flags_default := {
725 bts_active := true,
726 sysmo_direct_dsp := false,
727 spare := '00000000000000'B,
728 cs1 := true,
729 cs2 := true,
730 cs3 := true,
731 cs4 := true,
732 mcs1 := true,
733 mcs2 := true,
734 mcs3 := true,
735 mcs4 := true,
736 mcs5 := true,
737 mcs6 := true,
738 mcs7 := true,
739 mcs8 := true,
740 mcs9 := true,
741 spare2 := '000'B
742};
743
Pau Espin Pedrol745a48b2020-10-30 15:31:07 +0100744const PCUIF_Flags c_PCUIF_Flags_noMCS := {
745 bts_active := true,
746 sysmo_direct_dsp := false,
747 spare := '00000000000000'B,
748 cs1 := true,
749 cs2 := true,
750 cs3 := true,
751 cs4 := true,
752 mcs1 := false,
753 mcs2 := false,
754 mcs3 := false,
755 mcs4 := false,
756 mcs5 := false,
757 mcs6 := false,
758 mcs7 := false,
759 mcs8 := false,
760 mcs9 := false,
761 spare2 := '000'B
762};
763
764function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean {
765 return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or
766 flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or
767 flags.mcs9;
768}
769
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700770template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
771 tsc := tsc,
772 hopping := 0,
773 hsn := 0, maio := 0,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700774 ma_bit_len := 0,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700775 ma := f_pad_bit(''B, 64, '0'B)
776};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700777template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
778 tsc := tsc,
779 hopping := 0,
780 hsn := ?, maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700781 ma_bit_len := ?,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700782 ma := ?
783};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700784
785template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
786 template (value) uint6_t hsn := 0,
787 template (value) uint6_t maio := 0,
788 template (value) bitstring ma := ''B) := {
789 tsc := tsc,
790 hopping := 1,
791 hsn := hsn,
792 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700793 ma_bit_len := lengthof(valueof(ma)),
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700794 ma := f_pad_bit(valueof(ma), 64, '0'B)
795};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700796template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
797 template uint6_t hsn := ?,
798 template uint6_t maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700799 template bitstring ma := ?,
800 template uint8_t ma_bit_len := ?) := {
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700801 tsc := tsc,
802 hopping := 1,
803 hsn := hsn,
804 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700805 ma_bit_len := ma_bit_len,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700806 ma := ma
807};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700808
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100809template (value) PCUIF_InfoTrx
810ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871,
811 template (value) BIT8 pdch_mask := '00000001'B,
812 template (value) uint3_t tsc := 7) := {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700813 arfcn := arfcn,
814 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700815 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700816 hLayer1 := 0,
817 ts := {
818 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
819 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
820 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
821 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
822 }
823};
824
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100825template (value) PCUIF_InfoTrxs
826ts_PCUIF_InfoTrxs_def(uint16_t base_arfcn) := {
827 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 0),
828 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 1),
829 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 2),
830 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 3),
831 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 4),
832 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 5),
833 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 6),
834 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 7)
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700835};
Harald Weltee1fd9162019-02-18 19:47:53 +0100836
Harald Weltee1fd9162019-02-18 19:47:53 +0100837template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200838 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100839 msg_type := PCU_IF_MSG_INFO_IND,
840 bts_nr := bts_nr,
841 spare := '0000'O,
842 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200843 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100844 }
845}
Harald Welted378a252018-03-13 17:02:14 +0100846template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
847 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700848 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100849 msg_type := PCU_IF_MSG_INFO_IND,
850 bts_nr := bts_nr,
851 spare := ?,
852 u := {
853 info_ind := {
854 version := version,
855 flags := flags,
856 trx := ?,
857 bsic := ?,
858 mcc := ?,
859 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100860 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100861 lac := ?,
862 rac := ?,
863 nsei := ?,
864 nse_timer := ?,
865 cell_timer := ?,
866 cell_id := ?,
867 repeat_time := ?,
868 repeat_count := ?,
869 bvci := ?,
870 t3142 := ?,
871 t3169 := ?,
872 t3191 := ?,
873 t3193_10ms := ?,
874 t3195 := ?,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100875 n3101 := ?,
876 n3103 := ?,
877 n3105 := ?,
Harald Welted378a252018-03-13 17:02:14 +0100878 cv_countdown := ?,
879 dl_tbf_ext := ?,
880 ul_tbf_ext := ?,
881 initial_cs := ?,
882 initial_mcs := ?,
883 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700884 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100885 remote_port := ?,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200886 remote_addr := ?
Harald Welted378a252018-03-13 17:02:14 +0100887 }
888 }
889}
890
Harald Weltea3219812019-03-02 00:02:28 +0100891template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
892 template (value) uint32_t fn) := {
893 msg_type := PCU_IF_MSG_TIME_IND,
894 bts_nr := bts_nr,
895 spare := '0000'O,
896 u := {
897 time_ind := {
898 fn := fn
899 }
900 }
901}
902template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
903 template uint32_t fn) := {
904 msg_type := PCU_IF_MSG_TIME_IND,
905 bts_nr := bts_nr,
906 spare := ?,
907 u := {
908 time_ind := {
909 fn := fn
910 }
911 }
912}
Harald Welte883340c2018-02-28 18:59:29 +0100913
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200914template (value) PCUIF_Message
915ts_PCUIF_INTERF_IND(template (value) uint8_t bts_nr,
916 template (value) uint8_t trx_nr,
917 template (value) uint32_t fn,
918 template (value) PCUIF_interf interf) := {
919 msg_type := PCU_IF_MSG_INTERF_IND,
920 bts_nr := bts_nr,
921 spare := '0000'O,
922 u := {
923 interf_ind := {
924 trx_nr := trx_nr,
925 spare := '000000'O,
926 fn := fn,
927 interf := interf
928 }
929 }
930}
931template PCUIF_Message
932tr_PCUIF_INTERF_IND(template (present) uint8_t bts_nr := ?,
933 template (present) uint8_t trx_nr := ?,
934 template (present) uint32_t fn := ?,
935 template (present) PCUIF_interf interf := ?) := {
936 msg_type := PCU_IF_MSG_INTERF_IND,
937 bts_nr := bts_nr,
938 spare := ?,
939 u := {
940 interf_ind := {
941 trx_nr := trx_nr,
942 spare := ?,
943 fn := fn,
944 interf := interf
945 }
946 }
947}
948
Harald Welte4bff40a2019-03-21 21:34:10 +0100949template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
950 template (value) OCT4 tlli,
951 template (value) OCT6 ra_id,
952 template (value) uint8_t cause) := {
953 msg_type := PCU_IF_MSG_SUSP_REQ,
954 bts_nr := bts_nr,
955 spare := '0000'O,
956 u := {
957 susp_req := {
958 tlli := tlli,
959 ra_id := ra_id,
960 cause := cause
961 }
962 }
963}
964template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
965 template OCT4 tlli,
966 template OCT6 ra_id,
967 template uint8_t cause) := {
968 msg_type := PCU_IF_MSG_SUSP_REQ,
969 bts_nr := bts_nr,
970 spare := '0000'O,
971 u := {
972 susp_req := {
973 tlli := tlli,
974 ra_id := ra_id,
975 cause := cause
976 }
977 }
978}
979
Harald Welte11b734c2019-09-05 14:17:54 +0200980template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
981 template (value) uint8_t app_type,
982 template (value) octetstring app_data) := {
983 msg_type := PCU_IF_MSG_APP_INFO_REQ,
984 bts_nr := bts_nr,
985 spare := '0000'O,
986 u := {
987 app_info_req := {
988 application_type := app_type,
989 len := 0, /* overwritten */
990 data := app_data
991 }
992 }
993}
994template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
995 template (present) uint8_t app_type,
996 template (present) octetstring app_data) := {
997 msg_type := PCU_IF_MSG_APP_INFO_REQ,
998 bts_nr := bts_nr,
999 spare := '0000'O,
1000 u := {
1001 app_info_req := {
1002 application_type := app_type,
1003 len := ?,
1004 data := app_data
1005 }
1006 }
1007}
1008
Harald Welte4bff40a2019-03-21 21:34:10 +01001009
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001010template (value) PCUIF_Message ts_PCUIF_CONTAINER(template (value) uint8_t bts_nr,
1011 template (value) PCUIF_container container) := {
1012 msg_type := PCU_IF_MSG_CONTAINER,
1013 bts_nr := bts_nr,
1014 spare := '0000'O,
1015 u := {
1016 container := container
1017 }
1018}
1019template (present) PCUIF_Message tr_PCUIF_CONTAINER(template (present) uint8_t bts_nr,
1020 template (present) PCUIF_container container) := {
1021 msg_type := PCU_IF_MSG_CONTAINER,
1022 bts_nr := bts_nr,
1023 spare := '0000'O,
1024 u := {
1025 container := container
1026 }
1027}
1028
1029template (value) PCUIF_container ts_PCUIF_CONT_OTHER(uint8_t msg_type, template (value) octetstring payload) := {
1030 msg_type := msg_type,
1031 spare := '00'O,
1032 len := lengthof(payload),
1033 u := {
1034 other := payload
1035 }
1036}
1037template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) uint8_t msg_type,
1038 template (present) octetstring payload) := {
1039 msg_type := msg_type,
1040 spare := '00'O,
1041 len := ?,
1042 u := {
1043 other := payload
1044 }
1045}
1046
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001047function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
1048 template (present) uint8_t trx_nr := ?)
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001049{
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001050 for (var integer nr := 0; nr < lengthof(info.trx); nr := nr + 1) {
1051 if (match(nr, trx_nr)) {
1052 info.trx[nr].pdch_mask := pdch_mask;
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001053 }
1054 }
1055}
1056
Alexander Couzense0f7c542020-09-13 17:25:18 +02001057function f_PCUIF_AF2addr_type(AddressFamily address_family)
1058return PCUIF_AddrType {
1059 if (address_family == AF_INET) {
1060 return PCUIF_ADDR_TYPE_IPV4;
1061 } else if (address_family == AF_INET6) {
1062 return PCUIF_ADDR_TYPE_IPV6;
1063 } else {
1064 return PCUIF_ADDR_TYPE_UNSPEC;
1065 }
1066}
1067
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001068/* TODO: second (redundant) NSVC connection is not (yet) supported */
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001069function f_PCUIF_RemoteAddr(PCUIF_AddrType addr_type,
1070 charstring addr_str)
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001071return PCUIF_RemoteAddr {
1072 var PCUIF_RemoteAddr remote_addr;
1073
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001074 remote_addr.addr_type[0] := addr_type;
1075 if (addr_type == PCUIF_ADDR_TYPE_IPV4) {
1076 remote_addr.addr[0] := f_inet_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001077 } else {
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001078 remote_addr.addr[0] := f_inet6_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001079 }
1080
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001081 remote_addr.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
1082 remote_addr.addr[1] := f_pad_oct(''O, 16, '00'O);
1083
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001084 return remote_addr;
1085}
1086
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001087
Harald Welte883340c2018-02-28 18:59:29 +01001088} with { encode "RAW" variant "BYTEORDER(first)" };