Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: delta_performer.h

Issue 6265001: AU: Add support for signing of update payloads after they're generated. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: rename function Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « delta_diff_generator.cc ('k') | delta_performer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__
7 7
8 #include <inttypes.h> 8 #include <inttypes.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include <google/protobuf/repeated_field.h> 12 #include <google/protobuf/repeated_field.h>
13 #include <gtest/gtest_prod.h> // for FRIEND_TEST 13 #include <gtest/gtest_prod.h> // for FRIEND_TEST
14 14
15 #include "update_engine/file_writer.h" 15 #include "update_engine/file_writer.h"
16 #include "update_engine/omaha_hash_calculator.h" 16 #include "update_engine/omaha_hash_calculator.h"
17 #include "update_engine/update_metadata.pb.h" 17 #include "update_engine/update_metadata.pb.h"
18 18
19 namespace chromeos_update_engine { 19 namespace chromeos_update_engine {
20 20
21 class PrefsInterface; 21 class PrefsInterface;
22 22
23 // This class performs the actions in a delta update synchronously. The delta 23 // This class performs the actions in a delta update synchronously. The delta
24 // update itself should be passed in in chunks as it is received. 24 // update itself should be passed in in chunks as it is received.
25 25
26 class DeltaPerformer : public FileWriter { 26 class DeltaPerformer : public FileWriter {
27 public: 27 public:
28 enum MetadataParseResult {
29 kMetadataParseSuccess,
30 kMetadataParseError,
31 kMetadataParseInsufficientData,
32 };
33
28 DeltaPerformer(PrefsInterface* prefs) 34 DeltaPerformer(PrefsInterface* prefs)
29 : prefs_(prefs), 35 : prefs_(prefs),
30 fd_(-1), 36 fd_(-1),
31 kernel_fd_(-1), 37 kernel_fd_(-1),
32 manifest_valid_(false), 38 manifest_valid_(false),
33 manifest_metadata_size_(0), 39 manifest_metadata_size_(0),
34 next_operation_num_(0), 40 next_operation_num_(0),
35 buffer_offset_(0), 41 buffer_offset_(0),
36 last_updated_buffer_offset_(kuint64max), 42 last_updated_buffer_offset_(kuint64max),
37 block_size_(0) {} 43 block_size_(0) {}
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // persistent preferences and the new update check response hash. 99 // persistent preferences and the new update check response hash.
94 static bool CanResumeUpdate(PrefsInterface* prefs, 100 static bool CanResumeUpdate(PrefsInterface* prefs,
95 std::string update_check_response_hash); 101 std::string update_check_response_hash);
96 102
97 // Resets the persistent update progress state to indicate that an update 103 // Resets the persistent update progress state to indicate that an update
98 // can't be resumed. Performs a quick update-in-progress reset if |quick| is 104 // can't be resumed. Performs a quick update-in-progress reset if |quick| is
99 // true, otherwise resets all progress-related update state. Returns true on 105 // true, otherwise resets all progress-related update state. Returns true on
100 // success, false otherwise. 106 // success, false otherwise.
101 static bool ResetUpdateProgress(PrefsInterface* prefs, bool quick); 107 static bool ResetUpdateProgress(PrefsInterface* prefs, bool quick);
102 108
109 // Attempts to parse the update metadata starting from the beginning of
110 // |payload| into |manifest|. On success, sets |metadata_size| to the total
111 // metadata bytes (including the delta magic and metadata size fields), and
112 // returns kMetadataParseSuccess. Returns kMetadataParseInsufficientData if
113 // more data is needed to parse the complete metadata. Returns
114 // kMetadataParseError if the metadata can't be parsed given the payload.
115 static MetadataParseResult ParsePayloadMetadata(
116 const std::vector<char>& payload,
117 DeltaArchiveManifest* manifest,
118 uint64_t* metadata_size);
119
103 void set_current_kernel_hash(const std::vector<char>& hash) { 120 void set_current_kernel_hash(const std::vector<char>& hash) {
104 current_kernel_hash_ = hash; 121 current_kernel_hash_ = hash;
105 } 122 }
106 123
107 void set_current_rootfs_hash(const std::vector<char>& hash) { 124 void set_current_rootfs_hash(const std::vector<char>& hash) {
108 current_rootfs_hash_ = hash; 125 current_rootfs_hash_ = hash;
109 } 126 }
110 127
111 private: 128 private:
112 friend class DeltaPerformerTest; 129 friend class DeltaPerformerTest;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // verification. 222 // verification.
206 std::vector<char> current_kernel_hash_; 223 std::vector<char> current_kernel_hash_;
207 std::vector<char> current_rootfs_hash_; 224 std::vector<char> current_rootfs_hash_;
208 225
209 DISALLOW_COPY_AND_ASSIGN(DeltaPerformer); 226 DISALLOW_COPY_AND_ASSIGN(DeltaPerformer);
210 }; 227 };
211 228
212 } // namespace chromeos_update_engine 229 } // namespace chromeos_update_engine
213 230
214 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ 231 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__
OLDNEW
« no previous file with comments | « delta_diff_generator.cc ('k') | delta_performer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698