From 519c7e1d428bfba728a76885c9c5394185a6497d Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 28 Jan 2018 02:45:46 +0100 Subject: Structural reform: Get rid of osmo_bsc_sccp_con There was always a 1:1 correspondence between gsm_subscriber_connection and osmo_bsc_sccp_con, so there's really no point in having two separate dynamically allocated data structures with pointers back and forth and another linked list around. Let's merge osmo_bsc_sccp_con into gsm_subscriber_connection for simplicity. The resulting code might not be elegant in places, but I've tried to do only the most simple changes in this patch, while further simplifications can be done in later subsequent patches. As a side-effect, this patch also fixes lchan clearing if the MSC (or the local SCCP provider) hard-disconnects the SCCP connection. Change-Id: Idd2b733477ee90d24dec369755a00f1c39c93f39 --- tests/bsc/bsc_test.c | 5 +---- tests/bssap/bssap_test.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/bsc/bsc_test.c b/tests/bsc/bsc_test.c index 19bb608e0..9c35d2f60 100644 --- a/tests/bsc/bsc_test.c +++ b/tests/bsc/bsc_test.c @@ -124,17 +124,14 @@ static void test_scan(void) struct gsm_network *net = bsc_network_init(NULL, 1, 1); struct gsm_bts *bts = gsm_bts_alloc(net, 0); - struct osmo_bsc_sccp_con *sccp_con; struct bsc_msc_data *msc; struct gsm_subscriber_connection *conn; - sccp_con = talloc_zero(net, struct osmo_bsc_sccp_con); msc = talloc_zero(net, struct bsc_msc_data); conn = talloc_zero(net, struct gsm_subscriber_connection); bts->network = net; - sccp_con->msc = msc; - conn->sccp_con = sccp_con; + conn->sccp.msc = msc; conn->lchan = &bts->c0->ts[1].lchan[0]; /* start testing with proper messages */ diff --git a/tests/bssap/bssap_test.c b/tests/bssap/bssap_test.c index 861c98fa8..ad8974f73 100644 --- a/tests/bssap/bssap_test.c +++ b/tests/bssap/bssap_test.c @@ -80,22 +80,23 @@ struct { }, }; +struct gsm_network *bsc_gsmnet; + void test_cell_identifier() { int i; int rc; - struct gsm_network *net; struct bsc_msc_data *msc; struct gsm_bts *bts; - net = bsc_network_init(NULL, 1, 1); - net->bsc_data->rf_ctrl = talloc_zero(NULL, struct osmo_bsc_rf); - net->bsc_data->rf_ctrl->policy = S_RF_ON; + bsc_gsmnet = bsc_network_init(NULL, 1, 1); + bsc_gsmnet->bsc_data->rf_ctrl = talloc_zero(NULL, struct osmo_bsc_rf); + bsc_gsmnet->bsc_data->rf_ctrl->policy = S_RF_ON; - msc = talloc_zero(net, struct bsc_msc_data); - msc->network = net; + msc = talloc_zero(bsc_gsmnet, struct bsc_msc_data); + msc->network = bsc_gsmnet; - bts = gsm_bts_alloc_register(net, GSM_BTS_TYPE_UNKNOWN, 0); + bts = gsm_bts_alloc_register(bsc_gsmnet, GSM_BTS_TYPE_UNKNOWN, 0); if (bts == NULL) { fprintf(stderr, "gsm_bts_alloc_register() returned NULL\n"); return; -- cgit v1.2.3