1 //
2 // Copyright (C) 2014 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_PAYLOAD_CONSTANTS_H_
18 #define UPDATE_ENGINE_PAYLOAD_CONSUMER_PAYLOAD_CONSTANTS_H_
19 
20 #include <stdint.h>
21 
22 #include <limits>
23 
24 #include "update_engine/update_metadata.pb.h"
25 
26 namespace chromeos_update_engine {
27 
28 // The major version used by Chrome OS.
29 // extern const uint64_t kChromeOSMajorPayloadVersion;  DEPRECATED
30 
31 // The major version used by Brillo.
32 extern const uint64_t kBrilloMajorPayloadVersion;
33 
34 // The minimum and maximum supported major version.
35 extern const uint64_t kMinSupportedMajorPayloadVersion;
36 extern const uint64_t kMaxSupportedMajorPayloadVersion;
37 
38 // The minor version used for all full payloads.
39 extern const uint32_t kFullPayloadMinorVersion;
40 
41 // The minor version used by the in-place delta generator algorithm.
42 // extern const uint32_t kInPlaceMinorPayloadVersion;  DEPRECATED
43 
44 // The minor version used by the A to B delta generator algorithm.
45 extern const uint32_t kSourceMinorPayloadVersion;
46 
47 // The minor version that allows per-operation source hash.
48 extern const uint32_t kOpSrcHashMinorPayloadVersion;
49 
50 // The minor version that allows BROTLI_BSDIFF, ZERO and DISCARD operation.
51 extern const uint32_t kBrotliBsdiffMinorPayloadVersion;
52 
53 // The minor version that allows PUFFDIFF operation.
54 extern const uint32_t kPuffdiffMinorPayloadVersion;
55 
56 // The minor version that allows Verity hash tree and FEC generation.
57 extern const uint32_t kVerityMinorPayloadVersion;
58 
59 // The minor version that allows partial update, e.g. kernel only update.
60 extern const uint32_t kPartialUpdateMinorPayloadVersion;
61 
62 // The minimum and maximum supported minor version.
63 extern const uint32_t kMinSupportedMinorPayloadVersion;
64 extern const uint32_t kMaxSupportedMinorPayloadVersion;
65 
66 // The maximum size of the payload header (anything before the protobuf).
67 extern const uint64_t kMaxPayloadHeaderSize;
68 
69 // The kernel and rootfs partition names used by the BootControlInterface when
70 // handling update payloads with a major version 1. The names of the updated
71 // partitions are include in the payload itself for major version 2.
72 extern const char kPartitionNameKernel[];
73 extern const char kPartitionNameRoot[];
74 
75 extern const char kBspatchPath[];
76 extern const char kDeltaMagic[4];
77 
78 // A block number denoting a hole on a sparse file. Used on Extents to refer to
79 // section of blocks not present on disk on a sparse file.
80 const uint64_t kSparseHole = std::numeric_limits<uint64_t>::max();
81 
82 // Return the name of the operation type.
83 const char* InstallOperationTypeName(InstallOperation::Type op_type);
84 
85 }  // namespace chromeos_update_engine
86 
87 #endif  // UPDATE_ENGINE_PAYLOAD_CONSUMER_PAYLOAD_CONSTANTS_H_
88