Add a ChangeLog file to list important changes to inoclam.
[inoclam.git] / config.hxx
blob43b138823c21526d50cf40d361202fd55523c0fd
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 for file changes by setting this to cfg_true or cfg_false
83 cfg_bool_t smtp_enabled_file;
85 /**
86 * Enable or disable e-mail notifications when a virus is found by setting this to cfg_true or cfg_false
88 cfg_bool_t smtp_enabled_virus;
90 /**
91 * Watch directory
93 char *watch_dir;
95 /**
96 * The hostname of the SMTP server you wish to use for e-mail notifications
98 char *smtp_host;
101 * The TCP port to connect to for e-mail notifications
103 int smtp_port;
106 * The address to send e-mail notifications to
108 char *smtp_to;
111 * The return address for e-mail notifications
113 char *smtp_from;
116 * The subject line used for e-mail notifications when a virus is found
118 char *smtp_subject_virus;
121 * The subject line used for e-mail notifications when a file is added
123 char *smtp_subject_file;
126 public:
128 * Default Constructor
130 config();
133 * Parses an inoclam.conf configuration file.
135 void parse();
138 * Examines each value of the current configuration.
139 * If a value was not set, it is set to the default.
141 void config_with_defaults();
144 * Checks if the configuration file exists as a regular file.
145 * @return Returns 1 if the file exists and is regular, else 0.
147 int config_file_exists();
150 * Release any resources that hold configuration information.
151 * This function effectively resets all configurable values.
152 * It should be called at the end of the program.
154 void config_free();
157 * TODO: add comments to these functions
160 cfg_bool_t getVirusRemovalEnabled();
161 cfg_bool_t isSMTPEnabledFile();
162 cfg_bool_t isSMTPEnabledVirus();
163 char *getHost();
164 int getPort();
165 char *getTo();
166 char *getFrom();
167 char *getWatchDir();
168 char *getVirusSubject();
169 char *getFileSubject();
172 * TODO: add set functions.
176 * Deconstructor
178 ~config();
180 #endif