aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-10 13:56:43 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-11-12 15:50:36 +0100
commitca1cf50eb88540a229027433f26bc1246d93af09 (patch)
tree727660105eedfa63f00040e43b6a93bb38333d71 /openbsc/src/libmsc
parent0548ac6bbd64cd45cfe9f961a40a8ea0031646c0 (diff)
reinvent connection_for_subscr() and move to libmsc
Implement connection_for_subscr() from a completely different angle: instead of looking up lchans in bts structs, look up the subscriber in the global list of gsm_subscriber_connection. static lchan_find() is thus obsoleted. All callers of connection_for_subscr() live in libmsc, so move to libmsc. The move and edit are done in a single commit since the old and new implementation have nothing in common. Future: osmo-cscn will use this, without bts being present. Remove implementation of connection_for_subscr() from channel_test.c -- it is possible that the abort() in there was intended for a regression test, but actually it seems the implementation was merely added for linking reasons, and the abort() added to guard against the NULL return value: no comment nor the commit log indicate that the abort() is test critical; the addition was the only change in channel_test.c for that commit; at the same time a connection_for_subscr() call was added in libmsc. Change-Id: I5e0ba0ecf1726ebd540800f4e98fdfc937c904ff
Diffstat (limited to 'openbsc/src/libmsc')
-rw-r--r--openbsc/src/libmsc/gsm_subscriber.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/openbsc/src/libmsc/gsm_subscriber.c b/openbsc/src/libmsc/gsm_subscriber.c
index 08198c765..4ec0eadf9 100644
--- a/openbsc/src/libmsc/gsm_subscriber.c
+++ b/openbsc/src/libmsc/gsm_subscriber.c
@@ -374,3 +374,17 @@ void subscr_expire(struct gsm_subscriber_group *sgrp)
{
db_subscriber_expire(sgrp->net, subscr_expire_callback);
}
+
+struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr)
+{
+ /* FIXME: replace this with a backpointer in gsm_subscriber? */
+ struct gsm_network *net = subscr->group->net;
+ struct gsm_subscriber_connection *conn;
+
+ llist_for_each_entry(conn, &net->subscr_conns, entry) {
+ if (conn->subscr == subscr)
+ return conn;
+ }
+
+ return NULL;
+}