diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-03-22 16:09:50 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-03-22 17:06:51 +0100 |
commit | 9d74425e271e3d7d6e81f3fe8561e7a537ffa739 (patch) | |
tree | 697ce90370044a18347ea3489901b1efbd238b28 | |
parent | 7a2f58ea63a777dcda1dd8ff1e7c2459ba2758c6 (diff) |
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
-rw-r--r-- | include/osmocom/msc/gsm_data.h | 5 | ||||
-rw-r--r-- | src/libcommon/Makefile.am | 1 | ||||
-rw-r--r-- | src/libcommon/gsm_data.c | 72 | ||||
-rw-r--r-- | src/libmsc/gsm_04_08.c | 10 | ||||
-rw-r--r-- | src/libmsc/msc_ifaces.c | 7 | ||||
-rw-r--r-- | src/libmsc/msc_vty.c | 18 |
6 files changed, 35 insertions, 78 deletions
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h index 9b6e4e4bb..f61a6cf81 100644 --- a/include/osmocom/msc/gsm_data.h +++ b/include/osmocom/msc/gsm_data.h @@ -362,9 +362,6 @@ struct gsm_sms { extern void *tall_bsc_ctx; extern int ipacc_rtp_direct; -enum rrlp_mode rrlp_mode_parse(const char *arg); -const char *rrlp_mode_name(enum rrlp_mode mode); - struct gsm_subscriber_connection *msc_subscr_con_allocate(struct gsm_network *network); void msc_subscr_con_free(struct gsm_subscriber_connection *conn); @@ -372,6 +369,4 @@ void msc_subscr_con_free(struct gsm_subscriber_connection *conn); int bsc_base_ctrl_cmds_install(void); int msc_ctrl_cmds_install(struct gsm_network *net); -bool classmark_is_r99(struct gsm_classmark *cm); - #endif /* _GSM_DATA_H */ 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 <laforge@gnumonks.org> - * - * 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 <http://www.gnu.org/licenses/>. - * - */ - - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <ctype.h> -#include <stdbool.h> -#include <netinet/in.h> - -#include <osmocom/core/linuxlist.h> -#include <osmocom/core/talloc.h> -#include <osmocom/gsm/gsm_utils.h> -#include <osmocom/core/statistics.h> -#include <osmocom/gsm/protocol/gsm_04_08.h> - -#include <osmocom/msc/gsm_data.h> - -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 <osmocom/msc/iu_dummy.h> #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" |