aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-24 00:10:41 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-25 11:02:35 +0100
commitf81eb328b61f65a09b7233aaa70b2f655c0300bc (patch)
tree012101b01694b2f9aeba3defa891d935ffcb86c8 /include/osmocom
parent4934309dab3dcd785e75f3ba227e51b19fe714fb (diff)
vty: add ctrl section for Control interface bind address
This may seem like overkill for a mere const char * config item, but it makes the Control interface VTY commands reusable in any main() scope (inspired by libosmo-abis' VTY config). Add API functions ctrl_vty_init() and ctrl_vty_get_bind_addr(), in new files src/ctrl/control_vty.c and include/osmocom/ctrl/control_vty.h, compiled and/or installed dependent on ENABLE_VTY. Using these functions allows configuring a static const char* with the VTY commands ctrl bind A.B.C.D which callers shall subsequently use to bind the Control interface to a specific local interface address, by passing the return value of ctrl_vty_get_bind_addr() to control_interface_setup(). Add CTRL_NODE to enum node_type, "eating" RESERVED4_NODE to heed that comment on avoiding ABI changes.
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/ctrl/control_vty.h9
-rw-r--r--include/osmocom/vty/command.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/include/osmocom/ctrl/control_vty.h b/include/osmocom/ctrl/control_vty.h
new file mode 100644
index 00000000..d0ef69f4
--- /dev/null
+++ b/include/osmocom/ctrl/control_vty.h
@@ -0,0 +1,9 @@
+#pragma once
+
+/* Add the 'ctrl' section to VTY, containing the 'bind' command. */
+int ctrl_vty_init(void *ctx);
+
+/* Obtain the IP address configured by the 'ctrl'/'bind A.B.C.D' VTY command.
+ * This should be fed to ctrl_interface_setup() once the configuration has been
+ * read. */
+const char *ctrl_vty_get_bind_addr(void);
diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h
index 2078e1bb..9a025752 100644
--- a/include/osmocom/vty/command.h
+++ b/include/osmocom/vty/command.h
@@ -83,6 +83,7 @@ enum node_type {
L_IPA_NODE, /*!< \brief IPA proxying commands in libosmo-abis. */
L_NS_NODE, /*!< \brief NS node in libosmo-gb. */
L_BSSGP_NODE, /*!< \brief BSSGP node in libosmo-gb. */
+ L_CTRL_NODE, /*!< \brief Control interface node. */
/*
* When adding new nodes to the libosmocore project, these nodes can be
@@ -91,7 +92,6 @@ enum node_type {
RESERVED1_NODE, /*!< \brief Reserved for later extensions */
RESERVED2_NODE, /*!< \brief Reserved for later extensions */
RESERVED3_NODE, /*!< \brief Reserved for later extensions */
- RESERVED4_NODE, /*!< \brief Reserved for later extensions */
_LAST_OSMOVTY_NODE
};