/* VTY interface for virtual OsmoBTS */ /* (C) 2015 by Harald Welte * * 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 . * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define TRX_STR "Transceiver related commands\n" "TRX number\n" #define SHOW_TRX_STR \ SHOW_STR \ TRX_STR static struct gsm_bts *vty_bts; void bts_model_config_write_bts(struct vty *vty, struct gsm_bts *bts) { } void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx) { } void bts_model_config_write_phy(struct vty *vty, struct phy_link *plink) { if (plink->u.virt.mcast_dev) vty_out(vty, " virtual-um net-device %s%s", plink->u.virt.mcast_dev, VTY_NEWLINE); if (plink->u.virt.ms_mcast_group) vty_out(vty, " virtual-um ms-multicast-group %s%s", plink->u.virt.ms_mcast_group, VTY_NEWLINE); if (plink->u.virt.ms_mcast_port) vty_out(vty, " virtual-um ms-udp-port %u%s", plink->u.virt.ms_mcast_port, VTY_NEWLINE); if (plink->u.virt.bts_mcast_group) vty_out(vty, " virtual-um bts-multicast-group %s%s", plink->u.virt.bts_mcast_group, VTY_NEWLINE); if (plink->u.virt.bts_mcast_port) vty_out(vty, " virtual-um bts-udp-port %u%s", plink->u.virt.bts_mcast_port, VTY_NEWLINE); } #define VUM_STR "Virtual Um layer\n" DEFUN(cfg_phy_ms_mcast_group, cfg_phy_ms_mcast_group_cmd, "virtual-um ms-multicast-group GROUP", VUM_STR "Configure the MS multicast group\n") { struct phy_link *plink = vty->index; if (plink->state != PHY_LINK_SHUTDOWN) { vty_out(vty, "Can only reconfigure a PHY link that is down%s", VTY_NEWLINE); return CMD_WARNING; } if (plink->u.virt.ms_mcast_group) talloc_free(plink->u.virt.ms_mcast_group); plink->u.virt.ms_mcast_group = talloc_strdup(plink, argv[0]); return CMD_SUCCESS; } DEFUN(cfg_phy_ms_mcast_port, cfg_phy_ms_mcast_port_cmd, "virtual-um ms-udp-port <0-65535>", VUM_STR "Configure the MS UDP port\n") { struct phy_link *plink = vty->index; if (plink->state != PHY_LINK_SHUTDOWN) { vty_out(vty, "Can only reconfigure a PHY link that is down%s", VTY_NEWLINE); return CMD_WARNING; } plink->u.virt.ms_mcast_port = atoi(argv[0]); return CMD_SUCCESS; } DEFUN(cfg_phy_bts_mcast_group, cfg_phy_bts_mcast_group_cmd, "virtual-um bts-multicast-group GROUP", VUM_STR "Configure the BTS multicast group\n") { struct phy_link *plink = vty->index; if (plink->state != PHY_LINK_SHUTDOWN) { vty_out(vty, "Can only reconfigure a PHY link that is down%s", VTY_NEWLINE); return CMD_WARNING; } if (plink->u.virt.bts_mcast_group) talloc_free(plink->u.virt.bts_mcast_group); plink->u.virt.bts_mcast_group = talloc_strdup(plink, argv[0]); return CMD_SUCCESS; } DEFUN(cfg_phy_bts_mcast_port, cfg_phy_bts_mcast_port_cmd, "virtual-um bts-udp-port <0-65535>", VUM_STR "Configure the BTS UDP port\n") { struct phy_link *plink = vty->index; if (plink->state != PHY_LINK_SHUTDOWN) { vty_out(vty, "Can only reconfigure a PHY link that is down%s", VTY_NEWLINE); return CMD_WARNING; } plink->u.virt.bts_mcast_port = atoi(argv[0]); return CMD_SUCCESS; } DEFUN(cfg_phy_mcast_dev, cfg_phy_mcast_dev_cmd, "virtual-um net-device NETDEV", VUM_STR "Configure the network device\n") { struct phy_link *plink = vty->index; if (plink->state != PHY_LINK_SHUTDOWN) { vty_out(vty, "Can only reconfigure a PHY link that is down%s", VTY_NEWLINE); return CMD_WARNING; } if (plink->u.virt.mcast_dev) talloc_free(plink->u.virt.mcast_dev); plink->u.virt.mcast_dev = talloc_strdup(plink, argv[0]); return CMD_SUCCESS; } int bts_model_vty_init(struct gsm_bts *bts) { vty_bts = bts; install_element(PHY_NODE, &cfg_phy_ms_mcast_group_cmd); install_element(PHY_NODE, &cfg_phy_ms_mcast_port_cmd); install_element(PHY_NODE, &cfg_phy_bts_mcast_group_cmd); install_element(PHY_NODE, &cfg_phy_bts_mcast_port_cmd); install_element(PHY_NODE, &cfg_phy_mcast_dev_cmd); return 0; }