Aktualizr
C++ SOTA Client
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
update_agent_file.h
1 #ifndef AKTUALIZR_SECONDARY_UPDATE_AGENT_FILE_H
2 #define AKTUALIZR_SECONDARY_UPDATE_AGENT_FILE_H
3 
4 #include "update_agent.h"
5 
6 class FileUpdateAgent : public UpdateAgent {
7  public:
8  FileUpdateAgent(boost::filesystem::path target_filepath, std::string target_name)
9  : target_filepath_{std::move(target_filepath)},
10  new_target_filepath_{target_filepath_.string() + ".newtarget"},
11  current_target_name_{std::move(target_name)} {}
12 
13  public:
14  bool isTargetSupported(const Uptane::Target& target) const override;
15  bool getInstalledImageInfo(Uptane::InstalledImageInfo& installed_image_info) const override;
16 
17  virtual data::InstallationResult receiveData(const Uptane::Target& target, const uint8_t* data, size_t size);
18  data::InstallationResult install(const Uptane::Target& target) override;
19 
20  void completeInstall() override;
21  data::InstallationResult applyPendingInstall(const Uptane::Target& target) override;
22 
23  private:
24  static Hash getTargetHash(const Uptane::Target& target);
25 
26  private:
27  const boost::filesystem::path target_filepath_;
28  const boost::filesystem::path new_target_filepath_;
29  std::string current_target_name_;
30  std::shared_ptr<MultiPartHasher> new_target_hasher_;
31 };
32 
33 #endif // AKTUALIZR_SECONDARY_UPDATE_AGENT_FILE_H
Hash
The Hash class The hash of a file or Uptane metadata.
Definition: types.h:159
UpdateAgent
Definition: update_agent.h:7
data::InstallationResult
Definition: types.h:277
data
General data structures.
Definition: types.h:217
Uptane::InstalledImageInfo
Definition: types.h:306
FileUpdateAgent
Definition: update_agent_file.h:6
Uptane::Target
Definition: types.h:379