Implement gsm_bts_neighbor() function to determine neighbor BTS

We will need this for the actual handover algorithm implementation, as we will
only know the current BTS and the BCCH ARFCN of the strongest cell in the
measurement reports.  Using this new function, we can resolve the matching
gsm_bts.
This commit is contained in:
Harald Welte 2009-12-14 22:33:02 +01:00
parent f1dae1924a
commit 84874c9005
2 changed files with 21 additions and 0 deletions

View File

@ -501,6 +501,10 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, enum gsm_bts_type type,
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
/* Get reference to a neighbor cell on a given BCCH ARFCN */
struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, u_int16_t arfcn);
struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num);
const char *gsm_pchan_name(enum gsm_phys_chan_config c);

View File

@ -234,6 +234,23 @@ struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num)
return NULL;
}
/* Get reference to a neighbor cell on a given BCCH ARFCN */
struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, u_int16_t arfcn)
{
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)
return neigh;
}
return NULL;
}
struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num)
{
struct gsm_bts_trx *trx;