aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-06-30 10:25:49 +0200
committerHarald Welte <laforge@gnumonks.org>2016-07-09 19:52:54 +0000
commite6052c4cc756f7d3a5023a0ba57fe8d80783967c (patch)
tree477d30b6379ca349ce10b588f10c20e23baf717f /openbsc/include
parent9f8f9b80214fabfb3ac7674341c18a61a6ffcc5f (diff)
Make random MSISDN assignment optional
Previously if subscriber was automatically created it got assigned random MSISDN number. Make it optional (defaulting to previous behavior) by adding following: * new optional no-extension argument for subscriber-create-on-demand vty command * db unit tests * vty test Note: using the db made with new code might result in subscribers with empty extension. Such subscribers cannot be deleted using old code. Make sure not to mix db versions or manually fix it by editing sqlite with external program. Fixes: OS#1658 Change-Id: Ibbc2e88e4722b08854ebc631485f19ed56443cbb
Diffstat (limited to 'openbsc/include')
-rw-r--r--openbsc/include/openbsc/db.h4
-rw-r--r--openbsc/include/openbsc/gsm_data.h10
-rw-r--r--openbsc/include/openbsc/gsm_subscriber.h5
3 files changed, 9 insertions, 10 deletions
diff --git a/openbsc/include/openbsc/db.h b/openbsc/include/openbsc/db.h
index 6ffe1ade9..bb90705ab 100644
--- a/openbsc/include/openbsc/db.h
+++ b/openbsc/include/openbsc/db.h
@@ -20,6 +20,8 @@
#ifndef _DB_H
#define _DB_H
+#include <stdbool.h>
+
#include "gsm_subscriber.h"
struct gsm_equipment;
@@ -36,7 +38,7 @@ int db_fini(void);
/* subscriber management */
struct gsm_subscriber *db_create_subscriber(const char *imsi, uint64_t smin,
- uint64_t smax);
+ uint64_t smax, bool alloc_exten);
struct gsm_subscriber *db_get_subscriber(enum gsm_subscriber_field field,
const char *subscr);
int db_sync_subscriber(struct gsm_subscriber *subscriber);
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index e7cd520d2..bdcd0e0dc 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -4,6 +4,7 @@
#include <stdint.h>
#include <regex.h>
#include <sys/types.h>
+#include <stdbool.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/select.h>
@@ -21,12 +22,6 @@ struct gsm_subscriber_group;
#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3]
-enum gsm_subscr_creation_mode {
- GSM_SUBSCR_DONT_CREATE = 0,
- GSM_SUBSCR_CREAT_W_RAND_EXT = 1,
- GSM_SUBSCR_CREAT_W_REGEXP = 2,
-};
-
enum gsm_security_event {
GSM_SECURITY_NOAVAIL,
GSM_SECURITY_AUTH_FAILED,
@@ -289,7 +284,8 @@ struct gsm_network {
struct osmo_bsc_data *bsc_data;
/* subscriber related features */
- int subscr_creation_mode;
+ bool auto_create_subscr;
+ bool auto_assign_exten;
uint64_t ext_min;
uint64_t ext_max;
struct gsm_subscriber_group *subscr_group;
diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h
index 3cba5d1ae..3d7c2449b 100644
--- a/openbsc/include/openbsc/gsm_subscriber.h
+++ b/openbsc/include/openbsc/gsm_subscriber.h
@@ -5,6 +5,8 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/gsm/protocol/gsm_23_003.h>
+#include <stdbool.h>
+
#define GSM_NAME_LENGTH 160
#define GSM_EXTENSION_LENGTH 15 /* MSISDN can only be 15 digits length */
@@ -90,8 +92,7 @@ enum gsm_subscriber_update_reason {
struct gsm_subscriber *subscr_get(struct gsm_subscriber *subscr);
struct gsm_subscriber *subscr_put(struct gsm_subscriber *subscr);
struct gsm_subscriber *subscr_create_subscriber(struct gsm_subscriber_group *sgrp,
- const char *imsi, uint64_t smin,
- uint64_t smax);
+ const char *imsi);
struct gsm_subscriber *subscr_get_by_tmsi(struct gsm_subscriber_group *sgrp,
uint32_t tmsi);
struct gsm_subscriber *subscr_get_by_imsi(struct gsm_subscriber_group *sgrp,