Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 1 | module HNBGW_ConnectionHandler { |
| 2 | |
| 3 | /* HNBGW Connection Handler of HNB_Tests in TTCN-3 |
| 4 | * (C) 2021 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de> |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | */ |
| 12 | |
| 13 | import from Misc_Helpers all; |
| 14 | import from General_Types all; |
| 15 | import from Osmocom_Types all; |
| 16 | import from IPL4asp_Types all; |
| 17 | import from Native_Functions all; |
| 18 | |
| 19 | import from SDP_Types all; |
| 20 | |
| 21 | import from StatsD_Checker all; |
| 22 | |
| 23 | import from TELNETasp_PortType all; |
| 24 | import from Osmocom_VTY_Functions all; |
| 25 | |
| 26 | import from HNBAP_Templates all; |
| 27 | |
| 28 | import from Iuh_Emulation all; |
| 29 | |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 30 | import from RTP_Types all; |
| 31 | import from RTP_Emulation all; |
| 32 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 33 | import from HNBLLIF_CodecPort all; |
| 34 | import from HNBLLIF_Types all; |
| 35 | import from HNBLLIF_Templates all; |
| 36 | |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 37 | import from GTP_Emulation all; |
| 38 | import from GTP_Templates all; |
| 39 | import from GTP_CodecPort all; |
| 40 | import from GTPU_Types all; |
| 41 | |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 42 | /* this component represents a single Iuh connection at the HNBGW. */ |
Harald Welte | cb3e2d7 | 2022-01-10 19:14:28 +0100 | [diff] [blame] | 43 | type component HNBGW_ConnHdlr extends Iuh_ConnHdlr, GTP_ConnHdlr, StatsD_ConnHdlr { |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 44 | port TELNETasp_PT HNBVTY; |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 45 | /* HNBLLIF Interface of HNodeB */ |
| 46 | port HNBLLIF_CODEC_PT LLSK; |
| 47 | var integer g_llsk_conn_id; |
| 48 | |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 49 | var RTP_Emulation_CT vc_RTPEM; |
| 50 | port RTPEM_CTRL_PT RTPEM_CTRL; |
| 51 | port RTPEM_DATA_PT RTPEM_DATA; |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 52 | |
| 53 | var GTP_Emulation_CT vc_GTP; |
| 54 | |
| 55 | |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 56 | var TestHdlrParams g_pars; |
| 57 | |
| 58 | var boolean g_vty_initialized := false; |
| 59 | } |
| 60 | |
| 61 | function f_HNBGW_ConnHdlr_init_vty() runs on HNBGW_ConnHdlr { |
| 62 | if (not g_vty_initialized) { |
| 63 | map(self:HNBVTY, system:HNBVTY); |
| 64 | f_vty_set_prompts(HNBVTY); |
| 65 | f_vty_transceive(HNBVTY, "enable"); |
| 66 | g_vty_initialized := true; |
| 67 | } |
| 68 | } |
| 69 | |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 70 | private function f_HNBGW_ConnHdlr_init_iuh(charstring id) runs on HNBGW_ConnHdlr { |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 71 | var Iuh_Emulation_CT vc_Iuh; |
Pau Espin Pedrol | 637beab | 2021-12-20 12:45:09 +0100 | [diff] [blame] | 72 | vc_Iuh := Iuh_Emulation_CT.create(id & "-HNBGW") alive; |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 73 | connect(self:HNBAP, vc_Iuh:HNBAP); |
| 74 | connect(self:RUA, vc_Iuh:RUA); |
| 75 | |
| 76 | var Iuh_conn_parameters iuh_pars; |
| 77 | iuh_pars.remote_ip := g_pars.hnodeb_addr; |
| 78 | iuh_pars.remote_sctp_port := -1; |
| 79 | iuh_pars.local_ip := g_pars.hnbgw_addr; |
| 80 | iuh_pars.local_sctp_port := g_pars.hnbgw_port; |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 81 | vc_Iuh.start(Iuh_Emulation.main(iuh_pars, id & "-Iuh")); |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 82 | } |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 83 | |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 84 | private function f_HNBGW_ConnHdlr_init_gtp(charstring id) runs on HNBGW_ConnHdlr { |
| 85 | id := id & "-GTP"; |
| 86 | |
| 87 | var GtpEmulationCfg gtp_cfg := { |
| 88 | gtpc_bind_ip := g_pars.hnbgw_addr, |
| 89 | gtpc_bind_port := GTP1C_PORT, |
| 90 | gtpu_bind_ip := g_pars.hnbgw_addr, |
| 91 | gtpu_bind_port := GTP1U_PORT, |
| 92 | sgsn_role := false |
| 93 | }; |
| 94 | |
Pau Espin Pedrol | 637beab | 2021-12-20 12:45:09 +0100 | [diff] [blame] | 95 | vc_GTP := GTP_Emulation_CT.create(id) alive; |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 96 | connect(self:GTP, vc_GTP:CLIENT); |
| 97 | connect(self:GTP_PROC, vc_GTP:CLIENT_PROC); |
| 98 | vc_GTP.start(GTP_Emulation.main(gtp_cfg)); |
| 99 | } |
| 100 | |
| 101 | /* initialize all parameters */ |
| 102 | function f_HNBGW_ConnHdlr_init(charstring id, TestHdlrParams pars) runs on HNBGW_ConnHdlr { |
| 103 | g_pars := valueof(pars); |
| 104 | f_HNBGW_ConnHdlr_init_iuh(id); |
| 105 | f_HNBGW_ConnHdlr_init_gtp(id); |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 106 | f_HNBGW_ConnHdlr_init_vty(); |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 107 | |
| 108 | /* Connect to HNB on LLSK and do HELLO ping-pong */ |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 109 | f_start_hnbllif(LLSK, id & "-LLSK", g_pars, g_llsk_conn_id); |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 113 | function f_start_hnbllif(HNBLLIF_CODEC_PT pt, charstring id, TestHdlrParams pars, |
| 114 | out integer hnbllif_conn_id) { |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 115 | timer T := 2.0; |
| 116 | var HNBLLIF_send_data sd; |
| 117 | var HNBLLIF_Message last_hello_cnf; |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 118 | if (pars.hnbllif_sk_path == "") { |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 119 | hnbllif_conn_id := -1; |
| 120 | return; |
| 121 | } |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 122 | hnbllif_conn_id := f_hnbllif_connect(pt, pars.hnbllif_sk_path); |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 123 | |
| 124 | T.start; |
| 125 | pt.send(t_SD_HNBLLIF(hnbllif_conn_id, ts_HNBLLIF_CTL_HELLO_REQ(HNBLL_IF_SAPI_CTL, HNBLLIF_Types.mp_hnbllif_version))); |
| 126 | alt { |
| 127 | [] as_hnbllif_hello_cnf(pt, hnbllif_conn_id, last_hello_cnf, HNBLL_IF_SAPI_CTL, HNBLLIF_Types.mp_hnbllif_version); |
| 128 | [] T.timeout { |
| 129 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for HNBLLIF HELLO.REQ SAPI=CTL"); |
| 130 | } |
| 131 | } |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 132 | pt.send(t_SD_HNBLLIF(hnbllif_conn_id, ts_HNBLLIF_CTL_HELLO_REQ(HNBLL_IF_SAPI_IUH, pars.hnbllif_sapi_iuh_version))); |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 133 | alt { |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 134 | [] as_hnbllif_hello_cnf(pt, hnbllif_conn_id, last_hello_cnf, HNBLL_IF_SAPI_IUH, pars.hnbllif_sapi_iuh_version); |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 135 | [] T.timeout { |
| 136 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for HNBLLIF HELLO.REQ SAPI=IUH"); |
| 137 | } |
| 138 | } |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 139 | pt.send(t_SD_HNBLLIF(hnbllif_conn_id, ts_HNBLLIF_CTL_HELLO_REQ(HNBLL_IF_SAPI_AUDIO, pars.hnbllif_sapi_audio_version))); |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 140 | alt { |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 141 | [] as_hnbllif_hello_cnf(pt, hnbllif_conn_id, last_hello_cnf, HNBLL_IF_SAPI_AUDIO, pars.hnbllif_sapi_audio_version); |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 142 | [] T.timeout { |
| 143 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for HNBLLIF HELLO.REQ SAPI=AUDIO"); |
| 144 | } |
| 145 | } |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 146 | pt.send(t_SD_HNBLLIF(hnbllif_conn_id, ts_HNBLLIF_CTL_HELLO_REQ(HNBLL_IF_SAPI_GTP, pars.hnbllif_sapi_gtp_version))); |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 147 | alt { |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 148 | [] as_hnbllif_hello_cnf(pt, hnbllif_conn_id, last_hello_cnf, HNBLL_IF_SAPI_GTP, pars.hnbllif_sapi_gtp_version); |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 149 | [] T.timeout { |
| 150 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for HNBLLIF HELLO.REQ SAPI=GTP"); |
| 151 | } |
| 152 | } |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | type record TestHdlrParams { |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 156 | charstring hnbllif_sk_path, /* "" means don't connect */ |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 157 | uint16_t hnbllif_sapi_iuh_version, |
| 158 | uint16_t hnbllif_sapi_gtp_version, |
| 159 | uint16_t hnbllif_sapi_audio_version, |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 160 | charstring hnbgw_addr, |
| 161 | charstring hnodeb_addr, |
| 162 | integer hnbgw_port, |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 163 | integer hnbgw_rtp_port, |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 164 | uint16_t rnc_id, |
| 165 | charstring hNB_Identity_Info, |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 166 | uint16_t mcc, |
| 167 | uint16_t mnc, |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 168 | uint32_t cell_identity, |
| 169 | uint16_t lac, |
| 170 | uint8_t rac, |
| 171 | uint8_t sac |
| 172 | }; |
| 173 | |
| 174 | /* Note: Do not use valueof() to get a value of this template, use |
| 175 | * f_gen_test_hdlr_pars() instead in order to get a configuration. */ |
| 176 | template (value) TestHdlrParams t_def_TestHdlrPars := { |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 177 | hnbllif_sk_path := HNBLL_SOCK_DEFAULT, |
Pau Espin Pedrol | 85e1853 | 2022-06-09 11:49:33 +0200 | [diff] [blame] | 178 | hnbllif_sapi_iuh_version := 0, |
| 179 | hnbllif_sapi_gtp_version := 0, |
Pau Espin Pedrol | 4759074 | 2022-06-09 11:52:21 +0200 | [diff] [blame] | 180 | hnbllif_sapi_audio_version := 1, |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 181 | hnbgw_addr := "127.0.0.1", |
| 182 | hnodeb_addr := "127.0.0.1", |
| 183 | hnbgw_port := 29169, |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 184 | hnbgw_rtp_port := 9000, |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 185 | rnc_id := 23, |
| 186 | hNB_Identity_Info := "OsmoHNodeB", |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 187 | mcc := 1, |
| 188 | mnc := 1, |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 189 | cell_identity := 1, |
| 190 | lac := 2, |
| 191 | rac := 3, |
| 192 | sac := 4 |
| 193 | } |
| 194 | |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 195 | template (value) GtpPeer ts_GtpPeerU(charstring ip) := { |
| 196 | connId := 1, |
| 197 | remName := ip, |
| 198 | remPort := GTP1U_PORT |
| 199 | } |
| 200 | |
| 201 | function f_gtpu_send(uint32_t tei, octetstring payload) runs on HNBGW_ConnHdlr { |
| 202 | var GtpPeer peer := valueof(ts_GtpPeerU(g_pars.hnodeb_addr)); |
| 203 | GTP.send(ts_GTP1U_GPDU(peer, 0 /*seq*/, int2oct(tei, 4), payload)); |
| 204 | } |
| 205 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 206 | /* HNBLLIF socket may at any time receive a new INFO.ind */ |
| 207 | altstep as_hnbllif_hello_cnf(HNBLLIF_CODEC_PT pt, integer hnbllif_conn_id, |
| 208 | out HNBLLIF_Message last_hello_cnf, |
| 209 | template (present) HNBLLIF_Sapi exp_sapi := ?, |
| 210 | template (present) uint16_t exp_version := ?) { |
| 211 | var HNBLLIF_send_data sd; |
| 212 | [] pt.receive(t_SD_HNBLLIF(hnbllif_conn_id, tr_HNBLLIF_CTL_HELLO_CNF(exp_sapi, exp_version))) -> value sd { |
| 213 | last_hello_cnf := sd.data; |
| 214 | } |
| 215 | [] pt.receive(t_SD_HNBLLIF(hnbllif_conn_id, tr_HNBLLIF_CTL_HELLO_CNF(?))) -> value sd { |
| 216 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Invalid API_VERSION received"); |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | function f_llsk_rx(template (present) HNBLLIF_Message exp_tmpl) runs on HNBGW_ConnHdlr |
| 221 | return template (present) HNBLLIF_send_data { |
| 222 | return t_SD_HNBLLIF(g_llsk_conn_id, exp_tmpl); |
| 223 | } |
| 224 | |
| 225 | function f_llsk_tx(template (value) HNBLLIF_Message tx_msg) runs on HNBGW_ConnHdlr |
| 226 | return template (value) HNBLLIF_send_data { |
| 227 | return ts_SD_HNBLLIF(g_llsk_conn_id, tx_msg); |
| 228 | } |
| 229 | |
| 230 | function f_enc_mcc_mnc(uint16_t mcc_uint, uint16_t mnc_uint) return OCT3 { |
| 231 | var hexstring mnc; |
| 232 | var hexstring mcc := int2hex(mcc_uint, 3); |
| 233 | |
| 234 | if (mnc_uint < 100) { |
| 235 | mnc := int2hex(mnc_uint, 2); |
| 236 | return hex2oct(mcc[1] & mcc[0] & 'F'H & mcc[2] & mnc[1] & mnc[0]); |
| 237 | } else { |
| 238 | mnc := int2hex(mnc_uint, 3); |
| 239 | return hex2oct(mcc[1] & mcc[0] & mnc[2] & mcc[2] & mnc[1] & mnc[0]); |
| 240 | } |
| 241 | } |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 242 | |
| 243 | function f_handle_hnbap_hnb_register_req() |
| 244 | runs on HNBGW_ConnHdlr { |
| 245 | HNBAP.receive(tr_HNBAP_HNBRegisterRequest(char2oct(g_pars.hNB_Identity_Info), |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 246 | f_enc_mcc_mnc(g_pars.mcc, g_pars.mnc), |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 247 | int2bit(g_pars.cell_identity, 28), |
| 248 | int2oct(g_pars.lac, 2), |
| 249 | int2oct(g_pars.rac, 1), |
| 250 | int2oct(g_pars.sac, 2) |
| 251 | )); |
| 252 | HNBAP.send(ts_HNBAP_HNBRegisterAccept(g_pars.rnc_id)); |
| 253 | } |
| 254 | |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 255 | /* Initialize and start the RTP emulation component for a ConnHdlr */ |
Pau Espin Pedrol | 58a69df | 2021-12-21 14:48:23 +0100 | [diff] [blame] | 256 | function f_HNBGW_rtpem_activate(inout octetstring payload) |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 257 | runs on HNBGW_ConnHdlr { |
Pau Espin Pedrol | 58a69df | 2021-12-21 14:48:23 +0100 | [diff] [blame] | 258 | /* Initialize, connect and start the emulation component */ |
| 259 | var RtpemConfig cfg := c_RtpemDefaultCfg; |
| 260 | cfg.iuup_mode := true; |
Pau Espin Pedrol | 6ed7630 | 2022-05-25 18:09:37 +0200 | [diff] [blame] | 261 | cfg.iuup_cfg.active_init := false; |
Philipp Maier | bbe454d | 2023-03-28 15:31:57 +0200 | [diff] [blame] | 262 | cfg.tx_payloads[0].payload_type := 96; |
| 263 | cfg.rx_payloads[0].payload_type := 96; |
Pau Espin Pedrol | 58a69df | 2021-12-21 14:48:23 +0100 | [diff] [blame] | 264 | |
Pau Espin Pedrol | 637beab | 2021-12-20 12:45:09 +0100 | [diff] [blame] | 265 | vc_RTPEM := RTP_Emulation_CT.create(testcasename() & "-RTPEM") alive; |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 266 | map(vc_RTPEM:RTP, system:RTP); |
| 267 | map(vc_RTPEM:RTCP, system:RTCP); |
| 268 | connect(vc_RTPEM:CTRL, self:RTPEM_CTRL); |
| 269 | connect(vc_RTPEM:DATA, self:RTPEM_DATA); |
| 270 | vc_RTPEM.start(RTP_Emulation.f_main()); |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 271 | |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 272 | /* Configure the RTP parameters (TCH/FS). TODO: IuUP */ |
| 273 | var integer payload_len := 33; |
| 274 | var octetstring hdr := 'D0'O; |
| 275 | |
| 276 | /* Pad the payload to conform the expected length */ |
| 277 | payload := f_pad_oct(hdr & payload, payload_len, '00'O); |
Philipp Maier | bbe454d | 2023-03-28 15:31:57 +0200 | [diff] [blame] | 278 | cfg.tx_payloads[0].fixed_payload := payload; |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 279 | f_rtpem_configure(RTPEM_CTRL, cfg); |
| 280 | |
| 281 | /* Bind the RTP emulation to the configured address */ |
| 282 | f_rtpem_bind(RTPEM_CTRL, g_pars.hnbgw_addr, g_pars.hnbgw_rtp_port); |
| 283 | |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 284 | /* Set the given RTP emulation mode */ |
Pau Espin Pedrol | 58a69df | 2021-12-21 14:48:23 +0100 | [diff] [blame] | 285 | f_rtpem_mode(RTPEM_CTRL, RTPEM_MODE_RXONLY); |
| 286 | } |
| 287 | |
| 288 | function f_HNBGW_rtpem_connect(HostName remote_host, PortNumber remote_port) |
| 289 | runs on HNBGW_ConnHdlr { |
| 290 | f_rtpem_connect(RTPEM_CTRL, remote_host, remote_port); |
| 291 | /* Set the given RTP emulation mode */ |
| 292 | f_rtpem_mode(RTPEM_CTRL, RTPEM_MODE_BIDIR); |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 293 | } |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 294 | |
| 295 | } |