summaryrefslogtreecommitdiff
path: root/tools/libskrewt.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libskrewt.h')
-rw-r--r--tools/libskrewt.h39
1 files changed, 27 insertions, 12 deletions
diff --git a/tools/libskrewt.h b/tools/libskrewt.h
index 34cdfd3..2360b15 100644
--- a/tools/libskrewt.h
+++ b/tools/libskrewt.h
@@ -5,6 +5,28 @@
#include "qq_exit_codes.h" // a bit of a kludge
extern std::string progid;
+#define test_state_macro \
+foo(untested) \
+foo(pass) \
+foo(neutral) \
+foo(fail)
+
+// expand the codes to make some <const int> names:
+#define foo(name) name,
+typedef enum {
+ test_state_macro
+} test_state;
+#undef foo
+
+class name_tester {
+public:
+ std::string name; // typically a FQDN
+ test_state spf;
+ test_state map2ip;
+ name_tester() : name(""), spf(untested), map2ip(untested)
+ {}
+};
+
class xstr {
public:
int err;
@@ -16,12 +38,12 @@ public:
class skrewt{
public:
std::string received_from; // envelope HELO among other things
- std::string proximta_HELO;
- std::string proximta_rDNS;
+ name_tester proximta_HELO;
+ name_tester proximta_rDNS;
std::string proximta_IP;
std::string proximta_AuthUser;
SPF_result_t spf_result;
- std::string return_path; // envelope MAIL FROM
+ name_tester return_path; // envelope MAIL FROM
std::string boundary;
std::string to;
std::string from;
@@ -39,16 +61,9 @@ public:
std::vector<std::string> headerbuf;
std::vector<std::string> bigbuf;
xstr lookahead;
+ std::map<test_state,std::string> decode_test_state;
- // constructor
- skrewt()
- : spf_result(SPF_RESULT_INVALID),
- boundary("x-xx-x"), msgsize(0), saw_blank_line(0), recno(0),
- maxsize(1000*1000), error_exit(0), mid_required(0),
- headerbuf(0), bigbuf(0),
- lookahead(1, "")
- {}
-
+ skrewt(); // constructor
xstr getRecord(std::istream& xin);
xstr getLine(std::istream& xin);
int headers(std::istream& xin);