Aktualizr
C++ SOTA Client
image_repo.h
1 #ifndef IMAGE_REPO_H_
2 #define IMAGE_REPO_H_
3 
4 #include "repo.h"
5 
6 class ImageRepo : public Repo {
7  public:
8  ImageRepo(boost::filesystem::path path, const std::string &expires, std::string correlation_id)
9  : Repo(Uptane::RepositoryType::Image(), std::move(path), expires, std::move(correlation_id)) {}
10  void addBinaryImage(const boost::filesystem::path &image_path, const boost::filesystem::path &targetname,
11  const std::string &hardware_id, const std::string &url, const Delegation &delegation = {});
12  void addCustomImage(const std::string &name, const Hash &hash, uint64_t length, const std::string &hardware_id,
13  const std::string &url, const Delegation &delegation, const Json::Value &custom = {});
14  void addDelegation(const Uptane::Role &name, const Uptane::Role &parent_role, const std::string &path,
15  bool terminating, KeyType key_type);
16  void revokeDelegation(const Uptane::Role &name);
17  std::vector<std::string> getDelegationTargets(const Uptane::Role &name);
18 
19  // note: it used to be "repo/image" which is way less confusing but we've just
20  // given up and adopted what the backend does
21  static constexpr const char *dir{"repo/repo"};
22 
23  private:
24  void addImage(const std::string &name, Json::Value &target, const std::string &hardware_id,
25  const Delegation &delegation = {});
26  void removeDelegationRecursive(const Uptane::Role &name, const Uptane::Role &parent_name);
27 };
28 
29 #endif // IMAGE_REPO_H_
Hash
The Hash class The hash of a file or Uptane metadata.
Definition: types.h:159
Repo
Definition: repo.h:34
Uptane::Role
TUF Roles.
Definition: tuf.h:61
Delegation
Definition: repo.h:19
ImageRepo
Definition: image_repo.h:6