don't re-implement osmo_talloc_replace_string()
osmo_talloc_replace_string() was introducd into libosmocore in 2014, see commit f3c7e85d05f7b2b7bf093162b776f71b2bc6420d There's no reason for us to re-implement this as bsc_replace_string here. Change-Id: I6d2fcaabbc74730f6f491a2b2d5c784ccafc6602
This commit is contained in:
parent
aef68387ae
commit
4a824ca8fc
|
@ -41,7 +41,6 @@ enum bsc_vty_node {
|
|||
};
|
||||
|
||||
extern int bsc_vty_is_config_node(struct vty *vty, int node);
|
||||
extern void bsc_replace_string(void *ctx, char **dst, const char *newstr);
|
||||
|
||||
struct log_info;
|
||||
int bsc_vty_init(struct gsm_network *network);
|
||||
|
|
|
@ -2946,7 +2946,7 @@ DEFUN(cfg_bts_pcu_sock, cfg_bts_pcu_sock_cmd,
|
|||
struct gsm_bts *bts = vty->index;
|
||||
int rc;
|
||||
|
||||
bsc_replace_string(bts, &bts->pcu_sock_path, argv[0]);
|
||||
osmo_talloc_replace_string(bts, &bts->pcu_sock_path, argv[0]);
|
||||
pcu_sock_exit(bts);
|
||||
rc = pcu_sock_init(bts->pcu_sock_path, bts);
|
||||
if (rc < 0) {
|
||||
|
|
|
@ -88,7 +88,7 @@ DEFUN(cfg_net_name_short,
|
|||
{
|
||||
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
|
||||
|
||||
bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
|
||||
osmo_talloc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ DEFUN(cfg_net_name_long,
|
|||
{
|
||||
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
|
||||
|
||||
bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
|
||||
osmo_talloc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -143,11 +143,3 @@ int bsc_vty_is_config_node(struct vty *vty, int node)
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* a talloc string replace routine */
|
||||
void bsc_replace_string(void *ctx, char **dst, const char *newstr)
|
||||
{
|
||||
if (*dst)
|
||||
talloc_free(*dst);
|
||||
*dst = talloc_strdup(ctx, newstr);
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ DEFUN(cfg_mgcp_local_ip,
|
|||
IP_STR
|
||||
"IPv4 Address to use in SDP record\n")
|
||||
{
|
||||
bsc_replace_string(g_cfg, &g_cfg->local_ip, argv[0]);
|
||||
osmo_talloc_replace_string(g_cfg, &g_cfg->local_ip, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ DEFUN(cfg_mgcp_bts_ip,
|
|||
IP_STR
|
||||
"IPv4 Address of the BTS\n")
|
||||
{
|
||||
bsc_replace_string(g_cfg, &g_cfg->bts_ip, argv[0]);
|
||||
osmo_talloc_replace_string(g_cfg, &g_cfg->bts_ip, argv[0]);
|
||||
inet_aton(g_cfg->bts_ip, &g_cfg->bts_in);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ DEFUN(cfg_mgcp_bind_ip,
|
|||
IP_STR
|
||||
"IPv4 Address to bind to\n")
|
||||
{
|
||||
bsc_replace_string(g_cfg, &g_cfg->source_addr, argv[0]);
|
||||
osmo_talloc_replace_string(g_cfg, &g_cfg->source_addr, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ DEFUN(cfg_mgcp_rtp_bts_bind_ip,
|
|||
"rtp bts-bind-ip A.B.C.D",
|
||||
RTP_STR "Bind endpoints facing the BTS\n" "Address to bind to\n")
|
||||
{
|
||||
bsc_replace_string(g_cfg, &g_cfg->bts_ports.bind_addr, argv[0]);
|
||||
osmo_talloc_replace_string(g_cfg, &g_cfg->bts_ports.bind_addr, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -422,7 +422,7 @@ DEFUN(cfg_mgcp_rtp_net_bind_ip,
|
|||
"rtp net-bind-ip A.B.C.D",
|
||||
RTP_STR "Bind endpoints facing the Network\n" "Address to bind to\n")
|
||||
{
|
||||
bsc_replace_string(g_cfg, &g_cfg->net_ports.bind_addr, argv[0]);
|
||||
osmo_talloc_replace_string(g_cfg, &g_cfg->net_ports.bind_addr, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@ DEFUN(cfg_mgcp_sdp_fmtp_extra,
|
|||
if (!txt)
|
||||
return CMD_WARNING;
|
||||
|
||||
bsc_replace_string(g_cfg, &g_cfg->trunk.audio_fmtp_extra, txt);
|
||||
osmo_talloc_replace_string(g_cfg, &g_cfg->trunk.audio_fmtp_extra, txt);
|
||||
talloc_free(txt);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ DEFUN(cfg_mgcp_sdp_payload_name,
|
|||
"sdp audio-payload name NAME",
|
||||
SDP_STR AUDIO_STR "Name\n" "Payload name\n")
|
||||
{
|
||||
bsc_replace_string(g_cfg, &g_cfg->trunk.audio_name, argv[0]);
|
||||
osmo_talloc_replace_string(g_cfg, &g_cfg->trunk.audio_name, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -714,7 +714,7 @@ DEFUN(cfg_mgcp_agent_addr,
|
|||
CALL_AGENT_STR IP_STR
|
||||
"IPv4 Address of the callagent\n")
|
||||
{
|
||||
bsc_replace_string(g_cfg, &g_cfg->call_agent_addr, argv[0]);
|
||||
osmo_talloc_replace_string(g_cfg, &g_cfg->call_agent_addr, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -730,7 +730,7 @@ DEFUN(cfg_mgcp_transcoder,
|
|||
"Use a MGW to detranscoder RTP\n"
|
||||
"The IP address of the MGW")
|
||||
{
|
||||
bsc_replace_string(g_cfg, &g_cfg->transcoder_ip, argv[0]);
|
||||
osmo_talloc_replace_string(g_cfg, &g_cfg->transcoder_ip, argv[0]);
|
||||
inet_aton(g_cfg->transcoder_ip, &g_cfg->transcoder_in);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
|
@ -838,7 +838,7 @@ DEFUN(cfg_trunk_sdp_fmtp_extra,
|
|||
if (!txt)
|
||||
return CMD_WARNING;
|
||||
|
||||
bsc_replace_string(g_cfg, &trunk->audio_fmtp_extra, txt);
|
||||
osmo_talloc_replace_string(g_cfg, &trunk->audio_fmtp_extra, txt);
|
||||
talloc_free(txt);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -866,7 +866,7 @@ DEFUN(cfg_trunk_payload_name,
|
|||
{
|
||||
struct mgcp_trunk_config *trunk = vty->index;
|
||||
|
||||
bsc_replace_string(g_cfg, &trunk->audio_name, argv[0]);
|
||||
osmo_talloc_replace_string(g_cfg, &trunk->audio_name, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1289,7 +1289,7 @@ DEFUN(cfg_mgcp_osmux_ip,
|
|||
"osmux bind-ip A.B.C.D",
|
||||
OSMUX_STR IP_STR "IPv4 Address to bind to\n")
|
||||
{
|
||||
bsc_replace_string(g_cfg, &g_cfg->osmux_addr, argv[0]);
|
||||
osmo_talloc_replace_string(g_cfg, &g_cfg->osmux_addr, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ int main(int argc, char **argv)
|
|||
|
||||
data = bsc_gsmnet->bsc_data;
|
||||
if (rf_ctrl)
|
||||
bsc_replace_string(data, &data->rf_ctrl_name, rf_ctrl);
|
||||
osmo_talloc_replace_string(data, &data->rf_ctrl_name, rf_ctrl);
|
||||
|
||||
data->rf_ctrl = osmo_bsc_rf_create(data->rf_ctrl_name, bsc_gsmnet);
|
||||
if (!data->rf_ctrl) {
|
||||
|
|
|
@ -230,7 +230,7 @@ DEFUN(cfg_net_bsc_token,
|
|||
{
|
||||
struct bsc_msc_data *data = bsc_msc_data(vty);
|
||||
|
||||
bsc_replace_string(osmo_bsc_data(vty), &data->bsc_token, argv[0]);
|
||||
osmo_talloc_replace_string(osmo_bsc_data(vty), &data->bsc_token, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ DEFUN(cfg_net_msc_welcome_ussd,
|
|||
if (!str)
|
||||
return CMD_WARNING;
|
||||
|
||||
bsc_replace_string(osmo_bsc_data(vty), &data->ussd_welcome_txt, str);
|
||||
osmo_talloc_replace_string(osmo_bsc_data(vty), &data->ussd_welcome_txt, str);
|
||||
talloc_free(str);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ DEFUN(cfg_net_msc_lost_ussd,
|
|||
if (!str)
|
||||
return CMD_WARNING;
|
||||
|
||||
bsc_replace_string(osmo_bsc_data(vty), &data->ussd_msc_lost_txt, str);
|
||||
osmo_talloc_replace_string(osmo_bsc_data(vty), &data->ussd_msc_lost_txt, str);
|
||||
talloc_free(str);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ DEFUN(cfg_net_msc_grace_ussd,
|
|||
if (!str)
|
||||
return CMD_WARNING;
|
||||
|
||||
bsc_replace_string(osmo_bsc_data(vty), &data->ussd_grace_txt, str);
|
||||
osmo_talloc_replace_string(osmo_bsc_data(vty), &data->ussd_grace_txt, str);
|
||||
talloc_free(str);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ DEFUN(cfg_net_bsc_missing_msc_ussd,
|
|||
if (!txt)
|
||||
return CMD_WARNING;
|
||||
|
||||
bsc_replace_string(data, &data->ussd_no_msc_txt, txt);
|
||||
osmo_talloc_replace_string(data, &data->ussd_no_msc_txt, txt);
|
||||
talloc_free(txt);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -666,7 +666,7 @@ DEFUN(cfg_msc_acc_lst_name,
|
|||
{
|
||||
struct bsc_msc_data *msc = bsc_msc_data(vty);
|
||||
|
||||
bsc_replace_string(msc, &msc->acc_lst_name, argv[0]);
|
||||
osmo_talloc_replace_string(msc, &msc->acc_lst_name, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -695,7 +695,7 @@ DEFUN(cfg_net_bsc_mid_call_text,
|
|||
if (!txt)
|
||||
return CMD_WARNING;
|
||||
|
||||
bsc_replace_string(data, &data->mid_call_txt, txt);
|
||||
osmo_talloc_replace_string(data, &data->mid_call_txt, txt);
|
||||
talloc_free(txt);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ DEFUN(cfg_net_rf_socket,
|
|||
{
|
||||
struct osmo_bsc_data *data = osmo_bsc_data(vty);
|
||||
|
||||
bsc_replace_string(data, &data->rf_ctrl_name, argv[0]);
|
||||
osmo_talloc_replace_string(data, &data->rf_ctrl_name, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ DEFUN(cfg_bsc_acc_lst_name,
|
|||
{
|
||||
struct osmo_bsc_data *bsc = osmo_bsc_data(vty);
|
||||
|
||||
bsc_replace_string(bsc, &bsc->acc_lst_name, argv[0]);
|
||||
osmo_talloc_replace_string(bsc, &bsc->acc_lst_name, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ static int set_net_cfg_cmd(struct ctrl_cmd *cmd, void *data)
|
|||
return CTRL_CMD_ERROR;
|
||||
|
||||
if (strcmp(bsc_variable, "access-list-name") == 0) {
|
||||
bsc_replace_string(bsc_cfg, &bsc_cfg->acc_lst_name, cmd->value);
|
||||
osmo_talloc_replace_string(bsc_cfg, &bsc_cfg->acc_lst_name, cmd->value);
|
||||
cmd->reply = talloc_asprintf(cmd, "%s",
|
||||
bsc_cfg->acc_lst_name ? bsc_cfg->acc_lst_name : "");
|
||||
return CTRL_CMD_REPLY;
|
||||
|
|
|
@ -139,7 +139,7 @@ void bsc_nat_free(struct bsc_nat *nat)
|
|||
|
||||
void bsc_nat_set_msc_ip(struct bsc_nat *nat, const char *ip)
|
||||
{
|
||||
bsc_replace_string(nat, &nat->main_dest->ip, ip);
|
||||
osmo_talloc_replace_string(nat, &nat->main_dest->ip, ip);
|
||||
}
|
||||
|
||||
struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat)
|
||||
|
|
|
@ -479,7 +479,7 @@ DEFUN(cfg_nat_token, cfg_nat_token_cmd,
|
|||
"Authentication token configuration\n"
|
||||
"Token of the BSC, currently transferred in cleartext\n")
|
||||
{
|
||||
bsc_replace_string(_nat, &_nat->token, argv[0]);
|
||||
osmo_talloc_replace_string(_nat, &_nat->token, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ DEFUN(cfg_nat_acc_lst_name,
|
|||
"Set the name of the access list to use.\n"
|
||||
"The name of the to be used access list.")
|
||||
{
|
||||
bsc_replace_string(_nat, &_nat->acc_lst_name, argv[0]);
|
||||
osmo_talloc_replace_string(_nat, &_nat->acc_lst_name, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -518,11 +518,11 @@ DEFUN(cfg_nat_include,
|
|||
struct bsc_connection *con1, *con2;
|
||||
|
||||
if ('/' == argv[0][0])
|
||||
bsc_replace_string(_nat, &_nat->resolved_path, argv[0]);
|
||||
osmo_talloc_replace_string(_nat, &_nat->resolved_path, argv[0]);
|
||||
else {
|
||||
path = talloc_asprintf(_nat, "%s/%s", _nat->include_base,
|
||||
argv[0]);
|
||||
bsc_replace_string(_nat, &_nat->resolved_path, path);
|
||||
osmo_talloc_replace_string(_nat, &_nat->resolved_path, path);
|
||||
talloc_free(path);
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ DEFUN(cfg_nat_include,
|
|||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
bsc_replace_string(_nat, &_nat->include_file, argv[0]);
|
||||
osmo_talloc_replace_string(_nat, &_nat->include_file, argv[0]);
|
||||
|
||||
llist_for_each_entry_safe(con1, con2, &_nat->bsc_connections,
|
||||
list_entry) {
|
||||
|
@ -574,7 +574,7 @@ DEFUN(cfg_nat_imsi_black_list_fn,
|
|||
"IMSI black listing\n" "Filename IMSI and reject-cause\n")
|
||||
{
|
||||
|
||||
bsc_replace_string(_nat, &_nat->imsi_black_list_fn, argv[0]);
|
||||
osmo_talloc_replace_string(_nat, &_nat->imsi_black_list_fn, argv[0]);
|
||||
if (_nat->imsi_black_list_fn) {
|
||||
int rc;
|
||||
struct osmo_config_list *rewr = NULL;
|
||||
|
@ -609,7 +609,7 @@ static int replace_rules(struct bsc_nat *nat, char **name,
|
|||
{
|
||||
struct osmo_config_list *rewr = NULL;
|
||||
|
||||
bsc_replace_string(nat, name, file);
|
||||
osmo_talloc_replace_string(nat, name, file);
|
||||
if (*name) {
|
||||
rewr = osmo_config_list_parse(nat, *name);
|
||||
bsc_nat_num_rewr_entry_adapt(nat, head, rewr);
|
||||
|
@ -740,7 +740,7 @@ DEFUN(cfg_nat_prefix_trie,
|
|||
_nat->num_rewr_trie = NULL;
|
||||
|
||||
/* replace the file name */
|
||||
bsc_replace_string(_nat, &_nat->num_rewr_trie_name, argv[0]);
|
||||
osmo_talloc_replace_string(_nat, &_nat->num_rewr_trie_name, argv[0]);
|
||||
if (!_nat->num_rewr_trie_name) {
|
||||
vty_out(vty, "%% prefix-tree no filename is present.%s", VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
|
@ -789,7 +789,7 @@ DEFUN(cfg_nat_ussd_lst_name,
|
|||
"Set the name of the access list to check for IMSIs for USSD message\n"
|
||||
"The name of the access list for HLR USSD handling")
|
||||
{
|
||||
bsc_replace_string(_nat, &_nat->ussd_lst_name, argv[0]);
|
||||
osmo_talloc_replace_string(_nat, &_nat->ussd_lst_name, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -809,7 +809,7 @@ DEFUN(cfg_nat_ussd_token,
|
|||
"ussd-token TOKEN",
|
||||
"Set the token used to identify the USSD module\n" "Secret key\n")
|
||||
{
|
||||
bsc_replace_string(_nat, &_nat->ussd_token, argv[0]);
|
||||
osmo_talloc_replace_string(_nat, &_nat->ussd_token, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -818,7 +818,7 @@ DEFUN(cfg_nat_ussd_local,
|
|||
"ussd-local-ip A.B.C.D",
|
||||
"Set the IP to listen for the USSD Provider\n" "IP Address\n")
|
||||
{
|
||||
bsc_replace_string(_nat, &_nat->ussd_local, argv[0]);
|
||||
osmo_talloc_replace_string(_nat, &_nat->ussd_local, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -884,7 +884,7 @@ DEFUN(cfg_bsc_token, cfg_bsc_token_cmd, "token TOKEN",
|
|||
if (strncmp(conf->token, argv[0], 128) != 0)
|
||||
conf->token_updated = true;
|
||||
|
||||
bsc_replace_string(conf, &conf->token, argv[0]);
|
||||
osmo_talloc_replace_string(conf, &conf->token, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -983,7 +983,7 @@ DEFUN(cfg_bsc_acc_lst_name,
|
|||
{
|
||||
struct bsc_config *conf = vty->index;
|
||||
|
||||
bsc_replace_string(conf, &conf->acc_lst_name, argv[0]);
|
||||
osmo_talloc_replace_string(conf, &conf->acc_lst_name, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1035,7 +1035,7 @@ DEFUN(cfg_bsc_desc,
|
|||
{
|
||||
struct bsc_config *conf = vty->index;
|
||||
|
||||
bsc_replace_string(conf, &conf->description, argv[0]);
|
||||
osmo_talloc_replace_string(conf, &conf->description, argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -532,7 +532,7 @@ static void test_messages(void)
|
|||
last_endpoint = -1;
|
||||
dummy_packets = 0;
|
||||
|
||||
bsc_replace_string(cfg, &cfg->trunk.audio_fmtp_extra, t->extra_fmtp);
|
||||
osmo_talloc_replace_string(cfg, &cfg->trunk.audio_fmtp_extra, t->extra_fmtp);
|
||||
|
||||
inp = create_msg(t->req);
|
||||
msg = mgcp_handle_message(cfg, inp);
|
||||
|
|
Loading…
Reference in New Issue