msc: Add and use gsm_subscriber_group
Currently every subcriber object directly refers to the gsm_network
which contains a flag shared by every related subscriber
(keep_subscr). This adds a dependency on gsm_network even if only the
function defined in gsm_subscriber_base.c are used.
This patch adds a new struct gsm_subscriber_group which contains the
keep_subscr flag and a back reference to the network object. The
latter is not dereferenced in gsm_subscriber_base.c, so it can safely
be set to NULL when only that part of the gsm_subscriber API is being
used. It also changes that API to use gsm_subscriber_group instead of
gsm_network parameters.
Since there are some places where a pointer to the gsm_network is
needed but where only a gsm_subscriber is available, a 'net' back
pointer is added to the group struct, too. Nevertheless subscr group
and network could be separated completely, but this is not the topic
of this commit.
Sponsored-by: On-Waves ehf
diff --git a/openbsc/src/libmsc/token_auth.c b/openbsc/src/libmsc/token_auth.c
index 45b5a8e..95fd9b3 100644
--- a/openbsc/src/libmsc/token_auth.c
+++ b/openbsc/src/libmsc/token_auth.c
@@ -59,7 +59,7 @@
if (signal != S_SUBSCR_ATTACHED)
return 0;
- if (subscr->net->auth_policy != GSM_AUTH_POLICY_TOKEN)
+ if (subscr->group->net->auth_policy != GSM_AUTH_POLICY_TOKEN)
return 0;
if (subscr->flags & GSM_SUBSCRIBER_FIRST_CONTACT) {
@@ -82,7 +82,7 @@
/* FIXME: don't use ID 1 static */
- sender = subscr_get_by_id(subscr->net, 1);
+ sender = subscr_get_by_id(subscr->group, 1);
sms = sms_from_text(subscr, sender, 0, sms_str);
@@ -136,7 +136,7 @@
return 0;
- if (sms->receiver->net->auth_policy != GSM_AUTH_POLICY_TOKEN)
+ if (sms->receiver->group->net->auth_policy != GSM_AUTH_POLICY_TOKEN)
return 0;