summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/internal.h1
-rw-r--r--include/osmocom/abis/e1_input.h2
-rw-r--r--src/Makefile.am1
-rw-r--r--src/e1_input_vty.c102
4 files changed, 106 insertions, 0 deletions
diff --git a/include/internal.h b/include/internal.h
index 0da45e8..12e4386 100644
--- a/include/internal.h
+++ b/include/internal.h
@@ -3,6 +3,7 @@
/* XXX: fix this in libosmocore, we need some reserved range */
#define IPA_NODE _LAST_OSMOVTY_NODE + 100
+#define E1INP_NODE _LAST_OSMOVTY_NODE + 101
/* talloc context for libosmo-abis. */
extern void *libosmo_abis_ctx;
diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index 4339e05..51c9273 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -216,6 +216,8 @@ struct subch_mux *e1inp_get_mux(uint8_t e1_nr, uint8_t ts_nr);
void e1inp_sign_link_destroy(struct e1inp_sign_link *link);
int e1inp_line_update(struct e1inp_line *line);
+int e1inp_vty_init(void);
+
struct gsm_network;
int ipaccess_setup(struct gsm_network *gsmnet);
int hsl_setup(struct gsm_network *gsmnet);
diff --git a/src/Makefile.am b/src/Makefile.am
index d81a6c3..eb4467c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,6 +13,7 @@ lib_LTLIBRARIES = libosmoabis.la
libosmoabis_la_LIBADD = input/libosmoabis-input.la
libosmoabis_la_SOURCES = init.c \
e1_input.c \
+ e1_input_vty.c \
ipa_proxy.c \
subchan_demux.c \
trau_frame.c
diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c
new file mode 100644
index 0000000..55a9951
--- /dev/null
+++ b/src/e1_input_vty.c
@@ -0,0 +1,102 @@
+/* E1 vty interface */
+/* (C) 2011 by Harald Welte <laforge@gnumonks.org>
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ */
+#include "internal.h"
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <osmocom/vty/command.h>
+#include <osmocom/vty/buffer.h>
+#include <osmocom/vty/vty.h>
+#include <osmocom/vty/logging.h>
+#include <osmocom/vty/telnet_interface.h>
+
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/abis/e1_input.h>
+#include <osmocom/core/utils.h>
+#include <osmocom/gsm/gsm_utils.h>
+#include <talloc.h>
+
+#define E1_DRIVER_NAMES "(misdn|dahdi|ipa|hsl)"
+#define E1_DRIVER_HELP "mISDN supported E1 Card\n" \
+ "DAHDI supported E1/T1/J1 Card\n" \
+ "IPA TCP/IP input" \
+ "HSL TCP/IP input"
+
+DEFUN(cfg_e1line_driver, cfg_e1_line_driver_cmd,
+ "e1_line <0-255> driver " E1_DRIVER_NAMES,
+ "Configure E1/T1/J1 Line\n" "Line Number\n" "Set driver for this line\n"
+ E1_DRIVER_HELP)
+{
+ struct e1inp_line *line;
+ int e1_nr = atoi(argv[0]);
+
+ line = e1inp_line_get(e1_nr);
+ if (line) {
+ vty_out(vty, "%% Line %d already exists%s", e1_nr, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ line = e1inp_line_create(e1_nr, argv[1]);
+ if (!line) {
+ vty_out(vty, "%% Error creating line %d%s", e1_nr, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_e1inp, cfg_e1inp_cmd,
+ "e1_input",
+ "Configure E1/T1/J1 TDM input\n")
+{
+ vty->node = E1INP_NODE;
+
+ return CMD_SUCCESS;
+}
+
+static int e1inp_config_write(struct vty *vty)
+{
+ struct e1inp_line *line;
+
+ if (llist_empty(&e1inp_line_list))
+ return CMD_SUCCESS;
+
+ vty_out(vty, "e1_input%s", VTY_NEWLINE);
+
+ llist_for_each_entry(line, &e1inp_line_list, list) {
+ vty_out(vty, " e1_line %u driver %s%s", line->num,
+ line->driver->name, VTY_NEWLINE);
+ }
+ return CMD_SUCCESS;
+}
+
+struct cmd_node e1inp_node = {
+ E1INP_NODE,
+ "%s(e1_input)#",
+ 1,
+};
+
+int e1inp_vty_init(void)
+{
+ install_element(CONFIG_NODE, &cfg_e1inp_cmd);
+ install_node(&e1inp_node, e1inp_config_write);
+ install_element(E1INP_NODE, &cfg_e1_line_driver_cmd);
+
+ return 0;
+}