From patchwork Tue May 3 16:43:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max X-Patchwork-Id: 618097 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 3qzn7R0tTLz9t4k for ; Wed, 4 May 2016 02:44:01 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 4E87E13806; Tue, 3 May 2016 16:43:56 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from mail.sysmocom.de (mail.sysmocom.de [IPv6:2a01:4f8:191:444c::2:4]) by lists.osmocom.org (Postfix) with ESMTP id AC9CE137FF for ; Tue, 3 May 2016 16:43:55 +0000 (UTC) Received: from mail.sysmocom.de (mail.sysmocom.de [144.76.43.93]) by mail.sysmocom.de (Postfix) with ESMTP id ED8881BA7DE; Tue, 3 May 2016 16:43:54 +0000 (UTC) Received: from pbell.local (ip5b418565.dynamic.kabel-deutschland.de [91.65.133.101]) by mail.sysmocom.de (Postfix) with ESMTPSA id ABB1E1BA7DC; Tue, 3 May 2016 16:43:53 +0000 (UTC) From: msuraev@sysmocom.de To: openbsc@lists.osmocom.org Subject: [PATCH 1/5] Use enum for subscriber creation policy Date: Tue, 3 May 2016 18:43:49 +0200 Message-Id: <1462293833-29141-1-git-send-email-msuraev@sysmocom.de> X-Mailer: git-send-email 2.8.2 X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Max This enables easier expansion of available policies in future. --- openbsc/include/openbsc/gsm_data.h | 5 +++++ openbsc/src/libbsc/net_init.c | 2 +- openbsc/src/libmsc/vty_interface_layer3.c | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 6d7aba3..593a86f 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -18,6 +18,11 @@ struct gsm_subscriber_group; #define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3] +enum gsm_subscr_ext_alloc_policy { + GSM_SUBSCR_DONT_CREATE = 0, + GSM_SUBSCR_RANDOM_EXT = 1, +}; + enum gsm_security_event { GSM_SECURITY_NOAVAIL, GSM_SECURITY_AUTH_FAILED, diff --git a/openbsc/src/libbsc/net_init.c b/openbsc/src/libbsc/net_init.c index 568a0b8..00a8a9b 100644 --- a/openbsc/src/libbsc/net_init.c +++ b/openbsc/src/libbsc/net_init.c @@ -48,7 +48,7 @@ struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_cod INIT_LLIST_HEAD(&net->bsc_data->mscs); net->subscr_group->net = net; - net->create_subscriber = 1; + net->create_subscriber = GSM_SUBSCR_RANDOM_EXT; net->country_code = country_code; net->network_code = network_code; diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c index 790fedf..4dd0573 100644 --- a/openbsc/src/libmsc/vty_interface_layer3.c +++ b/openbsc/src/libmsc/vty_interface_layer3.c @@ -1036,7 +1036,7 @@ DEFUN(cfg_nitb_subscr_create, cfg_nitb_subscr_create_cmd, "Make a new record when a subscriber is first seen.\n") { struct gsm_network *gsmnet = gsmnet_from_vty(vty); - gsmnet->create_subscriber = 1; + gsmnet->create_subscriber = GSM_SUBSCR_RANDOM_EXT; return CMD_SUCCESS; } @@ -1045,7 +1045,7 @@ DEFUN(cfg_nitb_no_subscr_create, cfg_nitb_no_subscr_create_cmd, NO_STR "Make a new record when a subscriber is first seen.\n") { struct gsm_network *gsmnet = gsmnet_from_vty(vty); - gsmnet->create_subscriber = 0; + gsmnet->create_subscriber = GSM_SUBSCR_DONT_CREATE; return CMD_SUCCESS; }