Aktualizr
C++ SOTA Client
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
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 Uptane::Hash &hash, uint64_t length,
13  const std::string &hardware_id, const std::string &url, const Delegation &delegation,
14  const Json::Value &custom = {});
15  void addDelegation(const Uptane::Role &name, const Uptane::Role &parent_role, const std::string &path,
16  bool terminating, KeyType key_type);
17  void revokeDelegation(const Uptane::Role &name);
18  std::vector<std::string> getDelegationTargets(const Uptane::Role &name);
19 
20  // note: it used to be "repo/image" which is way less confusing but we've just
21  // given up and adopted what the backend does
22  static constexpr const char *dir{"repo/repo"};
23 
24  private:
25  void addImage(const std::string &name, Json::Value &target, const std::string &hardware_id,
26  const Delegation &delegation = {});
27  void removeDelegationRecursive(const Uptane::Role &name, const Uptane::Role &parent_name);
28 };
29 
30 #endif // IMAGE_REPO_H_
Uptane::Hash
The hash of a file or TUF metadata.
Definition: tuf.h:209
Repo
Definition: repo.h:34
Uptane::Role
TUF Roles.
Definition: tuf.h:57
Delegation
Definition: repo.h:19
ImageRepo
Definition: image_repo.h:6