diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-02-13 17:06:16 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-02-14 12:15:13 +0100 |
commit | ec1bb16eef42cf2cf32af8faca05d234b2a0c891 (patch) | |
tree | 8241cab685941960d5a4652e2992e8d53a33f8f8 /src/osmo-bsc_nat | |
parent | e161bca800d4fff03839e4bea1ad4ca005547774 (diff) |
libcommon: eliminate common_vty.c
Move bsc_vty_go_parent() to osmo_bsc_main.c and bsc_nat.c, and drop those nodes
that aren't used in the respective main scope.
Change-Id: I22ebb76742e9c5ab9dd608ac089a5c558aceeb36
Diffstat (limited to 'src/osmo-bsc_nat')
-rw-r--r-- | src/osmo-bsc_nat/bsc_nat.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/osmo-bsc_nat/bsc_nat.c b/src/osmo-bsc_nat/bsc_nat.c index 5569d2fc9..87db68478 100644 --- a/src/osmo-bsc_nat/bsc_nat.c +++ b/src/osmo-bsc_nat/bsc_nat.c @@ -1574,7 +1574,51 @@ static void talloc_init_ctx() tall_ctr_ctx = talloc_named_const(tall_bsc_ctx, 0, "counter"); } -extern int bsc_vty_go_parent(struct vty *vty); +static int bsc_vty_go_parent(struct vty *vty) +{ + switch (vty->node) { + case NAT_BSC_NODE: + vty->node = NAT_NODE; + { + struct bsc_config *bsc_config = vty->index; + vty->index = bsc_config->nat; + } + break; + case PGROUP_NODE: + vty->node = NAT_NODE; + vty->index = NULL; + break; + case TRUNK_NODE: + vty->node = MGCP_NODE; + vty->index = NULL; + break; + case NAT_NODE: + vty->node = CONFIG_NODE; + vty->index = NULL; + break; + default: + osmo_ss7_vty_go_parent(vty); + } + + return vty->node; +} + +static int bsc_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 CONFIG_NODE: + return 0; + + default: + return 1; + } +} static struct vty_app_info vty_info = { .name = "OsmoBSCNAT", |