blob: 59e37377da87ed3e948d42b2743df41632970424 [file] [log] [blame]
Jay Srinivasan1c0fe792013-03-28 16:45:25 -07001// 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-17 21:09:36 -07005#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_CONSTANTS_H_
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_CONSTANTS_H_
Jay Srinivasan1c0fe792013-03-28 16:45:25 -07007
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-09 18:25:12 -070014// Path to the marker file we use to indicate we've recorded a system reboot.
15extern const char kSystemRebootedMarkerFile[];
16
Jay Srinivasan1c0fe792013-03-28 16:45:25 -070017// The contents of the powerwash marker file.
18extern const char kPowerwashCommand[];
19
Chris Sosaaa18e162013-06-20 13:20:30 -070020// 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-09 18:25:12 -070026// Path to the stateful partition on the root filesystem.
27extern const char kStatefulPartition[];
28
Jay Srinivasand29695d2013-04-08 15:08:05 -070029// Constants related to preferences.
30extern const char kPrefsBackoffExpiryTime[];
31extern const char kPrefsCertificateReportToSendDownload[];
32extern const char kPrefsCertificateReportToSendUpdate[];
Jay Srinivasan19409b72013-04-12 19:23:36 -070033extern const char kPrefsCurrentBytesDownloaded[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070034extern const char kPrefsCurrentResponseSignature[];
35extern const char kPrefsCurrentUrlFailureCount[];
36extern const char kPrefsCurrentUrlIndex[];
David Zeuthen985b1122013-10-09 12:13:15 -070037extern const char kPrefsDailyMetricsLastReportedAt[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070038extern const char kPrefsDeltaUpdateFailures[];
Alex Deymo820cc702013-06-28 15:43:46 -070039extern const char kPrefsFullPayloadAttemptNumber[];
David Zeuthen639aa362014-02-03 16:23:44 -080040extern const char kPrefsInstallDateDays[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070041extern const char kPrefsLastActivePingDay[];
42extern const char kPrefsLastRollCallPingDay[];
43extern const char kPrefsManifestMetadataSize[];
David Zeuthen33bae492014-02-25 16:16:18 -080044extern const char kPrefsMetricsAttemptLastReportingTime[];
45extern const char kPrefsMetricsCheckLastReportingTime[];
Chris Sosabe45bef2013-04-09 18:25:12 -070046extern const char kPrefsNumReboots[];
David Zeuthena573d6f2013-06-14 16:13:36 -070047extern const char kPrefsNumResponsesSeen[];
David Zeuthen27a48bc2013-08-06 12:06:29 -070048extern const char kPrefsP2PEnabled[];
David Zeuthen639aa362014-02-03 16:23:44 -080049extern const char kPrefsP2PFirstAttemptTimestamp[];
50extern const char kPrefsP2PNumAttempts[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070051extern const char kPrefsPayloadAttemptNumber[];
52extern const char kPrefsPreviousVersion[];
53extern const char kPrefsResumedUpdateFailures[];
Chris Sosaaa18e162013-06-20 13:20:30 -070054extern const char kPrefsRollbackVersion[];
David Zeuthene4c58bf2013-06-18 17:26:50 -070055extern const char kPrefsSystemUpdatedMarker[];
Alex Deymo42432912013-07-12 20:21:15 -070056extern const char kPrefsTargetVersionAttempt[];
57extern const char kPrefsTargetVersionInstalledFrom[];
58extern const char kPrefsTargetVersionUniqueId[];
Jay Srinivasan19409b72013-04-12 19:23:36 -070059extern const char kPrefsTotalBytesDownloaded[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070060extern const char kPrefsUpdateCheckCount[];
61extern const char kPrefsUpdateCheckResponseHash[];
David Zeuthencc6f9962013-04-18 11:57:24 -070062extern const char kPrefsUpdateDurationUptime[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070063extern const char kPrefsUpdateFirstSeenAt[];
Alex Deymof4867c42013-06-28 14:41:39 -070064extern const char kPrefsUpdateOverCellularPermission[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070065extern const char kPrefsUpdateServerCertificate[];
David Zeuthen41996ad2013-09-24 15:43:24 -070066extern const char kPrefsUpdateStateNextDataLength[];
David Zeuthen639aa362014-02-03 16:23:44 -080067extern const char kPrefsUpdateStateNextDataOffset[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070068extern const char kPrefsUpdateStateNextOperation[];
69extern const char kPrefsUpdateStateSHA256Context[];
70extern const char kPrefsUpdateStateSignatureBlob[];
71extern const char kPrefsUpdateStateSignedSHA256Context[];
David Zeuthen9a017f22013-04-11 16:10:26 -070072extern const char kPrefsUpdateTimestampStart[];
David Zeuthencc6f9962013-04-18 11:57:24 -070073extern const char kPrefsUrlSwitchCount[];
74extern const char kPrefsWallClockWaitPeriod[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070075
Jay Srinivasan19409b72013-04-12 19:23:36 -070076// A download source is any combination of protocol and server (that's of
77// interest to us when looking at UMA metrics) using which we may download
78// the payload.
79typedef enum {
80 kDownloadSourceHttpsServer, // UMA Binary representation: 0001
81 kDownloadSourceHttpServer, // UMA Binary representation: 0010
David Zeuthenbb8bdc72013-09-03 13:43:48 -070082 kDownloadSourceHttpPeer, // UMA Binary representation: 0100
Jay Srinivasan19409b72013-04-12 19:23:36 -070083
84 // Note: Add new sources only above this line.
85 kNumDownloadSources
86} DownloadSource;
87
Alex Deymo1c656c42013-06-28 11:02:14 -070088// A payload can be a Full or Delta payload. In some cases, a Full payload is
89// used even when a Delta payload was available for the update, called here
90// ForcedFull. The PayloadType enum is only used to send UMA metrics about the
91// successfully applied payload.
92typedef enum {
93 kPayloadTypeFull,
94 kPayloadTypeDelta,
95 kPayloadTypeForcedFull,
96
97 // Note: Add new payload types only above this line.
98 kNumPayloadTypes
99} PayloadType;
100
David Zeuthen8f191b22013-08-06 12:27:50 -0700101// Maximum number of times we'll allow using p2p for the same update payload.
David Zeuthendcba8092013-08-06 12:16:35 -0700102const int kMaxP2PAttempts = 10;
103
David Zeuthen8f191b22013-08-06 12:27:50 -0700104// Maximum wallclock time we allow attempting to update using p2p for
David Zeuthen472b2052014-02-25 16:27:04 -0800105// the same update payload - five days.
106const int kMaxP2PAttemptTimeSeconds = 5 * 24 * 60 * 60;
David Zeuthen8f191b22013-08-06 12:27:50 -0700107
108// The maximum amount of time to spend waiting for p2p-client(1) to
109// return while waiting in line to use the LAN - six hours.
110const int kMaxP2PNetworkWaitTimeSeconds = 6 * 60 * 60;
David Zeuthendcba8092013-08-06 12:16:35 -0700111
David Zeuthen526cb582013-08-06 12:26:18 -0700112// The maximum number of payload files to keep in /var/cache/p2p.
113const int kMaxP2PFilesToKeep = 3;
114
Jay Srinivasan19409b72013-04-12 19:23:36 -0700115// The default number of UMA buckets for metrics.
116const int kNumDefaultUmaBuckets = 50;
117
118// General constants
119const int kNumBytesInOneMiB = 1024 * 1024;
120
David Zeuthen34135a92013-08-06 11:16:16 -0700121// Number of redirects allowed when downloading.
122const int kDownloadMaxRedirects = 10;
123
David Zeuthena641be52013-09-12 10:59:57 -0700124// The minimum average speed that downloads must sustain...
David Zeuthen34135a92013-08-06 11:16:16 -0700125//
126// This is set low because some devices may have very poor
127// connecticity and we want to make as much forward progress as
David Zeuthena641be52013-09-12 10:59:57 -0700128// possible. For p2p this is high (25 kB/second) since we can assume
David Zeuthen34135a92013-08-06 11:16:16 -0700129// high bandwidth (same LAN) and we want to fail fast.
130const int kDownloadLowSpeedLimitBps = 1;
David Zeuthena641be52013-09-12 10:59:57 -0700131const int kDownloadP2PLowSpeedLimitBps = 25 * 1000;
David Zeuthen34135a92013-08-06 11:16:16 -0700132
133// ... measured over this period.
134//
135// For non-official builds (e.g. typically built on a developer's
136// workstation and served via devserver) bump this since it takes time
137// for the workstation to generate the payload. For p2p, make this
138// relatively low since we want to fail fast.
139const int kDownloadLowSpeedTimeSeconds = 90;
140const int kDownloadDevModeLowSpeedTimeSeconds = 180;
David Zeuthena641be52013-09-12 10:59:57 -0700141const int kDownloadP2PLowSpeedTimeSeconds = 60;
David Zeuthen34135a92013-08-06 11:16:16 -0700142
143// The maximum amount of HTTP server reconnect attempts.
144//
145// This is set high in order to maximize the attempt's chance of
146// succeeding. When using p2p, this is low in order to fail fast.
147const int kDownloadMaxRetryCount = 20;
148const int kDownloadMaxRetryCountOobeNotComplete = 3;
David Zeuthena641be52013-09-12 10:59:57 -0700149const int kDownloadP2PMaxRetryCount = 5;
David Zeuthen34135a92013-08-06 11:16:16 -0700150
151// The connect timeout, in seconds.
152//
153// This is set high because some devices may have very poor
154// connectivity and we may be using HTTPS which involves complicated
155// multi-roundtrip setup. For p2p, this is set low because we can
156// the server is on the same LAN and we want to fail fast.
157const int kDownloadConnectTimeoutSeconds = 30;
158const int kDownloadP2PConnectTimeoutSeconds = 5;
159
Jay Srinivasan1c0fe792013-03-28 16:45:25 -0700160} // namespace chromeos_update_engine
161
Alex Deymo759c2752014-03-17 21:09:36 -0700162#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_CONSTANTS_H_