summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/vty/prometheus.h135
1 files changed, 135 insertions, 0 deletions
diff --git a/include/osmocom/vty/prometheus.h b/include/osmocom/vty/prometheus.h
new file mode 100644
index 00000000..2a09a127
--- /dev/null
+++ b/include/osmocom/vty/prometheus.h
@@ -0,0 +1,135 @@
+#include <osmocom/core/select.h>
+
+
+/*! A telnet connection */
+struct prom_connection {
+ /*! linked list header for internal management */
+ struct llist_head entry;
+ /*! private data pointer passed through */
+ void *priv;
+ /*! filedsecriptor (socket ) */
+ struct osmo_fd fd;
+ /*! VTY instance associated with telnet connection */
+ struct prom_vty *vty;
+ /*! logging target associated with this telnet connection */
+ struct log_target *dbg;
+};
+
+
+int osmo_prom_init(void *ctx, int port);
+
+int osmo_prom_init_dynif(void *ctx, const char *host, int port);
+
+#define PROM_HTTP_BUFSIZ 512
+
+//#define PROM_VTY_BUFSIZ 512
+
+// TODO kill PROM_VTY_MAXHIST
+#define PROM_VTY_MAXHIST 0
+
+//
+//enum event {
+// PROM_VTY_SERV,
+// PROM_VTY_READ,
+// PROM_VTY_WRITE,
+// PROM_VTY_CLOSED,
+// PROM_VTY_TIMEOUT_RESET,
+//};
+
+/*! Internal representation of a single VTY */
+struct prom_vty {
+ /*! underlying file (if any) */
+ FILE *file;
+
+ /*! private data, specified by creator */
+ void *priv;
+
+ /*! File descripter of this vty. */
+ int fd;
+
+ /*! Is this vty connect to file or not */
+ //enum prom_vty_type type;
+
+ /*! Node status of this vty */
+ int node;
+
+ /*! Failure count */
+ int fail;
+
+ /*! Output buffer. */
+ struct buffer *obuf;
+
+ /*! Command input buffer */
+ char *buf;
+
+ /*! Command cursor point */
+ int cp;
+
+ /*! Command length */
+ int length;
+
+ /*! Command max length. */
+ int max;
+
+ /*! Histry of command */
+ char *hist[PROM_VTY_MAXHIST];
+
+ /*! History lookup current point */
+ int hp;
+
+ /*! History insert end point */
+ int hindex;
+
+ /*! For current referencing point of interface, route-map,
+ access-list etc... */
+ void *index;
+
+ /*! For multiple level index treatment such as key chain and key. */
+ void *index_sub;
+
+ /*! For escape character. */
+ unsigned char escape;
+
+ /*! Current vty status. */
+ enum { PROM_VTY_NORMAL, PROM_VTY_CLOSE, PROM_VTY_MORE, PROM_VTY_MORELINE } status;
+
+ /*! IAC handling
+ *
+ * IAC handling: was the last character received the IAC
+ * (interpret-as-command) escape character (and therefore the next
+ * character will be the command code)? Refer to Telnet RFC 854. */
+ unsigned char iac;
+
+ /*! IAC SB (option subnegotiation) handling */
+ unsigned char iac_sb_in_progress;
+ /* At the moment, we care only about the NAWS (window size) negotiation,
+ * and that requires just a 5-character buffer (RFC 1073):
+ * <NAWS char> <16-bit width> <16-bit height> */
+#define TELNET_NAWS_SB_LEN 5
+ /*! sub-negotiation buffer */
+ unsigned char sb_buf[TELNET_NAWS_SB_LEN];
+ /*! How many subnegotiation characters have we received?
+ *
+ * We just drop those that do not fit in the buffer. */
+ size_t sb_len;
+
+ /*! Window width */
+ int width;
+ /*! Widnow height */
+ int height;
+
+ /*! Configure lines. */
+ int lines;
+
+ int monitor;
+
+ /*! In configure mode. */
+ int config;
+
+ /*! List of parent nodes, last item is the outermost parent. */
+ struct llist_head parent_nodes;
+
+ /*! When reading from a config file, these are the indenting characters expected for children of
+ * the current VTY node. */
+ char *indent;
+};