diff src/syslogconfig.h @ 48:ba0259c9e411 stable-1-0-11

Fixes to compile on Fedora 9 and for const correctness
author Carl Byington <carl@five-ten-sg.com>
date Thu, 29 May 2008 11:38:42 -0700
parents 26c29da3fbdf
children 206448c00b55
line wrap: on
line diff
--- a/src/syslogconfig.h	Sat Mar 22 11:34:56 2008 -0700
+++ b/src/syslogconfig.h	Thu May 29 11:38:42 2008 -0700
@@ -17,15 +17,15 @@
 };
 
 class PATTERN {
-	char *			pattern;	// owned by the string table
+    const char *    pattern;    // owned by the string table
 	regex_t 		re;
 	int 			index;		// zero based substring of the regex match that contains the ip address or hostname
 	int 			amount; 	// count to add to the ip address leaky bucket
-	char *			message;	// for logging, owned by the string table
+    const char *    message;    // for logging, owned by the string table
 public:
 	~PATTERN();
-	PATTERN(TOKEN &tok, char *pattern_, int index_, int amount_, char *msg_);
-	bool	process(char *buf, CONFIG &con, char *file_name, int pattern_index);
+    PATTERN(TOKEN &tok, const char *pattern_, int index_, int amount_, const char *msg_);
+    bool    process(char *buf, CONFIG &con, const char *file_name, int pattern_index);
 	void	dump(int level);
 };
 
@@ -38,14 +38,14 @@
 
 class SYSLOGCONFIG {
 	TOKEN * 		tokp;
-	char *			file_name;	// name of the syslog file
+    const char *    file_name;  // name of the syslog file
 	pattern_list	patterns;	// owns the patterns
 	int 			fd;
 	struct stat 	openfdstat;
 	int 			len;		// bytes in the buffer
 	char			buf[buflen];
 public:
-	SYSLOGCONFIG(TOKEN &tok, char *file_name_);
+    SYSLOGCONFIG(TOKEN &tok, const char *file_name_);
 	~SYSLOGCONFIG();
 	bool	failed()	{ return (fd == -1); };
 	void	open(bool msg);
@@ -66,14 +66,14 @@
 	string_set			config_files;
 	int 				threshold;
 	ippair_list 		ignore; 			// owns all the ippairs
-	char *				add_command;		// owned by the string table
-	char *				remove_command; 	// ""
+    const char *        add_command;        // owned by the string table
+    const char *        remove_command;     // ""
 	syslogconfig_list	syslogconfigs;		// owns all the syslogconfigs
 
 	CONFIG();
 	~CONFIG();
-	void	set_add(char *add)				{ add_command	 = add; 	   };
-	void	set_remove(char *remove)		{ remove_command = remove;	   };
+    void    set_add(const char *add)        { add_command    = add;        };
+    void    set_remove(const char *remove)  { remove_command = remove;     };
 	void	set_threshold(int threshold_)	{ threshold 	 = threshold_; };
 	int 	get_threshold() 				{ return threshold; 		   };
 	void	add_syslogconfig(SYSLOGCONFIGP con);
@@ -86,24 +86,24 @@
 };
 
 void discard(string_set &s);
-char* register_string(string_set &s, char *name);
-char* register_string(char *name);
+const char* register_string(string_set &s, const char *name);
+const char* register_string(const char *name);
 void  clear_strings();
-int   ip_address(char *have);
-bool  load_conf(CONFIG &dc, char *fn);
+int         ip_address(const char *have);
+bool        load_conf(CONFIG &dc, const char *fn);
 void  token_init();
 
-extern char *token_add;
-extern char *token_bucket;
-extern char *token_file;
-extern char *token_ignore;
-extern char *token_include;
-extern char *token_index;
-extern char *token_lbrace;
-extern char *token_pattern;
-extern char *token_rbrace;
-extern char *token_remove;
-extern char *token_semi;
-extern char *token_slash;
-extern char *token_threshold;
+extern const char *token_add;
+extern const char *token_bucket;
+extern const char *token_file;
+extern const char *token_ignore;
+extern const char *token_include;
+extern const char *token_index;
+extern const char *token_lbrace;
+extern const char *token_pattern;
+extern const char *token_rbrace;
+extern const char *token_remove;
+extern const char *token_semi;
+extern const char *token_slash;
+extern const char *token_threshold;