From a115052e4f354a48b9e3c7d74b08b45657eda3d8 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 12 Mar 2019 18:55:57 +0100 Subject: Move msc related code from gsm_data to bsc_msc This way ipaccess utils can be built without requiring libosmo-sigtran. Change-Id: I508188896be58ddc3bd4e9c3c661c258c06866f4 --- include/osmocom/bsc/bsc_msc_data.h | 3 +++ include/osmocom/bsc/gsm_data.h | 2 -- src/osmo-bsc/gsm_data.c | 17 ----------------- src/osmo-bsc/osmo_bsc_msc.c | 15 +++++++++++++++ tests/handover/Makefile.am | 1 + 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h index 9f2d7d8a3..520217404 100644 --- a/include/osmocom/bsc/bsc_msc_data.h +++ b/include/osmocom/bsc/bsc_msc_data.h @@ -161,6 +161,9 @@ int osmo_bsc_audio_init(struct gsm_network *network); struct bsc_msc_data *osmo_msc_data_find(struct gsm_network *, int); struct bsc_msc_data *osmo_msc_data_alloc(struct gsm_network *, int); + +struct osmo_cell_global_id *cgi_for_msc(struct bsc_msc_data *msc, struct gsm_bts *bts); + /* Helper function to calculate the port number for a given * timeslot/multiplex. This functionality is needed to support * the sccp-lite scenario where the MGW is handled externally */ diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index fb0735aee..aff73de36 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -1690,6 +1690,4 @@ void gsm_trx_all_ts_dispatch(struct gsm_bts_trx *trx, uint32_t ts_ev, void *data int bts_count_free_ts(struct gsm_bts *bts, enum gsm_phys_chan_config pchan); -struct osmo_cell_global_id *cgi_for_msc(struct bsc_msc_data *msc, struct gsm_bts *bts); - #endif /* _GSM_DATA_H */ diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c index 0198fcfe1..a12821699 100644 --- a/src/osmo-bsc/gsm_data.c +++ b/src/osmo-bsc/gsm_data.c @@ -38,7 +38,6 @@ #include #include -#include #include #include #include @@ -1694,19 +1693,3 @@ const struct value_string lchan_activate_mode_names[] = { OSMO_VALUE_STRING(FOR_VTY), {} }; - -struct osmo_cell_global_id *cgi_for_msc(struct bsc_msc_data *msc, struct gsm_bts *bts) -{ - static struct osmo_cell_global_id cgi; - cgi.lai.plmn = msc->network->plmn; - if (msc->core_plmn.mcc != GSM_MCC_MNC_INVALID) - cgi.lai.plmn.mcc = msc->core_plmn.mcc; - if (msc->core_plmn.mnc != GSM_MCC_MNC_INVALID) { - cgi.lai.plmn.mnc = msc->core_plmn.mnc; - cgi.lai.plmn.mnc_3_digits = msc->core_plmn.mnc_3_digits; - } - cgi.lai.lac = (msc->core_lac != -1) ? msc->core_lac : bts->location_area_code; - cgi.cell_identity = (msc->core_ci != -1) ? msc->core_ci : bts->cell_identity; - - return &cgi; -} diff --git a/src/osmo-bsc/osmo_bsc_msc.c b/src/osmo-bsc/osmo_bsc_msc.c index 71931e615..4df1ce4f8 100644 --- a/src/osmo-bsc/osmo_bsc_msc.c +++ b/src/osmo-bsc/osmo_bsc_msc.c @@ -119,3 +119,18 @@ struct bsc_msc_data *osmo_msc_data_alloc(struct gsm_network *net, int nr) return msc_data; } +struct osmo_cell_global_id *cgi_for_msc(struct bsc_msc_data *msc, struct gsm_bts *bts) +{ + static struct osmo_cell_global_id cgi; + cgi.lai.plmn = msc->network->plmn; + if (msc->core_plmn.mcc != GSM_MCC_MNC_INVALID) + cgi.lai.plmn.mcc = msc->core_plmn.mcc; + if (msc->core_plmn.mnc != GSM_MCC_MNC_INVALID) { + cgi.lai.plmn.mnc = msc->core_plmn.mnc; + cgi.lai.plmn.mnc_3_digits = msc->core_plmn.mnc_3_digits; + } + cgi.lai.lac = (msc->core_lac != -1) ? msc->core_lac : bts->location_area_code; + cgi.cell_identity = (msc->core_ci != -1) ? msc->core_ci : bts->cell_identity; + + return &cgi; +} diff --git a/tests/handover/Makefile.am b/tests/handover/Makefile.am index 5e9af0452..5e4440c7b 100644 --- a/tests/handover/Makefile.am +++ b/tests/handover/Makefile.am @@ -69,6 +69,7 @@ handover_test_LDADD = \ $(top_builddir)/src/osmo-bsc/neighbor_ident.o \ $(top_builddir)/src/osmo-bsc/net_init.o \ $(top_builddir)/src/osmo-bsc/osmo_bsc_lcls.o \ + $(top_builddir)/src/osmo-bsc/osmo_bsc_msc.o \ $(top_builddir)/src/osmo-bsc/paging.o \ $(top_builddir)/src/osmo-bsc/pcu_sock.o \ $(top_builddir)/src/osmo-bsc/penalty_timers.o \ -- cgit v1.2.3