add new function gsm_bts_by_lac() to search for BTS based on location area
This commit is contained in:
parent
c1d2aaecb5
commit
be99149e72
|
@ -349,6 +349,8 @@ void set_ts_e1link(struct gsm_bts_trx_ts *ts, u_int8_t e1_nr,
|
|||
u_int8_t e1_ts, u_int8_t e1_ts_ss);
|
||||
enum gsm_bts_type parse_btstype(char *arg);
|
||||
char *btstype2str(enum gsm_bts_type type);
|
||||
struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
|
||||
struct gsm_bts *start_bts);
|
||||
|
||||
static inline int is_ipaccess_bts(struct gsm_bts *bts)
|
||||
{
|
||||
|
|
|
@ -179,3 +179,30 @@ char *btstype2str(enum gsm_bts_type type)
|
|||
return "undefined";
|
||||
return bts_types[type];
|
||||
}
|
||||
|
||||
/* Search for a BTS in the given Location Area; optionally start searching
|
||||
* with start_bts (for continuing to search after the first result) */
|
||||
struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
|
||||
struct gsm_bts *start_bts)
|
||||
{
|
||||
int i;
|
||||
struct gsm_bts *bts;
|
||||
int skip = 0;
|
||||
|
||||
if (start_bts)
|
||||
skip = 1;
|
||||
|
||||
for (i = 0; i < net->num_bts; i++) {
|
||||
bts = &net->bts[i];
|
||||
|
||||
if (skip) {
|
||||
if (start_bts == bts)
|
||||
skip = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bts->location_area_code == lac)
|
||||
return bts;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue