From 7c075a2f740919344ff70ae440c0b69c872ac6cc Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 22 Mar 2018 14:50:20 +0100 Subject: dissolve libcommon,libcommon-cs: clean up vty definitions From openbsc.git, we still have osmo-msc's VTY definitions spread across various places. Combine: - Move the go_parent_cb() and is_config_node() to msc_main.c, drop common_vty.c. - Move all of vty_interface_layer3.c into msc_vty.c. - Move all of common_cs_vty.c into msc_vty.c. - Move bsc_vty_init_extra() into msc_vty_init(). - Drop some unused definitions No functional nor cosmetic changes have been made in the moved code, plain copy-paste moving (even though the unidiff might look like edits in some places). I might have adjusted some blank lines though. Change-Id: Ia818c00ab613a19a34080b160d763b55c19f76b1 --- src/osmo-msc/msc_main.c | 51 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-) (limited to 'src/osmo-msc/msc_main.c') diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c index aba74b6a1..6de81dac9 100644 --- a/src/osmo-msc/msc_main.c +++ b/src/osmo-msc/msc_main.c @@ -267,13 +267,57 @@ static void db_sync_timer_cb(void *data) osmo_timer_schedule(&db_sync_timer, DB_SYNC_INTERVAL); } -extern int bsc_vty_go_parent(struct vty *vty); +static int msc_vty_go_parent(struct vty *vty) +{ + switch (vty->node) { + case GSMNET_NODE: + vty->node = CONFIG_NODE; + vty->index = NULL; + break; + case SMPP_ESME_NODE: + vty->node = SMPP_NODE; + vty->index = NULL; + break; + case SMPP_NODE: + case MSC_NODE: + case MNCC_INT_NODE: + vty->node = CONFIG_NODE; + vty->index = NULL; + break; + case SUBSCR_NODE: + vty->node = ENABLE_NODE; + vty->index = NULL; + break; + default: + osmo_ss7_vty_go_parent(vty); + } + + return vty->node; +} + +static int msc_vty_is_config_node(struct vty *vty, int node) +{ + /* Check if libosmo-sccp declares the node in + * question as config node */ + if (osmo_ss7_is_config_node(vty, node)) + return 1; + + switch (node) { + /* add items that are not config */ + case SUBSCR_NODE: + case CONFIG_NODE: + return 0; + + default: + return 1; + } +} static struct vty_app_info msc_vty_info = { .name = "OsmoMSC", .version = PACKAGE_VERSION, - .go_parent_cb = bsc_vty_go_parent, - .is_config_node = bsc_vty_is_config_node, + .go_parent_cb = msc_vty_go_parent, + .is_config_node = msc_vty_is_config_node, }; #ifdef BUILD_IU @@ -396,7 +440,6 @@ int main(int argc, char **argv) logging_vty_add_cmds(&log_info); osmo_talloc_vty_add_cmds(); msc_vty_init(msc_network); - bsc_vty_init_extra(); #ifdef BUILD_SMPP if (smpp_openbsc_alloc_init(tall_msc_ctx) < 0) -- cgit v1.2.3