summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2009-05-23 13:56:40 +0000
committerHarald Welte <laforge@gnumonks.org>2009-05-23 13:56:40 +0000
commitbe99149e72a22180a1b8acaa0a6182b02c5387c3 (patch)
treed1db473c5e38b8079bf3e9ec46641e156ea2ac45 /src
parentc1d2aaecb57e00e07275c3618c85e1bf85a4dc1e (diff)
add new function gsm_bts_by_lac() to search for BTS based on location area
Diffstat (limited to 'src')
-rw-r--r--src/gsm_data.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gsm_data.c b/src/gsm_data.c
index f654d909f..78f976514 100644
--- a/src/gsm_data.c
+++ b/src/gsm_data.c
@@ -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;
+}