move gsm_bts_num() to gsm_data_shared.[ch]

this way we can drop a copy of this function from osmo-bts.
This commit is contained in:
Harald Welte 2014-08-24 09:50:10 +02:00
parent dd588ae2ce
commit 1449c9f06f
4 changed files with 17 additions and 18 deletions

View File

@ -332,8 +332,6 @@ struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_cod
int (*mncc_recv)(struct gsm_network *, struct msgb *));
int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type);
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,
uint16_t arfcn, uint8_t bsic);

View File

@ -741,8 +741,9 @@ struct gsm_bts {
struct gsm_bts *gsm_bts_alloc(void *talloc_ctx);
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num);

View File

@ -150,21 +150,6 @@ struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_cod
return net;
}
struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num)
{
struct gsm_bts *bts;
if (num >= net->num_bts)
return NULL;
llist_for_each_entry(bts, &net->bts_list, list) {
if (bts->nr == num)
return bts;
}
return NULL;
}
/* 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)

View File

@ -132,6 +132,21 @@ const char *gsm_chreq_name(enum gsm_chreq_reason_t c)
return get_value_string(chreq_names, c);
}
struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num)
{
struct gsm_bts *bts;
if (num >= net->num_bts)
return NULL;
llist_for_each_entry(bts, &net->bts_list, list) {
if (bts->nr == num)
return bts;
}
return NULL;
}
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
{
struct gsm_bts_trx *trx = talloc_zero(bts, struct gsm_bts_trx);