From 34350a52700955d50895058d01b5407aea970e9b Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 6 Dec 1999 12:34:45 +0000 Subject: Implemented echoing of log messages to CLI connections. Just try `echo all'. --- nest/cli.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'nest/cli.h') diff --git a/nest/cli.h b/nest/cli.h index 3af1885..3375f21 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 */ -- cgit v1.2.3