From 12aa50d5a26aefa739da4f1e95c0e2921e704842 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Thu, 1 Jan 2009 18:02:05 +0000 Subject: Change the subscriber and database backend gsm_subscriber is now refcounted, the db backend is leaking a lot less, db_get_subscriber will allocate the subscr record now, subscr_* will look up a subscriber in the list of currently active subscribers and add an ref to this one. The db test cases pass, more testing will be when next to the bts --- include/openbsc/gsm_subscriber.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/openbsc/gsm_subscriber.h') diff --git a/include/openbsc/gsm_subscriber.h b/include/openbsc/gsm_subscriber.h index 97c7665e3..90117d3ef 100644 --- a/include/openbsc/gsm_subscriber.h +++ b/include/openbsc/gsm_subscriber.h @@ -3,6 +3,7 @@ #include #include "gsm_data.h" +#include "linuxlist.h" #define GSM_IMEI_LENGTH 17 #define GSM_IMSI_LENGTH 17 @@ -18,6 +19,10 @@ struct gsm_subscriber { char name[GSM_NAME_LENGTH]; char extension[GSM_EXTENSION_LENGTH]; int authorized; + + /* for internal management */ + int use_count; + struct llist_head entry; }; enum gsm_subscriber_field { @@ -25,4 +30,8 @@ enum gsm_subscriber_field { GSM_SUBSCRIBER_TMSI, }; +struct gsm_subscriber *subscr_alloc(); +struct gsm_subscriber *subscr_get(struct gsm_subscriber *subscr); +struct gsm_subscriber *subscr_put(struct gsm_subscriber *subscr); + #endif /* _GSM_SUBSCR_H */ -- cgit v1.2.3