Aktualizr
C++ SOTA Client
fsstorage_read.h
1 #ifndef FSSTORAGE_READ_H_
2 #define FSSTORAGE_READ_H_
3 
4 #include <boost/filesystem.hpp>
5 #include "invstorage.h"
6 
7 class FSStorageRead {
8  public:
9  explicit FSStorageRead(const StorageConfig& config);
10  ~FSStorageRead() = default;
11  bool loadPrimaryKeys(std::string* public_key, std::string* private_key);
12  bool loadPrimaryPublic(std::string* public_key);
13  bool loadPrimaryPrivate(std::string* private_key);
14 
15  bool loadTlsCreds(std::string* ca, std::string* cert, std::string* pkey);
16  bool loadTlsCa(std::string* ca);
17  bool loadTlsCert(std::string* cert);
18  bool loadTlsPkey(std::string* pkey);
19 
20  bool loadRoot(std::string* data, Uptane::RepositoryType repo, Uptane::Version version);
21  bool loadLatestRoot(std::string* data, Uptane::RepositoryType repo) {
22  return loadRoot(data, repo, Uptane::Version());
23  };
24  bool loadNonRoot(std::string* data, Uptane::RepositoryType repo, Uptane::Role role);
25 
26  bool loadDeviceId(std::string* device_id);
27  bool loadEcuSerials(EcuSerials* serials);
28  bool loadMisconfiguredEcus(std::vector<MisconfiguredEcu>* ecus);
29  bool loadEcuRegistered();
30  std::string loadInstalledVersions(std::vector<Uptane::Target>* installed_versions);
31  bool loadInstallationResult(data::OperationResult* result);
32 
33  void cleanUpAll();
34 
35  private:
36  const StorageConfig& config_;
37 
38  Uptane::Version latest_director_root;
39  Uptane::Version latest_images_root;
40 
41  bool loadTlsCommon(std::string* data, const BasedPath& path_in);
42 
43  bool splitNameRoleVersion(const std::string& full_name, std::string* role_name, int* version);
44  Uptane::Version findMaxVersion(const boost::filesystem::path& meta_directory, Uptane::Role role);
45 
46  void clearPrimaryKeys();
47  void clearTlsCreds();
48  void clearNonRootMeta(Uptane::RepositoryType repo);
49  void clearMetadata();
50  void clearDeviceId();
51  void clearEcuSerials();
52  void clearMisconfiguredEcus();
53  void clearEcuRegistered();
54  void clearInstalledVersions();
55  void clearInstallationResult();
56 };
57 
58 #endif // FSSTORAGE_READ_H_
General data structures.
Definition: types.cc:6
Metadata version numbers.
Definition: tuf.h:57
TUF Roles.
Definition: tuf.h:25
RepositoryType
This must match the repo_type table in sqlstorage.
Definition: tuf.h:18