aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcu_vty.c
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-07-20 21:50:31 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2012-07-20 21:50:31 +0200
commit8b761a34190656884409bd61d0b0483ed0f14898 (patch)
tree92886121e5ffabc3053db043e8b75080e1a89964 /src/pcu_vty.c
parent3b7461c1b39f424d41f30613560abd8a6fda375e (diff)
VTY: Added option to force given CS and ignore the scheme given by BTS
Diffstat (limited to 'src/pcu_vty.c')
-rw-r--r--src/pcu_vty.c87
1 files changed, 67 insertions, 20 deletions
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index 7e8af43b..179080bb 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -1,27 +1,18 @@
/* OsmoBTS VTY interface */
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <osmocom/core/talloc.h>
-#include <osmocom/gsm/abis_nm.h>
-#include <osmocom/vty/vty.h>
-#include <osmocom/vty/command.h>
-#include <osmocom/vty/logging.h>
-
-#include <osmocom/trau/osmo_ortp.h>
-
+#include <stdint.h>
+#include <osmocom/vty/logging.h>
+#include <osmocom/core/linuxlist.h>
#include "pcu_vty.h"
-
+#include "gprs_rlcmac.h"
enum node_type pcu_vty_go_parent(struct vty *vty)
{
switch (vty->node) {
#if 0
case TRX_NODE:
- vty->node = BTS_NODE;
+ vty->node = PCU_NODE;
{
struct gsm_bts_trx *trx = vty->index;
vty->index = trx->bts;
@@ -31,29 +22,32 @@ enum node_type pcu_vty_go_parent(struct vty *vty)
default:
vty->node = CONFIG_NODE;
}
- return vty->node;
+ return (enum node_type) vty->node;
}
int pcu_vty_is_config_node(struct vty *vty, int node)
{
switch (node) {
-#if 0
- case TRX_NODE:
- case BTS_NODE:
+ case PCU_NODE:
return 1;
-#endif
default:
return 0;
}
}
+static struct cmd_node pcu_node = {
+ (enum node_type) PCU_NODE,
+ "%s(pcu)#",
+ 1,
+};
+
gDEFUN(ournode_exit, ournode_exit_cmd, "exit",
"Exit current node, go down to provious node")
{
switch (vty->node) {
#if 0
case TRXV_NODE:
- vty->node = BTS_NODE;
+ vty->node = PCU_NODE;
{
struct gsm_bts_trx *trx = vty->index;
vty->index = trx->bts;
@@ -80,6 +74,52 @@ gDEFUN(ournode_end, ournode_end_cmd, "end",
return CMD_SUCCESS;
}
+static int config_write_pcu(struct vty *vty)
+{
+ struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+
+ vty_out(vty, "pcu%s", VTY_NEWLINE);
+ if (bts->force_cs)
+ vty_out(vty, " cs %d%s", bts->initial_cs, VTY_NEWLINE);
+}
+
+/* per-BTS configuration */
+DEFUN(cfg_pcu,
+ cfg_pcu_cmd,
+ "pcu",
+ "BTS specific configure")
+{
+ vty->node = PCU_NODE;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_pcu_cs,
+ cfg_pcu_cs_cmd,
+ "cs <1-4>",
+ "Set the Coding Scheme to be used, (overrides BTS config)\n")
+{
+ struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ uint8_t cs = atoi(argv[0]);
+
+ bts->force_cs = 1;
+ bts->initial_cs = cs;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_pcu_no_cs,
+ cfg_pcu_no_cs_cmd,
+ "no cs",
+ NO_STR "Don't force given Coding Scheme, (use BTS config)\n")
+{
+ struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+
+ bts->force_cs = 0;
+
+ return CMD_SUCCESS;
+}
+
static const char pcu_copyright[] =
"Copyright (C) 2012 by ...\r\n"
"License GNU GPL version 2 or later\r\n"
@@ -100,5 +140,12 @@ int pcu_vty_init(const struct log_info *cat)
logging_vty_add_cmds(cat);
+ install_node(&pcu_node, config_write_pcu);
+ install_element(CONFIG_NODE, &cfg_pcu_cmd);
+ install_default(PCU_NODE);
+ install_element(PCU_NODE, &cfg_pcu_cs_cmd);
+ install_element(PCU_NODE, &cfg_pcu_no_cs_cmd);
+ install_element(PCU_NODE, &ournode_end_cmd);
+
return 0;
}