[PATCH] osmo-msc[master]: dissolve libcommon: drop gsm_data.c, move code to libmsc

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Mar 22 16:12:10 UTC 2018


Review at  https://gerrit.osmocom.org/7452

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
---
M include/osmocom/msc/gsm_data.h
M src/libcommon/Makefile.am
D src/libcommon/gsm_data.c
M src/libmsc/gsm_04_08.c
M src/libmsc/msc_ifaces.c
M src/libmsc/msc_vty.c
6 files changed, 35 insertions(+), 78 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/52/7452/1

diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 9b6e4e4..f61a6cf 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -362,16 +362,11 @@
 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);
 
 /* control interface handling */
 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 d5ac73d..fdd967f 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -20,7 +20,6 @@
 	$(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 f7795b2..0000000
--- a/src/libcommon/gsm_data.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* (C) 2008-2010 by Harald Welte <laforge at 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 563b835..cceadcb 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -84,6 +84,16 @@
 
 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 437d75c..b2606b6 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 6e7e8d9..b96f6cd 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -161,6 +161,24 @@
 	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"

-- 
To view, visit https://gerrit.osmocom.org/7452
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5381c72af6841829fbc65940fd7d6f4d5cf583df
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list