aboutsummaryrefslogtreecommitdiffstats
path: root/tests/emu/pcu_emu.cpp
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2020-09-16 21:52:02 +0200
committerAlexander Couzens <lynxis@fe80.eu>2020-10-06 16:38:38 +0200
commit290d9030e9eece679197f5d85593a4aa8c8672c7 (patch)
tree4ba45cb8aef0f3db905ad85fdef4e8a83c355bbe /tests/emu/pcu_emu.cpp
parent0a369e560cef5967bdf47a7ee9b36bf98b418cc8 (diff)
Use the new NS2 lib
Diffstat (limited to 'tests/emu/pcu_emu.cpp')
-rw-r--r--tests/emu/pcu_emu.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/tests/emu/pcu_emu.cpp b/tests/emu/pcu_emu.cpp
index 7f993551..98da13e4 100644
--- a/tests/emu/pcu_emu.cpp
+++ b/tests/emu/pcu_emu.cpp
@@ -93,15 +93,28 @@ void create_and_connect_bssgp(struct gprs_rlcmac_bts *bts,
uint32_t sgsn_ip, uint16_t sgsn_port)
{
struct gprs_bssgp_pcu *pcu;
+ struct osmo_sockaddr local, remote;
+
+ local.u.sin.sin_family = AF_INET;
+ local.u.sin.sin_addr.s_addr = 0;
+ local.u.sin.sin_port = 0;
+
+ remote.u.sin.sin_family = AF_INET;
+ remote.u.sin.sin_addr.s_addr = htonl(sgsn_ip);
+ remote.u.sin.sin_port = htons(sgsn_port);
+
+ pcu = gprs_bssgp_init(bts, 20, 20, 901, 99, false, 1, 0, 0);
+ gprs_nsvc_create_and_connect(bts, &local, &remote,
+ 20, 20);
- pcu = gprs_bssgp_create_and_connect(bts, 0, sgsn_ip, sgsn_port,
- 20, 20, 20, 901, 99, false, 1, 0, 0);
pcu->on_unblock_ack = bvci_unblocked;
pcu->on_dl_unit_data = bssgp_data;
}
int main(int argc, char **argv)
{
+ struct gprs_rlcmac_bts *bts = bts_main_data();
+
tall_pcu_ctx = talloc_named_const(NULL, 1, "moiji-mobile Emu-PCU context");
if (!tall_pcu_ctx)
abort();
@@ -109,8 +122,8 @@ int main(int argc, char **argv)
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
- bssgp_nsi = gprs_ns_instantiate(&gprs_bssgp_ns_cb, tall_pcu_ctx);
- if (!bssgp_nsi) {
+ bts->nsi = gprs_ns2_instantiate(tall_pcu_ctx, &gprs_ns_prim_cb, NULL);
+ if (!bts->nsi) {
LOGP(DBSSGP, LOGL_ERROR, "Failed to create NS instance\n");
abort();
}
@@ -121,7 +134,8 @@ int main(int argc, char **argv)
current_test = 0;
init_main_bts();
- create_and_connect_bssgp(bts_main_data(), INADDR_LOOPBACK, 23000);
+ bssgp_set_bssgp_callback(gprs_gp_send_cb, bts->nsi);
+ create_and_connect_bssgp(bts, INADDR_LOOPBACK, 23000);
for (;;)
osmo_select_main(0);