1
|
1 /***************************************************************************
|
|
2 * Copyright (C) 2005 by 510 Software Group *
|
|
3 * *
|
|
4 * *
|
|
5 * This program is free software; you can redistribute it and/or modify *
|
|
6 * it under the terms of the GNU General Public License as published by *
|
|
7 * the Free Software Foundation; either version 2 of the License, or *
|
|
8 * (at your option) any later version. *
|
|
9 * *
|
|
10 * This program is distributed in the hope that it will be useful, *
|
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
13 * GNU General Public License for more details. *
|
|
14 * *
|
|
15 * You should have received a copy of the GNU General Public License *
|
|
16 * along with this program; if not, write to the *
|
|
17 * Free Software Foundation, Inc., *
|
|
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
19 ***************************************************************************/
|
|
20
|
|
21 #ifndef syslogconfig_include
|
|
22 #define syslogconfig_include
|
|
23
|
|
24 #include "tokenizer.h"
|
|
25 #include <map>
|
|
26
|
|
27
|
|
28 class SYSLOGCONFIG;
|
|
29
|
|
30 typedef SYSLOGCONFIG * SYSLOGCONFIGP;
|
|
31 typedef list<SYSLOGCONFIGP> syslogconfig_list;
|
|
32 enum parser_style {cisco, ssh};
|
|
33
|
|
34 class SYSLOGCONFIG {
|
|
35 char * file_name; // name of the syslog file
|
|
36 parser_style parser;
|
|
37 public:
|
|
38 SYSLOGCONFIG(char *file_name_, parser_style parser_);
|
|
39 ~SYSLOGCONFIG();
|
|
40 void dump(int level);
|
|
41 };
|
|
42
|
|
43 struct CONFIG {
|
|
44 // the only mutable stuff once it has been loaded from the config file
|
|
45 int reference_count; // protected by the global config_mutex
|
|
46 // all the rest is constant after loading from the config file
|
|
47 int generation;
|
|
48 time_t load_time;
|
|
49 string_set config_files;
|
|
50 syslogconfig_list syslogconfigs; // owns all the syslogconfigs, not just top level syslogconfigs
|
|
51
|
|
52 CONFIG();
|
|
53 ~CONFIG();
|
|
54 void add_syslogconfig(SYSLOGCONFIGP con);
|
|
55 void dump();
|
|
56 };
|
|
57
|
|
58 void discard(string_set &s);
|
|
59 char* register_string(string_set &s, char *name);
|
|
60 char* register_string(char *name);
|
|
61 CONFIG *parse_config(char *fn);
|
|
62 bool load_conf(CONFIG &dc, char *fn);
|
|
63 void token_init();
|
|
64
|
|
65 extern char *token_cisco;
|
|
66 extern char *token_file;
|
|
67 extern char *token_include;
|
|
68 extern char *token_lbrace;
|
|
69 extern char *token_parser;
|
|
70 extern char *token_rbrace;
|
|
71 extern char *token_semi;
|
|
72 extern char *token_ssh;
|
|
73
|
|
74 #endif
|