diff options
author | Martin Mares <mj@ucw.cz> | 1999-12-06 13:34:45 +0100 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1999-12-06 13:34:45 +0100 |
commit | 34350a52700955d50895058d01b5407aea970e9b (patch) | |
tree | 925eac326696cfa553d92cc320dc88ea1280659b /nest/cli.h | |
parent | f3792601dfe85c3017c984a6de5722d0e9da8a16 (diff) | |
download | bird-34350a52700955d50895058d01b5407aea970e9b.tar bird-34350a52700955d50895058d01b5407aea970e9b.zip |
Implemented echoing of log messages to CLI connections. Just try `echo all'.
Diffstat (limited to 'nest/cli.h')
-rw-r--r-- | nest/cli.h | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 */ |