summaryrefslogtreecommitdiff
path: root/tools/libltgrey.h
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-29 16:50:11 -0700
committerJohn Denker <jsd@av8n.com>2012-07-29 16:50:11 -0700
commitd2564d25e802d1ee3230cf045c4940e836b5c6a2 (patch)
treeddc7c3feac95d01ccb859596c21f218b122060c5 /tools/libltgrey.h
parent92280557b6bdde0b3e1d8fa93ba2fae494d5c355 (diff)
split ltgrey (and libltgrey) off from greylist;
put some utility functions into their own file.
Diffstat (limited to 'tools/libltgrey.h')
-rw-r--r--tools/libltgrey.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/libltgrey.h b/tools/libltgrey.h
new file mode 100644
index 0000000..585ec01
--- /dev/null
+++ b/tools/libltgrey.h
@@ -0,0 +1,38 @@
+#include <string>
+#include <sys/time.h> /* for gettimeofday(), timeval */
+#include <vector>
+
+class whatsit{
+public:
+ std::string dirname;
+ std::string progname;
+ pid_t mypid;
+ timeval now;
+ char* ipvar;
+ char* hostvar;
+ std::string ipbase;
+ std::string ipname;
+ std::string hostname;
+ int mod_age;
+ int ac_age;
+ std::string suffix;
+ std::string progid;
+ int verbosity;
+
+ whatsit(const std::string name, const std::string _dirname)
+ : dirname(_dirname), progname(name), mypid(getpid()),
+ mod_age(0), ac_age(0),
+ verbosity(0)
+ {
+ gettimeofday(&now, NULL);
+ }
+ int doit(const int penalty, const int stain);
+// access comes after modification:
+ void update(const std::string msg, const timeval new_mod,
+ const timeval new_ac, const int penalty, const int stain);
+ int setup();
+ int check_dns();
+ int check_dns_sub(std::string &addr, std::string &host,
+ std::vector<std::string> &checked);
+ void dump(const std::string var);
+};