Statistics
| Branch: | Revision:

iof-bird-daemon / nest / cli.h @ b9672a84

History | View | Annotate | Download (1.09 KB)

1
/*
2
 *        BIRD Internet Routing Daemon -- Command-Line Interface
3
 *
4
 *        (c) 1999 Martin Mares <mj@ucw.cz>
5
 *
6
 *        Can be freely distributed and used under the terms of the GNU GPL.
7
 */
8

    
9
#ifndef _BIRD_CLI_H_
10
#define _BIRD_CLI_H_
11

    
12
#include "lib/resource.h"
13
#include "lib/event.h"
14

    
15
#define CLI_RX_BUF_SIZE 4096
16
#define CLI_TX_BUF_SIZE 4096
17

    
18
struct cli_out {
19
  struct cli_out *next;
20
  byte *wpos, *outpos, *end;
21
  byte buf[0];
22
};
23

    
24
typedef struct cli {
25
  pool *pool;
26
  void *priv;                                /* Private to sysdep layer */
27
  byte rx_buf[CLI_RX_BUF_SIZE];
28
  byte *rx_pos, *rx_aux;                /* sysdep */
29
  struct cli_out *tx_buf, *tx_pos, *tx_write;
30
  event *event;
31
  void (*cont)(struct cli *c);
32
  void *rover;                                /* Private to continuation routine */
33
  int last_reply;
34
} cli;
35

    
36
extern pool *cli_pool;
37

    
38
/* Functions to be called by command handlers */
39

    
40
void cli_printf(cli *, int, char *, ...);
41

    
42
/* Functions provided to sysdep layer */
43

    
44
cli *cli_new(void *);
45
void cli_init(void);
46
void cli_free(cli *);
47
void cli_kick(cli *);
48
void cli_written(cli *);
49

    
50
/* Functions provided by sysdep layer */
51

    
52
int cli_write(cli *);
53
int cli_get_command(cli *);
54

    
55
#endif