From 9d74425e271e3d7d6e81f3fe8561e7a537ffa739 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 22 Mar 2018 16:09:50 +0100 Subject: dissolve libcommon: drop gsm_data.c, move code to libmsc classmark_is_r99() is only used in gsm_04_08.c, move there as static. rrlp_mode_* is only used in msc_vty.c, move there as static. Move ran_type_names[] to msc_ifaces.c. Change-Id: I5381c72af6841829fbc65940fd7d6f4d5cf583df --- src/libcommon/Makefile.am | 1 - src/libcommon/gsm_data.c | 72 ----------------------------------------------- src/libmsc/gsm_04_08.c | 10 +++++++ src/libmsc/msc_ifaces.c | 7 +++++ src/libmsc/msc_vty.c | 18 ++++++++++++ 5 files changed, 35 insertions(+), 73 deletions(-) delete mode 100644 src/libcommon/gsm_data.c (limited to 'src') diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am index d5ac73d13..fdd967fb7 100644 --- a/src/libcommon/Makefile.am +++ b/src/libcommon/Makefile.am @@ -20,7 +20,6 @@ noinst_LIBRARIES = \ $(NULL) libcommon_a_SOURCES = \ - gsm_data.c \ gsup_client.c \ oap_client.c \ $(NULL) diff --git a/src/libcommon/gsm_data.c b/src/libcommon/gsm_data.c deleted file mode 100644 index f7795b201..000000000 --- a/src/libcommon/gsm_data.c +++ /dev/null @@ -1,72 +0,0 @@ -/* (C) 2008-2010 by Harald Welte - * - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -void *tall_bsc_ctx; - -static const struct value_string rrlp_mode_names[] = { - { RRLP_MODE_NONE, "none" }, - { RRLP_MODE_MS_BASED, "ms-based" }, - { RRLP_MODE_MS_PREF, "ms-preferred" }, - { RRLP_MODE_ASS_PREF, "ass-preferred" }, - { 0, NULL } -}; - -enum rrlp_mode rrlp_mode_parse(const char *arg) -{ - return get_string_value(rrlp_mode_names, arg); -} - -const char *rrlp_mode_name(enum rrlp_mode mode) -{ - return get_value_string(rrlp_mode_names, mode); -} - -bool classmark_is_r99(struct gsm_classmark *cm) -{ - int rev_lev = 0; - if (cm->classmark1_set) - rev_lev = cm->classmark1.rev_lev; - else if (cm->classmark2_len > 0) - rev_lev = (cm->classmark2[0] >> 5) & 0x3; - return rev_lev >= 2; -} - -const struct value_string ran_type_names[] = { - OSMO_VALUE_STRING(RAN_UNKNOWN), - OSMO_VALUE_STRING(RAN_GERAN_A), - OSMO_VALUE_STRING(RAN_UTRAN_IU), - { 0, NULL } -}; diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c index 563b83589..cceadcb88 100644 --- a/src/libmsc/gsm_04_08.c +++ b/src/libmsc/gsm_04_08.c @@ -84,6 +84,16 @@ static int gsm48_tx_simple(struct gsm_subscriber_connection *conn, static uint32_t new_callref = 0x80000001; +static bool classmark_is_r99(struct gsm_classmark *cm) +{ + int rev_lev = 0; + if (cm->classmark1_set) + rev_lev = cm->classmark1.rev_lev; + else if (cm->classmark2_len > 0) + rev_lev = (cm->classmark2[0] >> 5) & 0x3; + return rev_lev >= 2; +} + /* Determine if the given CLASSMARK (1/2/3) value permits a given A5/n cipher */ static bool classmark_supports_a5(const struct gsm_classmark *cm, uint8_t a5) { diff --git a/src/libmsc/msc_ifaces.c b/src/libmsc/msc_ifaces.c index 437d75c8e..b2606b6d2 100644 --- a/src/libmsc/msc_ifaces.c +++ b/src/libmsc/msc_ifaces.c @@ -39,6 +39,13 @@ #include #endif /* BUILD_IU */ +const struct value_string ran_type_names[] = { + OSMO_VALUE_STRING(RAN_UNKNOWN), + OSMO_VALUE_STRING(RAN_GERAN_A), + OSMO_VALUE_STRING(RAN_UTRAN_IU), + { 0, NULL } +}; + static int msc_tx(struct gsm_subscriber_connection *conn, struct msgb *msg) { if (!msg) diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c index 6e7e8d91d..b96f6cdbe 100644 --- a/src/libmsc/msc_vty.c +++ b/src/libmsc/msc_vty.c @@ -161,6 +161,24 @@ DEFUN(cfg_net_authentication, return CMD_SUCCESS; } +static const struct value_string rrlp_mode_names[] = { + { RRLP_MODE_NONE, "none" }, + { RRLP_MODE_MS_BASED, "ms-based" }, + { RRLP_MODE_MS_PREF, "ms-preferred" }, + { RRLP_MODE_ASS_PREF, "ass-preferred" }, + { 0, NULL } +}; + +static enum rrlp_mode rrlp_mode_parse(const char *arg) +{ + return get_string_value(rrlp_mode_names, arg); +} + +static const char *rrlp_mode_name(enum rrlp_mode mode) +{ + return get_value_string(rrlp_mode_names, mode); +} + DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd, "rrlp mode (none|ms-based|ms-preferred|ass-preferred)", "Radio Resource Location Protocol\n" -- cgit v1.2.3