From 02ab91e6a73e16da51918b52548a0f4be4c6a0f6 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Wed, 12 Nov 2014 09:53:45 +0100 Subject: sgsn: Cross-link gsm_subscriber and sgsn_mm_ctx To implement subscriber based authorization a data structure is needed that keeps the subscriber data. The MSC already uses a similar struct named gsm_subscriber whose implementation is split into a generic part (allocation, retrieval, reference counting, list maintenance) and MSC related parts. For GPRS, only the generic part will be used and specific fields may be added when needed. This patch adds a field mm to struct gsm_subscriber that will be used by the SGSN to store a reference to the current MM context (or NULL if there is none). This also adds a field subscr to struct sgsn_mm_ctx that reversely points to a gsm_subscriber (or NULL if there is none). Either both fields are NULL or both fields are non-NULL. Note that subscr is being reference counted. Sponsored-by: On-Waves ehf --- openbsc/include/openbsc/gprs_sgsn.h | 3 +++ openbsc/include/openbsc/gsm_subscriber.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h index 7ee68cc79..4572ac23d 100644 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ b/openbsc/include/openbsc/gprs_sgsn.h @@ -16,6 +16,7 @@ struct gprs_llc_lle; struct ctrl_handle; +struct gsm_subscriber; /* TS 04.08 4.1.3.3 GMM mobility management states on the network side */ enum gprs_mm_state { @@ -126,6 +127,8 @@ struct sgsn_mm_ctx { * whether one of them can be dropped. */ enum sgsn_auth_state auth_state; + + struct gsm_subscriber *subscr; }; #define LOGMMCTXP(level, mm, fmt, args...) \ diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h index 7aae4c332..7e0a419ae 100644 --- a/openbsc/include/openbsc/gsm_subscriber.h +++ b/openbsc/include/openbsc/gsm_subscriber.h @@ -18,6 +18,7 @@ #define GSM_SUBSCRIBER_NO_EXPIRATION 0x0 struct vty; +struct sgsn_mm_ctx; struct gsm_equipment { long long unsigned int id; @@ -56,6 +57,9 @@ struct gsm_subscriber { /* pending requests */ int in_callback; struct llist_head requests; + + /* GPRS/SGSN related fields */ + struct sgsn_mm_ctx *mm; }; enum gsm_subscriber_field { -- cgit v1.2.3