Merge changes submitted by Matt Gagne <matt.gagne@state.vt.us>
[inoclam.git] / config.hxx
blob6411b41379de0ecd6d8a599dd6ccde6a1ad847e6
1 /*
2 * inoclam - Inotify+ClamAV virus scanner
3 * Copyright (C) 2007 Vermont Department of Taxes
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.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * Contributor(s):
20 * Tom Cort <tom.cort@state.vt.us>
21 * Matt Gagne <matt.gagne@state.vt.us>
24 #ifndef __CONFIG_HXX
25 #define __CONFIG_HXX
27 #include <confuse.h>
29 /**
30 * The default configuration file location.
32 #define DEFAULT_CONFIGFILE "/etc/inoclam.conf"
34 /**
35 * The default address to send e-mail notifications to
37 #define SMTP_TO "root@localhost"
39 /**
40 * The default return address for e-mail notifications
42 #define SMTP_FROM "root@localhost"
44 /**
45 * The default subject line used for e-mail notifications
47 #define SMTP_SUBJECT_VIRUS "[inoclam] Virus Detected"
49 /**
50 * The default subject line used for e-mail notifications
52 #define SMTP_SUBJECT_FILE "[inoclam] File Update"
54 /**
55 * The default hostname of the SMTP server you wish to use for e-mail notifications
57 #define SMTP_HOST "localhost"
59 /**
60 * The default TCP port to connect to for e-mail notifications
62 #define SMTP_PORT (25)
64 /**
65 * The default value for watch_dir
67 #define WATCH_DIR "/tmp"
69 /**
70 * Container for program configuration information.
72 class config {
74 private:
75 /**
76 * A boolean used to decide if viruses should be automatically removed when they are detected.
78 cfg_bool_t virus_removal_enabled;
80 /**
81 * Enable or disable e-mail notifications by setting this to cfg_true or cfg_false
83 cfg_bool_t smtp_enabled;
85 /**
86 * Watch directory
88 char *watch_dir;
90 /**
91 * The hostname of the SMTP server you wish to use for e-mail notifications
93 char *smtp_host;
95 /**
96 * The TCP port to connect to for e-mail notifications
98 int smtp_port;
101 * The address to send e-mail notifications to
103 char *smtp_to;
106 * The return address for e-mail notifications
108 char *smtp_from;
111 * The subject line used for e-mail notifications when a virus is found
113 char *smtp_subject_virus;
116 * The subject line used for e-mail notifications when a file is added
118 char *smtp_subject_file;
121 public:
123 * Default Constructor
125 config();
128 * Parses an inoclam.conf configuration file.
130 void parse();
133 * Examines each value of the current configuration.
134 * If a value was not set, it is set to the default.
136 void config_with_defaults();
139 * Checks if the configuration file exists as a regular file.
140 * @return Returns 1 if the file exists and is regular, else 0.
142 int config_file_exists();
145 * Release any resources that hold configuration information.
146 * This function effectively resets all configurable values.
147 * It should be called at the end of the program.
149 void config_free();
152 * TODO: add comments to these functions
155 cfg_bool_t getVirusRemovalEnabled();
156 cfg_bool_t getSMTPEnabled();
157 char *getHost();
158 int getPort();
159 char *getTo();
160 char *getFrom();
161 char *getWatchDir();
162 char *getVirusSubject();
163 char *getFileSubject();
166 * TODO: add set functions.
170 * TODO: Deconstructor
171 * then fix in inoclam.cxx
174 #endif