[PATCH] osmo-iuh[master]: hnbgw vty: add empty hnbgw and hnbgw/iuh vty nodes

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Aug 18 01:26:42 UTC 2016


Review at  https://gerrit.osmocom.org/710

hnbgw vty: add empty hnbgw and hnbgw/iuh vty nodes

Add include/osmocom/iuh/ named after this project (osmo-iuh), and add vty.h to
define VTY node enum values. Also add (to) Makefile.am and configure.ac to
include in the build.

An upcoming commit will add the actual first config item to the hnbgw/iuh node.

Change-Id: I71545823d3bd81cb888c85df8e298a56c98bf131
---
M configure.ac
M include/osmocom/Makefile.am
A include/osmocom/iuh/Makefile.am
A include/osmocom/iuh/vty.h
M src/hnbgw_vty.c
5 files changed, 62 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/10/710/1

diff --git a/configure.ac b/configure.ac
index fc8c737..38e3b4c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,4 +41,5 @@
 	include/osmocom/hnbap/Makefile
 	include/osmocom/ranap/Makefile
 	include/osmocom/rua/Makefile
+	include/osmocom/iuh/Makefile
 	)
diff --git a/include/osmocom/Makefile.am b/include/osmocom/Makefile.am
index f89b5dc..246cb34 100644
--- a/include/osmocom/Makefile.am
+++ b/include/osmocom/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = hnbap ranap rua
+SUBDIRS = hnbap ranap rua iuh
 
diff --git a/include/osmocom/iuh/Makefile.am b/include/osmocom/iuh/Makefile.am
new file mode 100644
index 0000000..e2f7126
--- /dev/null
+++ b/include/osmocom/iuh/Makefile.am
@@ -0,0 +1,2 @@
+noinst_HEADERS = \
+	vty.h
diff --git a/include/osmocom/iuh/vty.h b/include/osmocom/iuh/vty.h
new file mode 100644
index 0000000..905a949
--- /dev/null
+++ b/include/osmocom/iuh/vty.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#include <osmocom/vty/vty.h>
+
+enum osmo_iuh_vty_node {
+	HNBGW_NODE = _LAST_OSMOVTY_NODE + 1,
+	IUH_NODE,
+};
+
diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c
index f29b849..0845ff7 100644
--- a/src/hnbgw_vty.c
+++ b/src/hnbgw_vty.c
@@ -20,11 +20,39 @@
 
 #include <osmocom/vty/command.h>
 
+#include <osmocom/iuh/vty.h>
+
 #include "hnbgw.h"
 #include "context_map.h"
 
 static void *tall_hnb_ctx = NULL;
 static struct hnb_gw *g_hnb_gw = NULL;
+
+static struct cmd_node hnbgw_node = {
+	HNBGW_NODE,
+	"%s(config-hnbgw)# ",
+	1,
+};
+
+DEFUN(cfg_hnbgw, cfg_hnbgw_cmd,
+      "hnbgw", "Configure HNBGW options")
+{
+	vty->node = HNBGW_NODE;
+	return CMD_SUCCESS;
+}
+
+static struct cmd_node iuh_node = {
+	IUH_NODE,
+	"%s(config-hnbgw-iuh)# ",
+	1,
+};
+
+DEFUN(cfg_hnbgw_iuh, cfg_hnbgw_iuh_cmd,
+      "iuh", "Configure Iuh options")
+{
+	vty->node = IUH_NODE;
+	return CMD_SUCCESS;
+}
 
 static void vty_dump_hnb_info(struct vty *vty, struct hnb_context *hnb)
 {
@@ -77,10 +105,31 @@
 	return CMD_SUCCESS;
 }
 
+static int config_write_hnbgw(struct vty *vty)
+{
+	vty_out(vty, "hnbgw%s", VTY_NEWLINE);
+	return CMD_SUCCESS;
+}
+
+static int config_write_hnbgw_iuh(struct vty *vty)
+{
+	vty_out(vty, " iuh%s", VTY_NEWLINE);
+	return CMD_SUCCESS;
+}
+
 void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx)
 {
 	g_hnb_gw = gw;
 	tall_hnb_ctx = tall_ctx;
+
+	install_element(CONFIG_NODE, &cfg_hnbgw_cmd);
+	install_node(&hnbgw_node, config_write_hnbgw);
+	vty_install_default(HNBGW_NODE);
+
+	install_element(HNBGW_NODE, &cfg_hnbgw_iuh_cmd);
+	install_node(&iuh_node, config_write_hnbgw_iuh);
+	vty_install_default(IUH_NODE);
+
 	install_element_ve(&show_hnb_cmd);
 	install_element_ve(&show_ue_cmd);
 	install_element_ve(&show_talloc_cmd);

-- 
To view, visit https://gerrit.osmocom.org/710
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I71545823d3bd81cb888c85df8e298a56c98bf131
Gerrit-PatchSet: 1
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list