comparison src/syslogconfig.h @ 2:6e88da080f08

initial coding
author carl
date Thu, 24 Nov 2005 10:31:09 -0800
parents 551433a01cab
children 8fe310e5cd44
comparison
equal deleted inserted replaced
1:551433a01cab 2:6e88da080f08
28 class SYSLOGCONFIG; 28 class SYSLOGCONFIG;
29 29
30 typedef SYSLOGCONFIG * SYSLOGCONFIGP; 30 typedef SYSLOGCONFIG * SYSLOGCONFIGP;
31 typedef list<SYSLOGCONFIGP> syslogconfig_list; 31 typedef list<SYSLOGCONFIGP> syslogconfig_list;
32 enum parser_style {cisco, ssh}; 32 enum parser_style {cisco, ssh};
33 const int buflen = 1024;
33 34
34 class SYSLOGCONFIG { 35 class SYSLOGCONFIG {
35 char * file_name; // name of the syslog file 36 char * file_name; // name of the syslog file
36 parser_style parser; 37 parser_style parser;
38 int fd;
39 int len; // bytes in the buffer
40 char buf[buflen];
37 public: 41 public:
38 SYSLOGCONFIG(char *file_name_, parser_style parser_); 42 SYSLOGCONFIG(TOKEN &tok, char *file_name_, parser_style parser_);
39 ~SYSLOGCONFIG(); 43 ~SYSLOGCONFIG();
40 void dump(int level); 44 void dump(int level);
45 bool failed() { return (fd == -1); };
46 void read();
47 void process();
41 }; 48 };
42 49
43 struct CONFIG { 50 struct CONFIG {
44 // the only mutable stuff once it has been loaded from the config file 51 // the only mutable stuff once it has been loaded from the config file
45 int reference_count; // protected by the global config_mutex 52 int reference_count; // protected by the global config_mutex
49 string_set config_files; 56 string_set config_files;
50 syslogconfig_list syslogconfigs; // owns all the syslogconfigs, not just top level syslogconfigs 57 syslogconfig_list syslogconfigs; // owns all the syslogconfigs, not just top level syslogconfigs
51 58
52 CONFIG(); 59 CONFIG();
53 ~CONFIG(); 60 ~CONFIG();
54 void add_syslogconfig(SYSLOGCONFIGP con); 61 void add_syslogconfig(SYSLOGCONFIGP con);
55 void dump(); 62 void dump();
63 void read();
56 }; 64 };
57 65
58 void discard(string_set &s); 66 void discard(string_set &s);
59 char* register_string(string_set &s, char *name); 67 char* register_string(string_set &s, char *name);
60 char* register_string(char *name); 68 char* register_string(char *name);