aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-01-10 00:49:56 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-02-25 01:25:22 +0000
commit0e5d807297f4fd1222fafece864519c70f7965a3 (patch)
treee0842d19808a545e07ff8ce411f2a23739f0cf43 /openbsc/include
parenta369e24cb9a583ef9906a8ef9125f6ca8c6f80bf (diff)
add struct gprs_subscr, separating gprs from gsm_subscriber
Prepare for replacing gsm_subscriber with vlr_subscriber. vlr_subscriber will not make sense to be used in gprs, so have a dedicated GPRS subscriber struct. (Could change if the gprs code were to use libvlr; is currently independent). Related: OS#1592 Change-Id: Ia8b391ee009c8545763cba04505be3947835120e
Diffstat (limited to 'openbsc/include')
-rw-r--r--openbsc/include/openbsc/Makefile.am1
-rw-r--r--openbsc/include/openbsc/gprs_sgsn.h19
-rw-r--r--openbsc/include/openbsc/gprs_subscriber.h31
-rw-r--r--openbsc/include/openbsc/gsm_data.h2
-rw-r--r--openbsc/include/openbsc/gsm_subscriber.h1
5 files changed, 44 insertions, 10 deletions
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index 5cd5afc4d..30c1191d7 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -31,6 +31,7 @@ noinst_HEADERS = \
gprs_sndcp_dcomp.h \
gprs_sndcp_pcomp.h \
gprs_sndcp_xid.h \
+ gprs_subscriber.h \
gprs_utils.h \
gsm_04_08.h \
gsm_04_11.h \
diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h
index 2cc5b0c7e..c3cac7f2a 100644
--- a/openbsc/include/openbsc/gprs_sgsn.h
+++ b/openbsc/include/openbsc/gprs_sgsn.h
@@ -18,7 +18,7 @@
struct gprs_llc_lle;
struct ctrl_handle;
-struct gsm_subscriber;
+struct gprs_subscr;
enum gsm48_gsm_cause;
@@ -225,7 +225,7 @@ struct sgsn_mm_ctx {
/* the current GGSN look-up operation */
struct sgsn_ggsn_lookup *ggsn_lookup;
- struct gsm_subscriber *subscr;
+ struct gprs_subscr *subscr;
};
#define LOGMMCTXP(level, mm, fmt, args...) \
@@ -433,6 +433,7 @@ struct gsm_auth_tuple *sgsn_auth_get_tuple(struct sgsn_mm_ctx *mmctx,
/*
* GPRS subscriber data
*/
+#define GPRS_SUBSCRIBER_FIRST_CONTACT 0x00000001
#define GPRS_SUBSCRIBER_UPDATE_AUTH_INFO_PENDING (1 << 16)
#define GPRS_SUBSCRIBER_UPDATE_LOCATION_PENDING (1 << 17)
#define GPRS_SUBSCRIBER_CANCELLED (1 << 18)
@@ -446,13 +447,13 @@ struct gsm_auth_tuple *sgsn_auth_get_tuple(struct sgsn_mm_ctx *mmctx,
int gprs_subscr_init(struct sgsn_instance *sgi);
int gprs_subscr_request_update_location(struct sgsn_mm_ctx *mmctx);
int gprs_subscr_request_auth_info(struct sgsn_mm_ctx *mmctx);
-void gprs_subscr_cleanup(struct gsm_subscriber *subscr);
-struct gsm_subscriber *gprs_subscr_get_or_create(const char *imsi);
-struct gsm_subscriber *gprs_subscr_get_or_create_by_mmctx( struct sgsn_mm_ctx *mmctx);
-struct gsm_subscriber *gprs_subscr_get_by_imsi(const char *imsi);
-void gprs_subscr_cancel(struct gsm_subscriber *subscr);
-void gprs_subscr_update(struct gsm_subscriber *subscr);
-void gprs_subscr_update_auth_info(struct gsm_subscriber *subscr);
+void gprs_subscr_cleanup(struct gprs_subscr *subscr);
+struct gprs_subscr *gprs_subscr_get_or_create(const char *imsi);
+struct gprs_subscr *gprs_subscr_get_or_create_by_mmctx( struct sgsn_mm_ctx *mmctx);
+struct gprs_subscr *gprs_subscr_get_by_imsi(const char *imsi);
+void gprs_subscr_cancel(struct gprs_subscr *subscr);
+void gprs_subscr_update(struct gprs_subscr *subscr);
+void gprs_subscr_update_auth_info(struct gprs_subscr *subscr);
int gprs_subscr_rx_gsup_message(struct msgb *msg);
/* Called on subscriber data updates */
diff --git a/openbsc/include/openbsc/gprs_subscriber.h b/openbsc/include/openbsc/gprs_subscriber.h
new file mode 100644
index 000000000..be78febff
--- /dev/null
+++ b/openbsc/include/openbsc/gprs_subscriber.h
@@ -0,0 +1,31 @@
+/* GPRS subscriber details for use in SGSN land */
+#pragma once
+
+#include <stdint.h>
+
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/gsm/protocol/gsm_23_003.h>
+
+extern struct llist_head * const gprs_subscribers;
+
+struct gprs_subscr {
+ struct llist_head entry;
+ int use_count;
+
+ char imsi[GSM23003_IMSI_MAX_DIGITS+1];
+ uint32_t tmsi;
+ char imei[GSM23003_IMEISV_NUM_DIGITS+1];
+ bool authorized;
+ bool keep_in_ram;
+ uint32_t flags;
+ uint16_t lac;
+
+ struct sgsn_subscriber_data *sgsn_data;
+};
+
+struct gprs_subscr *_gprs_subscr_get(struct gprs_subscr *gsub,
+ const char *file, int line);
+struct gprs_subscr *_gprs_subscr_put(struct gprs_subscr *gsub,
+ const char *file, int line);
+#define gprs_subscr_get(gsub) _gprs_subscr_get(gsub, __BASE_FILE__, __LINE__)
+#define gprs_subscr_put(gsub) _gprs_subscr_put(gsub, __BASE_FILE__, __LINE__)
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 4425a1029..a14e59f7c 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -26,6 +26,8 @@ struct gsm_subscriber_group;
#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3]
+#define tmsi_from_string(str) strtoul(str, NULL, 10)
+
enum gsm_security_event {
GSM_SECURITY_NOAVAIL,
GSM_SECURITY_AUTH_FAILED,
diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h
index 314d61923..7e656145a 100644
--- a/openbsc/include/openbsc/gsm_subscriber.h
+++ b/openbsc/include/openbsc/gsm_subscriber.h
@@ -16,7 +16,6 @@
#define GSM_SUBSCRIBER_FIRST_CONTACT 0x00000001
/* gprs_sgsn.h defines additional flags including and above bit 16 (0x10000) */
-#define tmsi_from_string(str) strtoul(str, NULL, 10)
#define GSM_SUBSCRIBER_NO_EXPIRATION 0x0