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