blob: d58bf4639802471162dfe40ccc63891164f91e6d [file] [log] [blame]
Jay Srinivasan08262882012-12-28 19:29:43 -08001// 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 Arnoldcf175a02014-07-10 16:48:47 -07005#ifndef UPDATE_ENGINE_OMAHA_RESPONSE_H_
6#define UPDATE_ENGINE_OMAHA_RESPONSE_H_
Jay Srinivasan08262882012-12-28 19:29:43 -08007
8#include <fcntl.h>
9#include <sys/stat.h>
10#include <sys/types.h>
11
12#include <string>
13#include <vector>
14
15namespace 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.
19struct OmahaResponse {
Jay Srinivasan08262882012-12-28 19:29:43 -080020 // True iff there is an update to be downloaded.
Alex Deymo8e18f932015-03-27 16:16:59 -070021 bool update_exists = false;
Jay Srinivasan08262882012-12-28 19:29:43 -080022
23 // If non-zero, server-dictated poll interval in seconds.
Alex Deymo8e18f932015-03-27 16:16:59 -070024 int poll_interval = 0;
Jay Srinivasan08262882012-12-28 19:29:43 -080025
26 // These are only valid if update_exists is true:
Chris Sosa3b748432013-06-20 16:42:59 -070027 std::string version;
Jay Srinivasan08262882012-12-28 19:29:43 -080028
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 Deymo8e18f932015-03-27 16:16:59 -070037 off_t size = 0;
38 off_t metadata_size = 0;
39 int max_days_to_scatter = 0;
Jay Srinivasan08262882012-12-28 19:29:43 -080040 // 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 Deymo8e18f932015-03-27 16:16:59 -070043 uint32_t max_failure_count_per_url = 0;
44 bool prompt = false;
Jay Srinivasan08262882012-12-28 19:29:43 -080045
46 // True if the payload described in this response is a delta payload.
47 // False if it's a full payload.
Alex Deymo8e18f932015-03-27 16:16:59 -070048 bool is_delta_payload = false;
Jay Srinivasan08262882012-12-28 19:29:43 -080049
Alex Vakulenko072359c2014-07-18 11:41:07 -070050 // True if the Omaha rule instructs us to disable the back-off logic
Jay Srinivasan08262882012-12-28 19:29:43 -080051 // on the client altogether. False otherwise.
Alex Deymo8e18f932015-03-27 16:16:59 -070052 bool disable_payload_backoff = false;
David Zeuthen8f191b22013-08-06 12:27:50 -070053
54 // True if the Omaha rule instructs us to disable p2p for downloading.
Alex Deymo8e18f932015-03-27 16:16:59 -070055 bool disable_p2p_for_downloading = false;
David Zeuthen8f191b22013-08-06 12:27:50 -070056
57 // True if the Omaha rule instructs us to disable p2p for sharing.
Alex Deymo8e18f932015-03-27 16:16:59 -070058 bool disable_p2p_for_sharing = false;
David Zeuthene7f89172013-10-31 10:21:04 -070059
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 Zeuthen639aa362014-02-03 16:23:44 -080063
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 Deymo8e18f932015-03-27 16:16:59 -070067 int install_date_days = -1;
Jay Srinivasan08262882012-12-28 19:29:43 -080068};
69COMPILE_ASSERT(sizeof(off_t) == 8, off_t_not_64bit);
70
71} // namespace chromeos_update_engine
72
Gilad Arnoldcf175a02014-07-10 16:48:47 -070073#endif // UPDATE_ENGINE_OMAHA_RESPONSE_H_