• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef LIBBRILLO_BRILLO_IMAGELOADER_MANIFEST_H_
6 #define LIBBRILLO_BRILLO_IMAGELOADER_MANIFEST_H_
7 
8 #include <map>
9 #include <string>
10 #include <vector>
11 
12 #include <base/macros.h>
13 #include <brillo/brillo_export.h>
14 
15 namespace brillo {
16 namespace imageloader {
17 
18 // The supported file systems for images.
19 enum class FileSystem { kExt4, kSquashFS };
20 
21 // A class to parse and store imageloader.json manifest.
22 class BRILLO_EXPORT Manifest {
23  public:
24   Manifest();
25   // Parse the manifest raw string. Return true if successful.
26   bool ParseManifest(const std::string& manifest_raw);
27   // Getters for manifest fields:
28   int manifest_version() const;
29   const std::vector<uint8_t>& image_sha256() const;
30   const std::vector<uint8_t>& table_sha256() const;
31   const std::string& version() const;
32   FileSystem fs_type() const;
33   bool is_removable() const;
34   const std::map<std::string, std::string> metadata() const;
35 
36  private:
37   // Manifest fields:
38   int manifest_version_;
39   std::vector<uint8_t> image_sha256_;
40   std::vector<uint8_t> table_sha256_;
41   std::string version_;
42   FileSystem fs_type_;
43   bool is_removable_;
44   std::map<std::string, std::string> metadata_;
45 
46   DISALLOW_COPY_AND_ASSIGN(Manifest);
47 };
48 
49 }  // namespace imageloader
50 }  // namespace brillo
51 
52 #endif  // LIBBRILLO_BRILLO_IMAGELOADER_MANIFEST_H_
53