summaryrefslogtreecommitdiffstats
path: root/include/osmocom/vty
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-07-12 09:22:56 +0200
committerHarald Welte <laforge@gnumonks.org>2012-07-12 09:42:36 +0200
commit3c6a2cef5ed692ba20a925357bbbae13ae8d80db (patch)
tree9f8fbd99ecef694e4bbe2e2bf648439a49debb22 /include/osmocom/vty
parentfb4bfc2ad5a3492d72a612e16fd4b69eb01f96e3 (diff)
VTY: Allow to compile vty.h and command.h headers with C++
Diffstat (limited to 'include/osmocom/vty')
-rw-r--r--include/osmocom/vty/command.h3
-rw-r--r--include/osmocom/vty/vty.h11
2 files changed, 11 insertions, 3 deletions
diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h
index c8cea7c5..caafdeb5 100644
--- a/include/osmocom/vty/command.h
+++ b/include/osmocom/vty/command.h
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <sys/types.h>
#include "vector.h"
-#include "vty.h"
/*! \defgroup command VTY Command
* @{
@@ -88,6 +87,8 @@ enum node_type {
_LAST_OSMOVTY_NODE
};
+#include "vty.h"
+
/*! \brief Node which has some commands and prompt string and
* configuration function pointer . */
struct cmd_node {
diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h
index 1518894b..e656abf6 100644
--- a/include/osmocom/vty/vty.h
+++ b/include/osmocom/vty/vty.h
@@ -40,6 +40,13 @@ enum event {
#endif /* VTYSH */
};
+enum vty_type {
+ VTY_TERM,
+ VTY_FILE,
+ VTY_SHELL,
+ VTY_SHELL_SERV
+};
+
/*! Internal representation of a single VTY */
struct vty {
/*! \brief underlying file (if any) */
@@ -52,7 +59,7 @@ struct vty {
int fd;
/*! \brief Is this vty connect to file or not */
- enum { VTY_TERM, VTY_FILE, VTY_SHELL, VTY_SHELL_SERV } type;
+ enum vty_type type;
/*! \brief Node status of this vty */
int node;
@@ -134,7 +141,7 @@ struct vty {
/* Small macro to determine newline is newline only or linefeed needed. */
#define VTY_NEWLINE ((vty->type == VTY_TERM) ? "\r\n" : "\n")
-static inline char *vty_newline(struct vty *vty)
+static inline const char *vty_newline(struct vty *vty)
{
return VTY_NEWLINE;
}