1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Implemented echoing of log messages to CLI connections. Just try `echo all'.

This commit is contained in:
Martin Mares
1999-12-06 12:34:45 +00:00
parent f3792601df
commit 34350a5270
6 changed files with 207 additions and 67 deletions

View File

@@ -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 */