-
Notifications
You must be signed in to change notification settings - Fork 3
/
OpenDKIM.hpp
68 lines (53 loc) · 1.28 KB
/
OpenDKIM.hpp
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef OPENDKIM_DOT_HPP
#define OPENDKIM_DOT_HPP
#include <functional>
#include <string>
#include <string_view>
struct dkim_lib;
struct dkim;
namespace OpenDKIM {
class lib {
// no copy
lib(lib const&) = delete;
lib& operator=(lib const&) = delete;
// move
lib(lib&&) = default;
lib& operator=(lib&&) = default;
public:
void header(std::string_view header);
void eoh();
void body(std::string_view body);
void chunk(std::string_view chunk);
void eom();
protected:
lib();
~lib();
dkim_lib* lib_{nullptr};
dkim* dkim_{nullptr};
int status_{0};
};
class sign : public lib {
public:
enum class body_type : bool {
binary,
text,
};
sign(char const* secretkey,
char const* selector,
char const* domain,
body_type typ = body_type::text);
std::string getsighdr();
};
class verify : public lib {
public:
verify();
bool check();
bool sig_syntax(std::string_view sig);
void foreach_sig(std::function<void(char const* domain,
bool passed,
char const* identity,
char const* selector,
char const* b)> func);
};
} // namespace OpenDKIM
#endif // OPENDKIM_DOT_HPP