]> WPIA git - cassiopeia.git/blob - src/db/database.h
chg: make cassiopeia conform to db schema version 33
[cassiopeia.git] / src / db / 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 warning;
10     std::string target;
11     std::string task;
12     std::string from;
13     std::string to;
14 };
15
16 struct SAN {
17     std::string content;
18     std::string type;
19 };
20
21 struct AVA {
22     std::string name;
23     std::string value;
24 };
25
26 struct TBSCertificate {
27     std::string md;
28     std::string profile;
29
30     std::string csr_type;
31     std::string csr_content;
32     std::vector<std::shared_ptr<SAN>> SANs;
33     std::vector<std::shared_ptr<AVA>> AVAs;
34
35     std::string wishFrom;
36     std::string wishTo;
37
38     std::string ocspCA;
39 };
40
41 struct SignedCertificate {
42     std::string certificate;
43     std::string serial;
44     std::string before;
45     std::string after;
46     std::string pkHash;
47     std::string certHash;
48     std::string log;
49     std::string ca_name;
50 };
51
52 class JobProvider {
53 public:
54     virtual ~JobProvider() = default;
55     virtual std::shared_ptr<Job> fetchJob() = 0;
56     virtual void finishJob( std::shared_ptr<Job> job ) = 0;
57     virtual void failJob( std::shared_ptr<Job> job ) = 0;
58     virtual std::shared_ptr<TBSCertificate> fetchTBSCert( std::shared_ptr<Job> job ) = 0;
59     virtual void writeBack( std::shared_ptr<Job> job, std::shared_ptr<SignedCertificate> res ) = 0;
60     virtual std::pair<std::string, std::string> getRevocationInfo( std::shared_ptr<Job> job ) = 0;
61     virtual void writeBackRevocation( std::shared_ptr<Job> job, std::string date ) = 0;
62 };