blob: 5b0ba8c3eec115ced706346f661174c1d949a616 [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
5#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_CONSTANTS_H
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_CONSTANTS_H
7
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
David Zeuthen8f191b22013-08-06 12:27:50 -070029// Path to the marker file to allow p2p on interactive update attempts.
30// See utils::IsP2PAllowedForInteractiveChecks().
31extern const char kP2PAllowInteractiveMarkerFile[];
32
Jay Srinivasand29695d2013-04-08 15:08:05 -070033// Constants related to preferences.
34extern const char kPrefsBackoffExpiryTime[];
35extern const char kPrefsCertificateReportToSendDownload[];
36extern const char kPrefsCertificateReportToSendUpdate[];
Jay Srinivasan19409b72013-04-12 19:23:36 -070037extern const char kPrefsCurrentBytesDownloaded[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070038extern const char kPrefsCurrentResponseSignature[];
39extern const char kPrefsCurrentUrlFailureCount[];
40extern const char kPrefsCurrentUrlIndex[];
41extern const char kPrefsDeltaUpdateFailures[];
Alex Deymo820cc702013-06-28 15:43:46 -070042extern const char kPrefsFullPayloadAttemptNumber[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070043extern const char kPrefsLastActivePingDay[];
44extern const char kPrefsLastRollCallPingDay[];
45extern const char kPrefsManifestMetadataSize[];
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[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070049extern const char kPrefsPayloadAttemptNumber[];
50extern const char kPrefsPreviousVersion[];
51extern const char kPrefsResumedUpdateFailures[];
Chris Sosaaa18e162013-06-20 13:20:30 -070052extern const char kPrefsRollbackVersion[];
David Zeuthene4c58bf2013-06-18 17:26:50 -070053extern const char kPrefsSystemUpdatedMarker[];
Alex Deymo42432912013-07-12 20:21:15 -070054extern const char kPrefsTargetVersionAttempt[];
55extern const char kPrefsTargetVersionInstalledFrom[];
56extern const char kPrefsTargetVersionUniqueId[];
Jay Srinivasan19409b72013-04-12 19:23:36 -070057extern const char kPrefsTotalBytesDownloaded[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070058extern const char kPrefsUpdateCheckCount[];
59extern const char kPrefsUpdateCheckResponseHash[];
David Zeuthencc6f9962013-04-18 11:57:24 -070060extern const char kPrefsUpdateDurationUptime[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070061extern const char kPrefsUpdateFirstSeenAt[];
Alex Deymof4867c42013-06-28 14:41:39 -070062extern const char kPrefsUpdateOverCellularPermission[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070063extern const char kPrefsUpdateServerCertificate[];
64extern const char kPrefsUpdateStateNextDataOffset[];
65extern const char kPrefsUpdateStateNextOperation[];
66extern const char kPrefsUpdateStateSHA256Context[];
67extern const char kPrefsUpdateStateSignatureBlob[];
68extern const char kPrefsUpdateStateSignedSHA256Context[];
David Zeuthen9a017f22013-04-11 16:10:26 -070069extern const char kPrefsUpdateTimestampStart[];
David Zeuthencc6f9962013-04-18 11:57:24 -070070extern const char kPrefsUrlSwitchCount[];
71extern const char kPrefsWallClockWaitPeriod[];
David Zeuthendcba8092013-08-06 12:16:35 -070072extern const char kPrefsP2PNumAttempts[];
73extern const char kPrefsP2PFirstAttemptTimestamp[];
Jay Srinivasand29695d2013-04-08 15:08:05 -070074
Jay Srinivasan19409b72013-04-12 19:23:36 -070075// A download source is any combination of protocol and server (that's of
76// interest to us when looking at UMA metrics) using which we may download
77// the payload.
78typedef enum {
79 kDownloadSourceHttpsServer, // UMA Binary representation: 0001
80 kDownloadSourceHttpServer, // UMA Binary representation: 0010
81
82 // Note: Add new sources only above this line.
83 kNumDownloadSources
84} DownloadSource;
85
Alex Deymo1c656c42013-06-28 11:02:14 -070086// A payload can be a Full or Delta payload. In some cases, a Full payload is
87// used even when a Delta payload was available for the update, called here
88// ForcedFull. The PayloadType enum is only used to send UMA metrics about the
89// successfully applied payload.
90typedef enum {
91 kPayloadTypeFull,
92 kPayloadTypeDelta,
93 kPayloadTypeForcedFull,
94
95 // Note: Add new payload types only above this line.
96 kNumPayloadTypes
97} PayloadType;
98
David Zeuthen8f191b22013-08-06 12:27:50 -070099// Maximum number of times we'll allow using p2p for the same update payload.
David Zeuthendcba8092013-08-06 12:16:35 -0700100const int kMaxP2PAttempts = 10;
101
David Zeuthen8f191b22013-08-06 12:27:50 -0700102// Maximum wallclock time we allow attempting to update using p2p for
103// the same update payload - two days.
104const int kMaxP2PAttemptTimeSeconds = 2 * 24 * 60 * 60;
105
106// The maximum amount of time to spend waiting for p2p-client(1) to
107// return while waiting in line to use the LAN - six hours.
108const int kMaxP2PNetworkWaitTimeSeconds = 6 * 60 * 60;
David Zeuthendcba8092013-08-06 12:16:35 -0700109
David Zeuthen526cb582013-08-06 12:26:18 -0700110// The maximum number of payload files to keep in /var/cache/p2p.
111const int kMaxP2PFilesToKeep = 3;
112
Jay Srinivasan19409b72013-04-12 19:23:36 -0700113// The default number of UMA buckets for metrics.
114const int kNumDefaultUmaBuckets = 50;
115
116// General constants
117const int kNumBytesInOneMiB = 1024 * 1024;
118
David Zeuthen34135a92013-08-06 11:16:16 -0700119// Number of redirects allowed when downloading.
120const int kDownloadMaxRedirects = 10;
121
122// The minimum average speed (50 kB/sec) that downloads must sustain...
123//
124// This is set low because some devices may have very poor
125// connecticity and we want to make as much forward progress as
126// possible. For p2p this is high (50 kB/second) since we can assume
127// high bandwidth (same LAN) and we want to fail fast.
128const int kDownloadLowSpeedLimitBps = 1;
129const int kDownloadP2PLowSpeedLimitBps = 50 * 1000;
130
131// ... measured over this period.
132//
133// For non-official builds (e.g. typically built on a developer's
134// workstation and served via devserver) bump this since it takes time
135// for the workstation to generate the payload. For p2p, make this
136// relatively low since we want to fail fast.
137const int kDownloadLowSpeedTimeSeconds = 90;
138const int kDownloadDevModeLowSpeedTimeSeconds = 180;
139const int kDownloadP2PLowSpeedTimeSeconds = 30;
140
141// The maximum amount of HTTP server reconnect attempts.
142//
143// This is set high in order to maximize the attempt's chance of
144// succeeding. When using p2p, this is low in order to fail fast.
145const int kDownloadMaxRetryCount = 20;
146const int kDownloadMaxRetryCountOobeNotComplete = 3;
147const int kDownloadP2PMaxRetryCount = 3;
148
149// The connect timeout, in seconds.
150//
151// This is set high because some devices may have very poor
152// connectivity and we may be using HTTPS which involves complicated
153// multi-roundtrip setup. For p2p, this is set low because we can
154// the server is on the same LAN and we want to fail fast.
155const int kDownloadConnectTimeoutSeconds = 30;
156const int kDownloadP2PConnectTimeoutSeconds = 5;
157
Jay Srinivasan1c0fe792013-03-28 16:45:25 -0700158} // namespace chromeos_update_engine
159
160#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_CONSTANTS_H