blob: fc33f25bc65fe99164f223e3284638f6ce6497b2 [file] [log] [blame]
Darin Petkov7ed561b2011-10-04 02:59:03 -07001// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
adlr@google.com3defe6a2009-12-04 20:57:17 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__
7
8#include <string>
Darin Petkov698d0412010-10-13 10:59:44 -07009#include <vector>
10
Jay Srinivasanae4697c2013-03-18 17:08:08 -070011#include <base/basictypes.h>
adlr@google.com3defe6a2009-12-04 20:57:17 +000012
13// InstallPlan is a simple struct that contains relevant info for many
14// parts of the update system about the install that should happen.
adlr@google.com3defe6a2009-12-04 20:57:17 +000015namespace chromeos_update_engine {
16
17struct InstallPlan {
Darin Petkov7ed561b2011-10-04 02:59:03 -070018 InstallPlan(bool is_resume,
adlr@google.com3defe6a2009-12-04 20:57:17 +000019 const std::string& url,
Jay Srinivasan51dcf262012-09-13 17:24:32 -070020 uint64_t payload_size,
21 const std::string& payload_hash,
Jay Srinivasanf4318702012-09-24 11:56:24 -070022 uint64_t metadata_size,
23 const std::string& metadata_signature,
Andrew de los Reyesf9185172010-05-03 11:07:05 -070024 const std::string& install_path,
Jay Srinivasanae4697c2013-03-18 17:08:08 -070025 const std::string& kernel_install_path);
Jay Srinivasan738fdf32012-12-07 17:40:54 -080026
27 // Default constructor: Initialize all members which don't have a class
28 // initializer.
Jay Srinivasanae4697c2013-03-18 17:08:08 -070029 InstallPlan();
30
31 bool operator==(const InstallPlan& that) const;
32 bool operator!=(const InstallPlan& that) const;
33
34 void Dump() const;
adlr@google.com3defe6a2009-12-04 20:57:17 +000035
Darin Petkov0406e402010-10-06 21:33:11 -070036 bool is_resume;
adlr@google.com3defe6a2009-12-04 20:57:17 +000037 std::string download_url; // url to download from
Jay Srinivasan51dcf262012-09-13 17:24:32 -070038
39 uint64_t payload_size; // size of the payload
40 std::string payload_hash ; // SHA256 hash of the payload
Jay Srinivasanf4318702012-09-24 11:56:24 -070041 uint64_t metadata_size; // size of the metadata
42 std::string metadata_signature; // signature of the metadata
Jay Srinivasan51dcf262012-09-13 17:24:32 -070043 std::string install_path; // path to install device
44 std::string kernel_install_path; // path to kernel install device
Darin Petkov3aefa862010-12-07 14:45:00 -080045
46 // The fields below are used for kernel and rootfs verification. The flow is:
47 //
48 // 1. FilesystemCopierAction(verify_hash=false) computes and fills in the
49 // source partition sizes and hashes.
50 //
51 // 2. DownloadAction verifies the source partition sizes and hashes against
52 // the expected values transmitted in the update manifest. It fills in the
53 // expected applied partition sizes and hashes based on the manifest.
54 //
55 // 4. FilesystemCopierAction(verify_hashes=true) computes and verifies the
56 // applied partition sizes and hashes against the expected values.
57 uint64_t kernel_size;
58 uint64_t rootfs_size;
59 std::vector<char> kernel_hash;
60 std::vector<char> rootfs_hash;
adlr@google.com3defe6a2009-12-04 20:57:17 +000061
Jay Srinivasan738fdf32012-12-07 17:40:54 -080062 // True if payload hash checks are mandatory based on the system state and
63 // the Omaha response.
64 bool hash_checks_mandatory;
65
Jay Srinivasanae4697c2013-03-18 17:08:08 -070066 // True if Powerwash is required on reboot after applying the payload.
67 // False otherwise.
68 bool powerwash_required;
adlr@google.com3defe6a2009-12-04 20:57:17 +000069};
70
71} // namespace chromeos_update_engine
72
73#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__