9
0
Fork 0

stp: Allow to specify a trunk_name in the application

This trunk name will be used to send RSIP for the trunk on ISUP
resets. Right now each app can be associated only one trunk.
This commit is contained in:
Holger Hans Peter Freyther 2012-12-11 15:32:09 +01:00
parent d04011abc1
commit b35c5c3227
3 changed files with 57 additions and 6 deletions

View File

@ -78,8 +78,9 @@ struct ss7_application {
int forward_only;
int reset_count;
/* mgcp handling for the cellmgr */
/* mgcp handling for the cellmgr and stp */
char *mgcp_domain_name;
char *trunk_name;
};
@ -96,5 +97,7 @@ void ss7_application_pass_isup(struct ss7_application *, int pass);
int ss7_application_mgcp_domain_name(struct ss7_application *,
const char *domain_name);
int ss7_application_trunk_name(struct ss7_application *,
const char *trunk_name);
#endif

View File

@ -1,8 +1,8 @@
/*
* The SS7 Application part for forwarding or nat...
*
* (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2010-2011 by On-Waves
* (C) 2010-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2010-2012 by On-Waves
* All Rights Reserved
*
* This program is free software: you can redistribute it and/or modify
@ -421,3 +421,11 @@ int ss7_application_mgcp_domain_name(struct ss7_application *app,
return app->mgcp_domain_name == NULL;
}
int ss7_application_trunk_name(struct ss7_application *app, const char *name)
{
talloc_free(app->trunk_name);
app->trunk_name = talloc_strdup(app, name);
return app->trunk_name == NULL;
}

View File

@ -1,7 +1,7 @@
/* VTY code for the osmo-stp */
/*
* (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2010-2011 by On-Waves
* (C) 2010-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2010-2012 by On-Waves
* All Rights Reserved
*
* This program is free software: you can redistribute it and/or modify
@ -296,8 +296,10 @@ static void write_application(struct vty *vty, struct ss7_application *app)
vty_out(vty, " description %s%s", name, VTY_NEWLINE);
vty_out(vty, " type %s%s", app_type(app->type), VTY_NEWLINE);
if (app->type == APP_STP)
if (app->type == APP_STP) {
vty_out(vty, " isup-pass-through %d%s", app->isup_pass, VTY_NEWLINE);
vty_out(vty, " trunk-name %s%s", app->trunk_name, VTY_NEWLINE);
}
if (app->type == APP_CELLMGR && app->mgcp_domain_name) {
vty_out(vty, " domain-name %s%s",
@ -988,6 +990,42 @@ DEFUN(cfg_app_no_domain_name, cfg_app_no_domain_name_cmd,
return CMD_SUCCESS;
}
#define TRUNK_NAME_STR "Trunk name to use\n"
DEFUN(cfg_app_trunk_name, cfg_app_trunk_name_cmd,
"trunk-name NAME",
TRUNK_NAME_STR "The name\n")
{
struct ss7_application *app = vty->index;
if (app->type != APP_STP) {
vty_out(vty, "The app type needs to be 'stp'.%s", VTY_NEWLINE);
return CMD_WARNING;
}
if (ss7_application_trunk_name(app, argv[0]) != 0) {
vty_out(vty, "Failed to set the trunk name.%s", VTY_NEWLINE);
return CMD_WARNING;
}
return CMD_SUCCESS;
}
DEFUN(cfg_app_no_trunk_name, cfg_app_no_trunk_name_cmd,
"no trunk-name NAME",
NO_STR TRUNK_NAME_STR "The name\n")
{
struct ss7_application *app = vty->index;
if (app->type != APP_STP) {
vty_out(vty, "The app type needs to be 'stp'.%s", VTY_NEWLINE);
return CMD_WARNING;
}
talloc_free(app->trunk_name);
app->trunk_name = NULL;
return CMD_SUCCESS;
}
static void install_defaults(int node)
{
@ -1062,6 +1100,8 @@ void cell_vty_init(void)
install_element(APP_NODE, &cfg_app_route_ls_cmd);
install_element(APP_NODE, &cfg_app_domain_name_cmd);
install_element(APP_NODE, &cfg_app_no_domain_name_cmd);
install_element(APP_NODE, &cfg_app_trunk_name_cmd);
install_element(APP_NODE, &cfg_app_no_trunk_name_cmd);
cell_vty_init_cmds();
}