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
diff --git a/include/openbsc/gsm_subscriber.h b/include/openbsc/gsm_subscriber.h
index 97c7665..90117d3 100644
--- a/include/openbsc/gsm_subscriber.h
+++ b/include/openbsc/gsm_subscriber.h
@@ -3,6 +3,7 @@
#include <sys/types.h>
#include "gsm_data.h"
+#include "linuxlist.h"
#define GSM_IMEI_LENGTH 17
#define GSM_IMSI_LENGTH 17
@@ -18,6 +19,10 @@
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 @@
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 */