blob: 826c5ff9a080a5442e918c08d63d9f18e594f164 [file] [log] [blame]
Jay Srinivasan1c0fe792013-03-28 23:45:251// Copyright (c) 2013 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
Alex Deymo759c2752014-03-18 04:09:365#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_CONSTANTS_H_
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_CONSTANTS_H_
Jay Srinivasan1c0fe792013-03-28 23:45:257
8namespace chromeos_update_engine {
9
10// The name of the marker file used to trigger powerwash when post-install
11// completes successfully so that the device is powerwashed on next reboot.
12extern const char kPowerwashMarkerFile[];
13
Chris Sosabe45bef2013-04-10 01:25:1214// Path to the marker file we use to indicate we've recorded a system reboot.
15extern const char kSystemRebootedMarkerFile[];
16
Jay Srinivasan1c0fe792013-03-28 23:45:2517// The contents of the powerwash marker file.
18extern const char kPowerwashCommand[];
19
Chris Sosaaa18e162013-06-20 20:20:3020// Directory for AU prefs that are preserved across powerwash.
21extern const char kPowerwashSafePrefsDir[];
22
23// The location where we store the AU preferences (state etc).
24extern const char kPrefsDirectory[];
25
Chris Sosabe45bef2013-04-10 01:25:1226// Path to the stateful partition on the root filesystem.
27extern const char kStatefulPartition[];
28
Jay Srinivasand29695d2013-04-08 22:08:0529// Constants related to preferences.
David Zeuthen4e1d1492014-04-25 20:12:2730extern const char kPrefsAttemptInProgress[];
Jay Srinivasand29695d2013-04-08 22:08:0531extern const char kPrefsBackoffExpiryTime[];
32extern const char kPrefsCertificateReportToSendDownload[];
33extern const char kPrefsCertificateReportToSendUpdate[];
Jay Srinivasan19409b72013-04-13 02:23:3634extern const char kPrefsCurrentBytesDownloaded[];
Jay Srinivasand29695d2013-04-08 22:08:0535extern const char kPrefsCurrentResponseSignature[];
36extern const char kPrefsCurrentUrlFailureCount[];
37extern const char kPrefsCurrentUrlIndex[];
David Zeuthen985b1122013-10-09 19:13:1538extern const char kPrefsDailyMetricsLastReportedAt[];
Jay Srinivasand29695d2013-04-08 22:08:0539extern const char kPrefsDeltaUpdateFailures[];
Alex Deymo820cc702013-06-28 22:43:4640extern const char kPrefsFullPayloadAttemptNumber[];
David Zeuthen639aa362014-02-04 00:23:4441extern const char kPrefsInstallDateDays[];
Jay Srinivasand29695d2013-04-08 22:08:0542extern const char kPrefsLastActivePingDay[];
43extern const char kPrefsLastRollCallPingDay[];
44extern const char kPrefsManifestMetadataSize[];
David Zeuthen33bae492014-02-26 00:16:1845extern const char kPrefsMetricsAttemptLastReportingTime[];
46extern const char kPrefsMetricsCheckLastReportingTime[];
Chris Sosabe45bef2013-04-10 01:25:1247extern const char kPrefsNumReboots[];
David Zeuthena573d6f2013-06-14 23:13:3648extern const char kPrefsNumResponsesSeen[];
David Zeuthen27a48bc2013-08-06 19:06:2949extern const char kPrefsP2PEnabled[];
David Zeuthen639aa362014-02-04 00:23:4450extern const char kPrefsP2PFirstAttemptTimestamp[];
51extern const char kPrefsP2PNumAttempts[];
Jay Srinivasand29695d2013-04-08 22:08:0552extern const char kPrefsPayloadAttemptNumber[];
53extern const char kPrefsPreviousVersion[];
54extern const char kPrefsResumedUpdateFailures[];
Chris Sosaaa18e162013-06-20 20:20:3055extern const char kPrefsRollbackVersion[];
David Zeuthene4c58bf2013-06-19 00:26:5056extern const char kPrefsSystemUpdatedMarker[];
Alex Deymo42432912013-07-13 03:21:1557extern const char kPrefsTargetVersionAttempt[];
58extern const char kPrefsTargetVersionInstalledFrom[];
59extern const char kPrefsTargetVersionUniqueId[];
Jay Srinivasan19409b72013-04-13 02:23:3660extern const char kPrefsTotalBytesDownloaded[];
Jay Srinivasand29695d2013-04-08 22:08:0561extern const char kPrefsUpdateCheckCount[];
62extern const char kPrefsUpdateCheckResponseHash[];
David Zeuthencc6f9962013-04-18 18:57:2463extern const char kPrefsUpdateDurationUptime[];
Jay Srinivasand29695d2013-04-08 22:08:0564extern const char kPrefsUpdateFirstSeenAt[];
Alex Deymof4867c42013-06-28 21:41:3965extern const char kPrefsUpdateOverCellularPermission[];
Jay Srinivasand29695d2013-04-08 22:08:0566extern const char kPrefsUpdateServerCertificate[];
David Zeuthen41996ad2013-09-24 22:43:2467extern const char kPrefsUpdateStateNextDataLength[];
David Zeuthen639aa362014-02-04 00:23:4468extern const char kPrefsUpdateStateNextDataOffset[];
Jay Srinivasand29695d2013-04-08 22:08:0569extern const char kPrefsUpdateStateNextOperation[];
70extern const char kPrefsUpdateStateSHA256Context[];
71extern const char kPrefsUpdateStateSignatureBlob[];
72extern const char kPrefsUpdateStateSignedSHA256Context[];
David Zeuthen9a017f22013-04-11 23:10:2673extern const char kPrefsUpdateTimestampStart[];
David Zeuthencc6f9962013-04-18 18:57:2474extern const char kPrefsUrlSwitchCount[];
75extern const char kPrefsWallClockWaitPeriod[];
Jay Srinivasand29695d2013-04-08 22:08:0576
Jay Srinivasan19409b72013-04-13 02:23:3677// A download source is any combination of protocol and server (that's of
78// interest to us when looking at UMA metrics) using which we may download
79// the payload.
80typedef enum {
Alex Vakulenkod2779df2014-06-16 20:19:0081 kDownloadSourceHttpsServer, // UMA Binary representation: 0001
82 kDownloadSourceHttpServer, // UMA Binary representation: 0010
83 kDownloadSourceHttpPeer, // UMA Binary representation: 0100
Jay Srinivasan19409b72013-04-13 02:23:3684
85 // Note: Add new sources only above this line.
86 kNumDownloadSources
87} DownloadSource;
88
Alex Deymo1c656c42013-06-28 18:02:1489// A payload can be a Full or Delta payload. In some cases, a Full payload is
90// used even when a Delta payload was available for the update, called here
91// ForcedFull. The PayloadType enum is only used to send UMA metrics about the
92// successfully applied payload.
93typedef enum {
94 kPayloadTypeFull,
95 kPayloadTypeDelta,
96 kPayloadTypeForcedFull,
97
98 // Note: Add new payload types only above this line.
99 kNumPayloadTypes
100} PayloadType;
101
David Zeuthen8f191b22013-08-06 19:27:50102// Maximum number of times we'll allow using p2p for the same update payload.
David Zeuthendcba8092013-08-06 19:16:35103const int kMaxP2PAttempts = 10;
104
David Zeuthen8f191b22013-08-06 19:27:50105// Maximum wallclock time we allow attempting to update using p2p for
David Zeuthen472b2052014-02-26 00:27:04106// the same update payload - five days.
107const int kMaxP2PAttemptTimeSeconds = 5 * 24 * 60 * 60;
David Zeuthen8f191b22013-08-06 19:27:50108
109// The maximum amount of time to spend waiting for p2p-client(1) to
110// return while waiting in line to use the LAN - six hours.
111const int kMaxP2PNetworkWaitTimeSeconds = 6 * 60 * 60;
David Zeuthendcba8092013-08-06 19:16:35112
David Zeuthen526cb582013-08-06 19:26:18113// The maximum number of payload files to keep in /var/cache/p2p.
114const int kMaxP2PFilesToKeep = 3;
115
Jay Srinivasan19409b72013-04-13 02:23:36116// The default number of UMA buckets for metrics.
117const int kNumDefaultUmaBuckets = 50;
118
Jay Srinivasan19409b72013-04-13 02:23:36119// General constants
120const int kNumBytesInOneMiB = 1024 * 1024;
121
David Zeuthen34135a92013-08-06 18:16:16122// Number of redirects allowed when downloading.
123const int kDownloadMaxRedirects = 10;
124
David Zeuthena641be52013-09-12 17:59:57125// The minimum average speed that downloads must sustain...
David Zeuthen34135a92013-08-06 18:16:16126//
127// This is set low because some devices may have very poor
128// connecticity and we want to make as much forward progress as
David Zeuthena641be52013-09-12 17:59:57129// possible. For p2p this is high (25 kB/second) since we can assume
David Zeuthen34135a92013-08-06 18:16:16130// high bandwidth (same LAN) and we want to fail fast.
131const int kDownloadLowSpeedLimitBps = 1;
David Zeuthena641be52013-09-12 17:59:57132const int kDownloadP2PLowSpeedLimitBps = 25 * 1000;
David Zeuthen34135a92013-08-06 18:16:16133
134// ... measured over this period.
135//
136// For non-official builds (e.g. typically built on a developer's
137// workstation and served via devserver) bump this since it takes time
138// for the workstation to generate the payload. For p2p, make this
139// relatively low since we want to fail fast.
140const int kDownloadLowSpeedTimeSeconds = 90;
141const int kDownloadDevModeLowSpeedTimeSeconds = 180;
David Zeuthena641be52013-09-12 17:59:57142const int kDownloadP2PLowSpeedTimeSeconds = 60;
David Zeuthen34135a92013-08-06 18:16:16143
144// The maximum amount of HTTP server reconnect attempts.
145//
146// This is set high in order to maximize the attempt's chance of
147// succeeding. When using p2p, this is low in order to fail fast.
148const int kDownloadMaxRetryCount = 20;
149const int kDownloadMaxRetryCountOobeNotComplete = 3;
David Zeuthena641be52013-09-12 17:59:57150const int kDownloadP2PMaxRetryCount = 5;
David Zeuthen34135a92013-08-06 18:16:16151
152// The connect timeout, in seconds.
153//
154// This is set high because some devices may have very poor
155// connectivity and we may be using HTTPS which involves complicated
156// multi-roundtrip setup. For p2p, this is set low because we can
157// the server is on the same LAN and we want to fail fast.
158const int kDownloadConnectTimeoutSeconds = 30;
159const int kDownloadP2PConnectTimeoutSeconds = 5;
160
Jay Srinivasan1c0fe792013-03-28 23:45:25161} // namespace chromeos_update_engine
162
Alex Deymo759c2752014-03-18 04:09:36163#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_CONSTANTS_H_