Statistics
| Branch: | Revision:

iof-bird-daemon / conf / conf.h @ bc2fb680

History | View | Annotate | Download (2.08 KB)

1 fe7cec12 Martin Mares
/*
2
 *        BIRD Internet Routing Daemon -- Configuration File Handling
3
 *
4 31b3e1bb Martin Mares
 *        (c) 1998--1999 Martin Mares <mj@ucw.cz>
5 fe7cec12 Martin Mares
 *
6
 *        Can be freely distributed and used under the terms of the GNU GPL.
7
 */
8
9
#ifndef _BIRD_CONF_H_
10
#define _BIRD_CONF_H_
11
12
#include "lib/resource.h"
13
14 31b3e1bb Martin Mares
/* Configuration structure */
15
16
struct config {
17
  pool *pool;                                /* Pool the configuration is stored in */
18
  linpool *mem;                                /* Linear pool containing configuration data */
19
  list protos;                                /* Configured protocol instances (struct proto_config) */
20 4107df1d Martin Mares
  list tables;                                /* Configured routing tables (struct rtable_config) */
21
  struct rtable_config *master_rtc;        /* Configuration of master routing table */
22 31b3e1bb Martin Mares
  u32 router_id;                        /* Our Router ID */
23
  char *err_msg;                        /* Parser error message */
24
  int err_lino;                                /* Line containing error */
25
  char *file_name;                        /* Name of configuration file */
26
};
27
28
extern struct config *config, *new_config;
29
/* Please don't use these variables in protocols. Use proto_config->global instead. */
30
31
struct config *config_alloc(byte *name);
32
int config_parse(struct config *);
33 bc2fb680 Martin Mares
int cli_parse(struct config *);
34 31b3e1bb Martin Mares
void config_free(struct config *);
35
void config_commit(struct config *);
36
void cf_error(char *msg, ...) NORET;
37
38 49e4a4d1 Martin Mares
/* Pools */
39
40 b35d72ac Martin Mares
extern linpool *cfg_mem;
41 fe7cec12 Martin Mares
42 b35d72ac Martin Mares
#define cfg_alloc(size) lp_alloc(cfg_mem, size)
43
#define cfg_allocu(size) lp_allocu(cfg_mem, size)
44
#define cfg_allocz(size) lp_allocz(cfg_mem, size)
45
char *cfg_strdup(char *c);
46 49e4a4d1 Martin Mares
47 fe7cec12 Martin Mares
/* Lexer */
48
49
extern int (*cf_read_hook)(byte *buf, unsigned int max);
50
51
struct symbol {
52
  struct symbol *next;
53
  int class;
54 0b62c3a7 Martin Mares
  int aux;
55 6542ece9 Pavel Machek
  void *aux2; 
56 fe7cec12 Martin Mares
  void *def;
57
  char name[1];
58
};
59
60
#define SYM_VOID 0
61 8450be97 Martin Mares
#define SYM_PROTO 1
62 0b62c3a7 Martin Mares
#define SYM_NUMBER 2
63 72380a34 Pavel Machek
#define SYM_STAT 3 /* statement */
64
#define SYM_FUNCTION 5
65
#define SYM_FILTER 6
66 4107df1d Martin Mares
#define SYM_TABLE 7
67 fe7cec12 Martin Mares
68 ba921648 Pavel Machek
#define SYM_VARIABLE 0x100        /* Reserved 0x100..0x1ff */
69
70 31b3e1bb Martin Mares
extern int conf_lino;
71
72 fe7cec12 Martin Mares
void cf_lex_init_tables(void);
73
int cf_lex(void);
74 bc2fb680 Martin Mares
void cf_lex_init(int is_cli);
75 4107df1d Martin Mares
struct symbol *cf_find_symbol(byte *c);
76 4ba84ebc Martin Mares
struct symbol *cf_default_name(char *prefix, int *counter);
77 4107df1d Martin Mares
void cf_define_symbol(struct symbol *symbol, int type, void *def);
78 fe7cec12 Martin Mares
79
/* Parser */
80
81
int cf_parse(void);
82
83
#endif