Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 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 | |
Gilad Arnold | cf175a0 | 2014-07-10 16:48:47 -0700 | [diff] [blame] | 5 | #ifndef UPDATE_ENGINE_OMAHA_RESPONSE_H_ |
| 6 | #define UPDATE_ENGINE_OMAHA_RESPONSE_H_ |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 7 | |
| 8 | #include <fcntl.h> |
| 9 | #include <sys/stat.h> |
| 10 | #include <sys/types.h> |
| 11 | |
| 12 | #include <string> |
| 13 | #include <vector> |
| 14 | |
| 15 | namespace chromeos_update_engine { |
| 16 | |
| 17 | // This struct encapsulates the data Omaha's response for the request. |
| 18 | // The strings in this struct are not XML escaped. |
| 19 | struct OmahaResponse { |
| 20 | OmahaResponse() |
| 21 | : update_exists(false), |
| 22 | poll_interval(0), |
| 23 | size(0), |
| 24 | metadata_size(0), |
| 25 | max_days_to_scatter(0), |
| 26 | max_failure_count_per_url(0), |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 27 | prompt(false), |
| 28 | is_delta_payload(false), |
David Zeuthen | 8f191b2 | 2013-08-06 12:27:50 -0700 | [diff] [blame] | 29 | disable_payload_backoff(false), |
| 30 | disable_p2p_for_downloading(false), |
David Zeuthen | 639aa36 | 2014-02-03 16:23:44 -0800 | [diff] [blame] | 31 | disable_p2p_for_sharing(false), |
| 32 | install_date_days(-1) {} |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 33 | |
| 34 | // True iff there is an update to be downloaded. |
| 35 | bool update_exists; |
| 36 | |
| 37 | // If non-zero, server-dictated poll interval in seconds. |
| 38 | int poll_interval; |
| 39 | |
| 40 | // These are only valid if update_exists is true: |
Chris Sosa | 3b74843 | 2013-06-20 16:42:59 -0700 | [diff] [blame] | 41 | std::string version; |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 42 | |
| 43 | // The ordered list of URLs in the Omaha response. Each item is a complete |
| 44 | // URL (i.e. in terms of Omaha XML, each value is a urlBase + packageName) |
| 45 | std::vector<std::string> payload_urls; |
| 46 | |
| 47 | std::string more_info_url; |
| 48 | std::string hash; |
| 49 | std::string metadata_signature; |
| 50 | std::string deadline; |
| 51 | off_t size; |
| 52 | off_t metadata_size; |
| 53 | int max_days_to_scatter; |
| 54 | // The number of URL-related failures to tolerate before moving on to the |
| 55 | // next URL in the current pass. This is a configurable value from the |
| 56 | // Omaha Response attribute, if ever we need to fine tune the behavior. |
| 57 | uint32_t max_failure_count_per_url; |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 58 | bool prompt; |
| 59 | |
| 60 | // True if the payload described in this response is a delta payload. |
| 61 | // False if it's a full payload. |
| 62 | bool is_delta_payload; |
| 63 | |
Alex Vakulenko | 072359c | 2014-07-18 11:41:07 -0700 | [diff] [blame] | 64 | // True if the Omaha rule instructs us to disable the back-off logic |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 65 | // on the client altogether. False otherwise. |
| 66 | bool disable_payload_backoff; |
David Zeuthen | 8f191b2 | 2013-08-06 12:27:50 -0700 | [diff] [blame] | 67 | |
| 68 | // True if the Omaha rule instructs us to disable p2p for downloading. |
| 69 | bool disable_p2p_for_downloading; |
| 70 | |
| 71 | // True if the Omaha rule instructs us to disable p2p for sharing. |
| 72 | bool disable_p2p_for_sharing; |
David Zeuthen | e7f8917 | 2013-10-31 10:21:04 -0700 | [diff] [blame] | 73 | |
| 74 | // If not blank, a base-64 encoded representation of the PEM-encoded |
| 75 | // public key in the response. |
| 76 | std::string public_key_rsa; |
David Zeuthen | 639aa36 | 2014-02-03 16:23:44 -0800 | [diff] [blame] | 77 | |
| 78 | // If not -1, the number of days since the epoch Jan 1, 2007 0:00 |
| 79 | // PST, according to the Omaha Server's clock and timezone (PST8PDT, |
| 80 | // aka "Pacific Time".) |
| 81 | int install_date_days; |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 82 | }; |
| 83 | COMPILE_ASSERT(sizeof(off_t) == 8, off_t_not_64bit); |
| 84 | |
| 85 | } // namespace chromeos_update_engine |
| 86 | |
Gilad Arnold | cf175a0 | 2014-07-10 16:48:47 -0700 | [diff] [blame] | 87 | #endif // UPDATE_ENGINE_OMAHA_RESPONSE_H_ |