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 | |
| 5 | #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_H |
| 6 | #define CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_H |
| 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), |
| 31 | disable_p2p_for_sharing(false) {} |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 32 | |
| 33 | // True iff there is an update to be downloaded. |
| 34 | bool update_exists; |
| 35 | |
| 36 | // If non-zero, server-dictated poll interval in seconds. |
| 37 | int poll_interval; |
| 38 | |
| 39 | // These are only valid if update_exists is true: |
Chris Sosa | 3b74843 | 2013-06-20 16:42:59 -0700 | [diff] [blame] | 40 | std::string version; |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 41 | |
| 42 | // The ordered list of URLs in the Omaha response. Each item is a complete |
| 43 | // URL (i.e. in terms of Omaha XML, each value is a urlBase + packageName) |
| 44 | std::vector<std::string> payload_urls; |
| 45 | |
| 46 | std::string more_info_url; |
| 47 | std::string hash; |
| 48 | std::string metadata_signature; |
| 49 | std::string deadline; |
| 50 | off_t size; |
| 51 | off_t metadata_size; |
| 52 | int max_days_to_scatter; |
| 53 | // The number of URL-related failures to tolerate before moving on to the |
| 54 | // next URL in the current pass. This is a configurable value from the |
| 55 | // Omaha Response attribute, if ever we need to fine tune the behavior. |
| 56 | uint32_t max_failure_count_per_url; |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 57 | bool prompt; |
| 58 | |
| 59 | // True if the payload described in this response is a delta payload. |
| 60 | // False if it's a full payload. |
| 61 | bool is_delta_payload; |
| 62 | |
| 63 | // True if the Omaha rule instructs us to disable the backoff logic |
| 64 | // on the client altogether. False otherwise. |
| 65 | bool disable_payload_backoff; |
David Zeuthen | 8f191b2 | 2013-08-06 12:27:50 -0700 | [diff] [blame] | 66 | |
| 67 | // True if the Omaha rule instructs us to disable p2p for downloading. |
| 68 | bool disable_p2p_for_downloading; |
| 69 | |
| 70 | // True if the Omaha rule instructs us to disable p2p for sharing. |
| 71 | bool disable_p2p_for_sharing; |
David Zeuthen | e7f8917 | 2013-10-31 10:21:04 -0700 | [diff] [blame^] | 72 | |
| 73 | // If not blank, a base-64 encoded representation of the PEM-encoded |
| 74 | // public key in the response. |
| 75 | std::string public_key_rsa; |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 76 | }; |
| 77 | COMPILE_ASSERT(sizeof(off_t) == 8, off_t_not_64bit); |
| 78 | |
| 79 | } // namespace chromeos_update_engine |
| 80 | |
| 81 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_H |