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
This commit is contained in:
Neels Hofmeyr 2018-03-22 16:09:50 +01:00
parent 7a2f58ea63
commit 9d74425e27
6 changed files with 35 additions and 78 deletions

View File

@ -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 */

View File

@ -20,7 +20,6 @@ noinst_LIBRARIES = \
$(NULL)
libcommon_a_SOURCES = \
gsm_data.c \
gsup_client.c \
oap_client.c \
$(NULL)

View File

@ -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 }
};

View File

@ -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)
{

View File

@ -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)

View File

@ -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"