summaryrefslogtreecommitdiff
path: root/nest/cli.h
diff options
context:
space:
mode:
Diffstat (limited to 'nest/cli.h')
-rw-r--r--nest/cli.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/nest/cli.h b/nest/cli.h
index 3af1885d..3375f213 100644
--- a/nest/cli.h
+++ b/nest/cli.h
@@ -14,6 +14,7 @@
#define CLI_RX_BUF_SIZE 4096
#define CLI_TX_BUF_SIZE 4096
+#define CLI_MAX_ASYNC_QUEUE 4096
struct cli_out {
struct cli_out *next;
@@ -22,10 +23,10 @@ struct cli_out {
};
typedef struct cli {
+ node n; /* Node in list of all log hooks */
pool *pool;
void *priv; /* Private to sysdep layer */
- byte rx_buf[CLI_RX_BUF_SIZE];
- byte *rx_pos, *rx_aux; /* sysdep */
+ byte *rx_buf, *rx_pos, *rx_aux; /* sysdep */
struct cli_out *tx_buf, *tx_pos, *tx_write;
event *event;
void (*cont)(struct cli *c);
@@ -33,6 +34,12 @@ typedef struct cli {
void *rover; /* Private to continuation routine */
int last_reply;
struct linpool *parser_pool; /* Pool used during parsing */
+ byte *ring_buf; /* Ring buffer for asynchronous messages */
+ byte *ring_end, *ring_read, *ring_write; /* Pointers to the ring buffer */
+ unsigned int ring_overflow; /* Counter of ring overflows */
+ unsigned int log_mask; /* Mask of allowed message levels */
+ unsigned int log_threshold; /* When free < log_threshold, store only important messages */
+ unsigned int async_msg_size; /* Total size of async messages queued in tx_buf */
} cli;
extern pool *cli_pool;
@@ -42,6 +49,7 @@ extern struct cli *this_cli; /* Used during parsing */
void cli_printf(cli *, int, char *, ...);
#define cli_msg(x...) cli_printf(this_cli, x)
+void cli_set_log_echo(cli *, unsigned int mask, unsigned int size);
/* Functions provided to sysdep layer */
@@ -50,6 +58,7 @@ void cli_init(void);
void cli_free(cli *);
void cli_kick(cli *);
void cli_written(cli *);
+void cli_echo(unsigned int class, byte *msg);
/* Functions provided by sysdep layer */