1999-12-06 21:45:56 +08:00
|
|
|
/*
|
|
|
|
* BIRD -- UNIX Configuration
|
|
|
|
*
|
2000-01-17 00:44:50 +08:00
|
|
|
* (c) 1999--2000 Martin Mares <mj@ucw.cz>
|
1999-12-06 21:45:56 +08:00
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
CF_HDR
|
|
|
|
|
|
|
|
#include "lib/unix.h"
|
|
|
|
|
|
|
|
CF_DECLS
|
|
|
|
|
1999-12-06 21:51:04 +08:00
|
|
|
CF_KEYWORDS(LOG, SYSLOG, ALL, DEBUG, TRACE, INFO, REMOTE, WARNING, ERROR, AUTH, FATAL, BUG, STDERR)
|
1999-12-06 21:45:56 +08:00
|
|
|
|
|
|
|
%type <i> log_mask log_mask_list log_cat
|
1999-12-06 21:51:04 +08:00
|
|
|
%type <g> log_file
|
2000-01-17 00:44:50 +08:00
|
|
|
%type <t> cfg_name
|
1999-12-06 21:45:56 +08:00
|
|
|
|
|
|
|
CF_GRAMMAR
|
|
|
|
|
|
|
|
CF_ADDTO(conf, log_config)
|
|
|
|
|
1999-12-06 21:51:04 +08:00
|
|
|
log_config: LOG log_file log_mask ';' {
|
1999-12-06 21:45:56 +08:00
|
|
|
struct log_config *c = cfg_allocz(sizeof(struct log_config));
|
1999-12-06 21:51:04 +08:00
|
|
|
c->fh = $2;
|
1999-12-06 21:45:56 +08:00
|
|
|
c->mask = $3;
|
|
|
|
add_tail(&new_config->logfiles, &c->n);
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
1999-12-06 21:51:04 +08:00
|
|
|
log_file:
|
|
|
|
TEXT {
|
|
|
|
FILE *f = tracked_fopen(new_config->pool, $1, "a");
|
|
|
|
if (!f) cf_error("Unable to open log file `%s': %m", $1);
|
|
|
|
$$ = f;
|
|
|
|
}
|
|
|
|
| SYSLOG { $$ = NULL; }
|
|
|
|
| STDERR { $$ = stderr; }
|
|
|
|
;
|
|
|
|
|
1999-12-06 21:45:56 +08:00
|
|
|
log_mask:
|
|
|
|
ALL { $$ = ~0; }
|
|
|
|
| '{' log_mask_list '}' { $$ = $2; }
|
|
|
|
;
|
|
|
|
|
|
|
|
log_mask_list:
|
|
|
|
log_cat { $$ = 1 << $1; }
|
|
|
|
| log_mask_list ',' log_cat { $$ = $1 | (1 << $3); }
|
|
|
|
;
|
|
|
|
|
|
|
|
log_cat:
|
|
|
|
DEBUG { $$ = L_DEBUG[0]; }
|
|
|
|
| TRACE { $$ = L_TRACE[0]; }
|
|
|
|
| INFO { $$ = L_INFO[0]; }
|
|
|
|
| REMOTE { $$ = L_REMOTE[0]; }
|
|
|
|
| WARNING { $$ = L_WARN[0]; }
|
|
|
|
| ERROR { $$ = L_ERR[0]; }
|
|
|
|
| AUTH { $$ = L_AUTH[0]; }
|
|
|
|
| FATAL { $$ = L_FATAL[0]; }
|
|
|
|
| BUG { $$ = L_BUG[0]; }
|
|
|
|
;
|
|
|
|
|
2000-01-17 00:44:50 +08:00
|
|
|
/* Unix specific commands */
|
|
|
|
|
|
|
|
CF_CLI(CONFIGURE, cfg_name, [<file>], [[Reload configuration]])
|
|
|
|
{ cmd_reconfig($2); } ;
|
|
|
|
|
2000-03-08 04:09:35 +08:00
|
|
|
CF_CLI(DOWN,,, [[Shut the daemon down]])
|
2000-01-17 07:36:19 +08:00
|
|
|
{ cli_msg(7, "Shutdown requested"); order_shutdown(); } ;
|
2000-01-17 01:40:26 +08:00
|
|
|
|
2000-01-17 00:44:50 +08:00
|
|
|
cfg_name:
|
|
|
|
/* empty */ { $$ = NULL; }
|
|
|
|
| TEXT
|
|
|
|
;
|
|
|
|
|
1999-12-06 21:45:56 +08:00
|
|
|
CF_CODE
|
|
|
|
|
|
|
|
CF_END
|