ip_allow_
[ghsmtp.git] / OpenARC.hpp
blobb4154de97c1f44168ddb3c8dfa77399de57857a2
1 #ifndef OPENARC_DOT_HPP_INCLUDED
2 #define OPENARC_DOT_HPP_INCLUDED
4 #include <cstring>
5 #include <string_view>
6 #include <vector>
8 // Forward to keep from including <openarc/arc.h>
9 struct arc_hdrfield;
10 struct arc_lib;
11 struct arc_msghandle;
13 namespace OpenARC {
15 class lib {
16 // no copy
17 lib(lib const&) = delete;
18 lib& operator=(lib const&) = delete;
20 public:
21 // move
22 lib(lib&&) = default;
23 lib& operator=(lib&&) = default;
25 void get_option(int arg, void* val = nullptr, size_t valsz = 0);
26 void set_option(int arg, void* val = nullptr, size_t valsz = 0);
28 void set_cv_unkn();
29 void set_cv_none();
30 void set_cv_fail();
31 void set_cv_pass();
33 void header(std::string_view header);
34 void eoh();
35 void body(std::string_view body);
36 void chunk(std::string_view chunk);
37 void eom();
39 protected:
40 lib();
41 ~lib();
43 arc_lib* arc_ = nullptr;
44 arc_msghandle* msg_ = nullptr;
47 class sign : public lib {
48 public:
49 sign();
50 ~sign();
52 bool seal(char const* authservid,
53 char const* selector,
54 char const* domain,
55 char const* key,
56 size_t keylen,
57 char const* ar);
59 std::string name() const;
60 std::string value() const;
62 std::vector<std::string> whole_seal() const;
64 private:
65 arc_hdrfield* seal_ = nullptr;
68 class verify : public lib {
69 public:
70 verify();
71 ~verify();
73 char const* chain_status_str() const;
74 std::string chain_custody_str() const;
77 } // namespace OpenARC
79 #endif // OPENARC_DOT_HPP_INCLUDED