summaryrefslogtreecommitdiff
path: root/nest/cli.h
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-10-29 12:10:10 +0000
committerMartin Mares <mj@ucw.cz>1999-10-29 12:10:10 +0000
commit7d3aab1c1643e8b2bcff7f856e0d4455fa0ba4b4 (patch)
tree8e2e7d110338803c8f81f7deab2ddb03f19d2bce /nest/cli.h
parentb93abffae4ad5767625b35c9a09513e9d27a5256 (diff)
First steps of the Command Line Interface: I/O routines.
Diffstat (limited to 'nest/cli.h')
-rw-r--r--nest/cli.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/nest/cli.h b/nest/cli.h
new file mode 100644
index 00000000..69271fec
--- /dev/null
+++ b/nest/cli.h
@@ -0,0 +1,49 @@
+/*
+ * BIRD Internet Routing Daemon -- Command-Line Interface
+ *
+ * (c) 1999 Martin Mares <mj@ucw.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#ifndef _BIRD_CLI_H_
+#define _BIRD_CLI_H_
+
+#include "lib/resource.h"
+#include "lib/event.h"
+
+#define CLI_RX_BUF_SIZE 4096
+#define CLI_TX_BUF_SIZE 4096
+
+struct cli_out {
+ struct cli_out *next;
+ byte *wpos, *outpos, *end;
+ byte buf[0];
+};
+
+typedef struct cli {
+ pool *pool;
+ void *priv; /* Private to sysdep layer */
+ int inited;
+ byte rx_buf[CLI_RX_BUF_SIZE];
+ byte *rx_pos, *rx_aux; /* sysdep */
+ struct cli_out *tx_buf, *tx_pos, *tx_write;
+ event *event;
+} cli;
+
+extern pool *cli_pool;
+
+cli *cli_new(void *);
+void cli_init(void);
+void cli_free(cli *);
+void cli_kick(cli *);
+void cli_written(cli *);
+void cli_printf(cli *, int, char *, ...);
+
+/* Function provided by sysdep layer */
+
+int cli_write(cli *);
+void cli_disconnect(cli *);
+int cli_get_command(cli *);
+
+#endif