]> WPIA git - cassiopeia.git/blob - src/database.h
fix: clean SSL shutdown, reset, allowing deamon operation
[cassiopeia.git] / src / database.h
1 #pragma once
2
3 #include <string>
4 #include <memory>
5 #include <vector>
6
7 struct Job {
8     std::string id;
9     std::string target;
10     std::string task;
11     std::string from;
12     std::string to;
13 };
14
15 struct SAN {
16     std::string content;
17     std::string type;
18 };
19
20 struct AVA {
21     std::string name;
22     std::string value;
23 };
24
25 struct TBSCertificate {
26     std::string md;
27     std::string profile;
28     /**
29      * CSR path
30      */
31     std::string csr;
32     std::string csr_type;
33     std::string csr_content;
34     std::vector<std::shared_ptr<SAN>> SANs;
35     std::vector<std::shared_ptr<AVA>> AVAs;
36 };
37
38
39 struct SignedCertificate {
40     std::string certificate;
41     std::string serial;
42     uint32_t before;
43     uint32_t after;
44     std::string pkHash;
45     std::string certHash;
46     std::string crt_name;
47     std::string log;
48 };
49
50 class JobProvider {
51 public:
52     virtual std::shared_ptr<Job> fetchJob() = 0;
53     virtual bool finishJob( std::shared_ptr<Job> job ) = 0;
54     virtual std::shared_ptr<TBSCertificate> fetchTBSCert( std::shared_ptr<Job> job ) = 0;
55     virtual void writeBack( std::shared_ptr<Job> job, std::shared_ptr<SignedCertificate> res ) = 0;
56 };