summaryrefslogtreecommitdiff
path: root/tools/sepofra.h
blob: 17aa51a52818a0b565d6f6003bbfd49b859db669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <string>
#include <list>
#include <map>
# include <sys/socket.h>   /* inet_ functions / structs */
# include <netinet/in.h>   /* inet_ functions / structs */
# include <arpa/inet.h> /* in_addr struct */

#ifdef __cplusplus
extern "C" {
#  include "spf2/spf.h"
}
#else
#  include "spf2/spf.h"
#endif

#include <string.h>
#include "bad_thing.h"

typedef std::map<std::string,SPF_result_t> MSR;

class sepofra{
public:
  SPF_result_t result;
  std::list<std::string> authorities;
  MSR seen;
  std::string ip;
  std::string mailfrom;
  std::string helo;
  SPF_request_t*   spf_request;
  SPF_response_t* spf_response;

  sepofra()
  : result(SPF_RESULT_INVALID),
    spf_request(NULL),
    spf_response(NULL)
  {}
  void check(
        const std::string opt_ip,
        const std::string opt_helo,
        const std::string opt_mailfrom,
        const std::string opt_rcpt_to,
        const int opt_debug);

  std::string explain() const;
  SPF_result_t check1(
        const std::string host,
        const std::string msg,
        const int debug);
};


void dumpit(const int opt_debug,
         SPF_response_t* spf_response,
         const char* msg);