From 6d1c073311150935c2839beab9f665791b536de4 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 10 May 2016 13:59:16 +0200 Subject: move to libbsc: gsm_bts_neighbor() -- TODO really? Change-Id: I63d4835dc7aabdf176e0ca634a6a4ca527612693 --- openbsc/include/openbsc/gsm_data.h | 4 ---- openbsc/src/libbsc/handover_decision.c | 21 +++++++++++++++++++++ openbsc/src/libcommon/gsm_data.c | 19 ------------------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index c9607adc7..3fbd75d45 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -458,10 +458,6 @@ extern void talloc_ctx_init(void *ctx_root); int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type); -/* Get reference to a neighbor cell on a given BCCH ARFCN */ -struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, - uint16_t arfcn, uint8_t bsic); - enum gsm_bts_type parse_btstype(const char *arg); const char *btstype2str(enum gsm_bts_type type); struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac, diff --git a/openbsc/src/libbsc/handover_decision.c b/openbsc/src/libbsc/handover_decision.c index 0f07bcac6..8d7e047b7 100644 --- a/openbsc/src/libbsc/handover_decision.c +++ b/openbsc/src/libbsc/handover_decision.c @@ -33,6 +33,27 @@ #include #include +/* Get reference to a neighbor cell on a given BCCH ARFCN */ +static struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, + uint16_t arfcn, uint8_t bsic) +{ + struct gsm_bts *neigh; + /* FIXME: use some better heuristics here to determine which cell + * using this ARFCN really is closest to the target cell. For + * now we simply assume that each ARFCN will only be used by one + * cell */ + + llist_for_each_entry(neigh, &bts->network->bts_list, list) { + /* FIXME: this is probably returning the same bts again!? */ + if (neigh->c0->arfcn == arfcn && + neigh->bsic == bsic) + return neigh; + } + + return NULL; +} + + /* issue handover to a cell identified by ARFCN and BSIC */ static int handover_to_arfcn_bsic(struct gsm_lchan *lchan, uint16_t arfcn, uint8_t bsic) diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index 240d403ba..fc8a9d6c0 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -71,25 +71,6 @@ int gsm_bts_model_register(struct gsm_bts_model *model) return 0; } -/* Get reference to a neighbor cell on a given BCCH ARFCN */ -struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, - uint16_t arfcn, uint8_t bsic) -{ - struct gsm_bts *neigh; - /* FIXME: use some better heuristics here to determine which cell - * using this ARFCN really is closest to the target cell. For - * now we simply assume that each ARFCN will only be used by one - * cell */ - - llist_for_each_entry(neigh, &bts->network->bts_list, list) { - if (neigh->c0->arfcn == arfcn && - neigh->bsic == bsic) - return neigh; - } - - return NULL; -} - const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE+1] = { { GSM_BTS_TYPE_UNKNOWN, "unknown" }, { GSM_BTS_TYPE_BS11, "bs11" }, -- cgit v1.2.3