Jay Srinivasan | 1c0fe79 | 2013-03-28 16:45:25 -0700 | [diff] [blame] | 1 | // 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 | |
| 8 | namespace 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. |
| 12 | extern const char kPowerwashMarkerFile[]; |
| 13 | |
Chris Sosa | be45bef | 2013-04-09 18:25:12 -0700 | [diff] [blame] | 14 | // Path to the marker file we use to indicate we've recorded a system reboot. |
| 15 | extern const char kSystemRebootedMarkerFile[]; |
| 16 | |
Jay Srinivasan | 1c0fe79 | 2013-03-28 16:45:25 -0700 | [diff] [blame] | 17 | // The contents of the powerwash marker file. |
| 18 | extern const char kPowerwashCommand[]; |
| 19 | |
Chris Sosa | aa18e16 | 2013-06-20 13:20:30 -0700 | [diff] [blame] | 20 | // Directory for AU prefs that are preserved across powerwash. |
| 21 | extern const char kPowerwashSafePrefsDir[]; |
| 22 | |
| 23 | // The location where we store the AU preferences (state etc). |
| 24 | extern const char kPrefsDirectory[]; |
| 25 | |
Chris Sosa | be45bef | 2013-04-09 18:25:12 -0700 | [diff] [blame] | 26 | // Path to the stateful partition on the root filesystem. |
| 27 | extern const char kStatefulPartition[]; |
| 28 | |
Jay Srinivasan | d29695d | 2013-04-08 15:08:05 -0700 | [diff] [blame] | 29 | // Constants related to preferences. |
| 30 | extern const char kPrefsBackoffExpiryTime[]; |
| 31 | extern const char kPrefsCertificateReportToSendDownload[]; |
| 32 | extern const char kPrefsCertificateReportToSendUpdate[]; |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 33 | extern const char kPrefsCurrentBytesDownloaded[]; |
Jay Srinivasan | d29695d | 2013-04-08 15:08:05 -0700 | [diff] [blame] | 34 | extern const char kPrefsCurrentResponseSignature[]; |
| 35 | extern const char kPrefsCurrentUrlFailureCount[]; |
| 36 | extern const char kPrefsCurrentUrlIndex[]; |
| 37 | extern const char kPrefsDeltaUpdateFailures[]; |
Alex Deymo | 820cc70 | 2013-06-28 15:43:46 -0700 | [diff] [blame] | 38 | extern const char kPrefsFullPayloadAttemptNumber[]; |
Jay Srinivasan | d29695d | 2013-04-08 15:08:05 -0700 | [diff] [blame] | 39 | extern const char kPrefsLastActivePingDay[]; |
| 40 | extern const char kPrefsLastRollCallPingDay[]; |
| 41 | extern const char kPrefsManifestMetadataSize[]; |
Chris Sosa | be45bef | 2013-04-09 18:25:12 -0700 | [diff] [blame] | 42 | extern const char kPrefsNumReboots[]; |
David Zeuthen | a573d6f | 2013-06-14 16:13:36 -0700 | [diff] [blame] | 43 | extern const char kPrefsNumResponsesSeen[]; |
David Zeuthen | 27a48bc | 2013-08-06 12:06:29 -0700 | [diff] [blame] | 44 | extern const char kPrefsP2PEnabled[]; |
Jay Srinivasan | d29695d | 2013-04-08 15:08:05 -0700 | [diff] [blame] | 45 | extern const char kPrefsPayloadAttemptNumber[]; |
| 46 | extern const char kPrefsPreviousVersion[]; |
| 47 | extern const char kPrefsResumedUpdateFailures[]; |
Chris Sosa | aa18e16 | 2013-06-20 13:20:30 -0700 | [diff] [blame] | 48 | extern const char kPrefsRollbackVersion[]; |
David Zeuthen | e4c58bf | 2013-06-18 17:26:50 -0700 | [diff] [blame] | 49 | extern const char kPrefsSystemUpdatedMarker[]; |
Alex Deymo | 4243291 | 2013-07-12 20:21:15 -0700 | [diff] [blame] | 50 | extern const char kPrefsTargetVersionAttempt[]; |
| 51 | extern const char kPrefsTargetVersionInstalledFrom[]; |
| 52 | extern const char kPrefsTargetVersionUniqueId[]; |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 53 | extern const char kPrefsTotalBytesDownloaded[]; |
Jay Srinivasan | d29695d | 2013-04-08 15:08:05 -0700 | [diff] [blame] | 54 | extern const char kPrefsUpdateCheckCount[]; |
| 55 | extern const char kPrefsUpdateCheckResponseHash[]; |
David Zeuthen | cc6f996 | 2013-04-18 11:57:24 -0700 | [diff] [blame] | 56 | extern const char kPrefsUpdateDurationUptime[]; |
Jay Srinivasan | d29695d | 2013-04-08 15:08:05 -0700 | [diff] [blame] | 57 | extern const char kPrefsUpdateFirstSeenAt[]; |
Alex Deymo | f4867c4 | 2013-06-28 14:41:39 -0700 | [diff] [blame] | 58 | extern const char kPrefsUpdateOverCellularPermission[]; |
Jay Srinivasan | d29695d | 2013-04-08 15:08:05 -0700 | [diff] [blame] | 59 | extern const char kPrefsUpdateServerCertificate[]; |
| 60 | extern const char kPrefsUpdateStateNextDataOffset[]; |
| 61 | extern const char kPrefsUpdateStateNextOperation[]; |
| 62 | extern const char kPrefsUpdateStateSHA256Context[]; |
| 63 | extern const char kPrefsUpdateStateSignatureBlob[]; |
| 64 | extern const char kPrefsUpdateStateSignedSHA256Context[]; |
David Zeuthen | 9a017f2 | 2013-04-11 16:10:26 -0700 | [diff] [blame] | 65 | extern const char kPrefsUpdateTimestampStart[]; |
David Zeuthen | cc6f996 | 2013-04-18 11:57:24 -0700 | [diff] [blame] | 66 | extern const char kPrefsUrlSwitchCount[]; |
| 67 | extern const char kPrefsWallClockWaitPeriod[]; |
David Zeuthen | dcba809 | 2013-08-06 12:16:35 -0700 | [diff] [blame] | 68 | extern const char kPrefsP2PNumAttempts[]; |
| 69 | extern const char kPrefsP2PFirstAttemptTimestamp[]; |
Jay Srinivasan | d29695d | 2013-04-08 15:08:05 -0700 | [diff] [blame] | 70 | |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 71 | // A download source is any combination of protocol and server (that's of |
| 72 | // interest to us when looking at UMA metrics) using which we may download |
| 73 | // the payload. |
| 74 | typedef enum { |
| 75 | kDownloadSourceHttpsServer, // UMA Binary representation: 0001 |
| 76 | kDownloadSourceHttpServer, // UMA Binary representation: 0010 |
David Zeuthen | bb8bdc7 | 2013-09-03 13:43:48 -0700 | [diff] [blame] | 77 | kDownloadSourceHttpPeer, // UMA Binary representation: 0100 |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 78 | |
| 79 | // Note: Add new sources only above this line. |
| 80 | kNumDownloadSources |
| 81 | } DownloadSource; |
| 82 | |
Alex Deymo | 1c656c4 | 2013-06-28 11:02:14 -0700 | [diff] [blame] | 83 | // A payload can be a Full or Delta payload. In some cases, a Full payload is |
| 84 | // used even when a Delta payload was available for the update, called here |
| 85 | // ForcedFull. The PayloadType enum is only used to send UMA metrics about the |
| 86 | // successfully applied payload. |
| 87 | typedef enum { |
| 88 | kPayloadTypeFull, |
| 89 | kPayloadTypeDelta, |
| 90 | kPayloadTypeForcedFull, |
| 91 | |
| 92 | // Note: Add new payload types only above this line. |
| 93 | kNumPayloadTypes |
| 94 | } PayloadType; |
| 95 | |
David Zeuthen | 8f191b2 | 2013-08-06 12:27:50 -0700 | [diff] [blame] | 96 | // Maximum number of times we'll allow using p2p for the same update payload. |
David Zeuthen | dcba809 | 2013-08-06 12:16:35 -0700 | [diff] [blame] | 97 | const int kMaxP2PAttempts = 10; |
| 98 | |
David Zeuthen | 8f191b2 | 2013-08-06 12:27:50 -0700 | [diff] [blame] | 99 | // Maximum wallclock time we allow attempting to update using p2p for |
| 100 | // the same update payload - two days. |
| 101 | const int kMaxP2PAttemptTimeSeconds = 2 * 24 * 60 * 60; |
| 102 | |
| 103 | // The maximum amount of time to spend waiting for p2p-client(1) to |
| 104 | // return while waiting in line to use the LAN - six hours. |
| 105 | const int kMaxP2PNetworkWaitTimeSeconds = 6 * 60 * 60; |
David Zeuthen | dcba809 | 2013-08-06 12:16:35 -0700 | [diff] [blame] | 106 | |
David Zeuthen | 526cb58 | 2013-08-06 12:26:18 -0700 | [diff] [blame] | 107 | // The maximum number of payload files to keep in /var/cache/p2p. |
| 108 | const int kMaxP2PFilesToKeep = 3; |
| 109 | |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 110 | // The default number of UMA buckets for metrics. |
| 111 | const int kNumDefaultUmaBuckets = 50; |
| 112 | |
| 113 | // General constants |
| 114 | const int kNumBytesInOneMiB = 1024 * 1024; |
| 115 | |
David Zeuthen | 34135a9 | 2013-08-06 11:16:16 -0700 | [diff] [blame] | 116 | // Number of redirects allowed when downloading. |
| 117 | const int kDownloadMaxRedirects = 10; |
| 118 | |
| 119 | // The minimum average speed (50 kB/sec) that downloads must sustain... |
| 120 | // |
| 121 | // This is set low because some devices may have very poor |
| 122 | // connecticity and we want to make as much forward progress as |
| 123 | // possible. For p2p this is high (50 kB/second) since we can assume |
| 124 | // high bandwidth (same LAN) and we want to fail fast. |
| 125 | const int kDownloadLowSpeedLimitBps = 1; |
| 126 | const int kDownloadP2PLowSpeedLimitBps = 50 * 1000; |
| 127 | |
| 128 | // ... measured over this period. |
| 129 | // |
| 130 | // For non-official builds (e.g. typically built on a developer's |
| 131 | // workstation and served via devserver) bump this since it takes time |
| 132 | // for the workstation to generate the payload. For p2p, make this |
| 133 | // relatively low since we want to fail fast. |
| 134 | const int kDownloadLowSpeedTimeSeconds = 90; |
| 135 | const int kDownloadDevModeLowSpeedTimeSeconds = 180; |
| 136 | const int kDownloadP2PLowSpeedTimeSeconds = 30; |
| 137 | |
| 138 | // The maximum amount of HTTP server reconnect attempts. |
| 139 | // |
| 140 | // This is set high in order to maximize the attempt's chance of |
| 141 | // succeeding. When using p2p, this is low in order to fail fast. |
| 142 | const int kDownloadMaxRetryCount = 20; |
| 143 | const int kDownloadMaxRetryCountOobeNotComplete = 3; |
| 144 | const int kDownloadP2PMaxRetryCount = 3; |
| 145 | |
| 146 | // The connect timeout, in seconds. |
| 147 | // |
| 148 | // This is set high because some devices may have very poor |
| 149 | // connectivity and we may be using HTTPS which involves complicated |
| 150 | // multi-roundtrip setup. For p2p, this is set low because we can |
| 151 | // the server is on the same LAN and we want to fail fast. |
| 152 | const int kDownloadConnectTimeoutSeconds = 30; |
| 153 | const int kDownloadP2PConnectTimeoutSeconds = 5; |
| 154 | |
Jay Srinivasan | 1c0fe79 | 2013-03-28 16:45:25 -0700 | [diff] [blame] | 155 | } // namespace chromeos_update_engine |
| 156 | |
| 157 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_CONSTANTS_H |