blob: 60ec4acc6017c9a752660309c3572d98435e4361 [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
2// Copyright (C) 2012 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
Jay Srinivasan08262882012-12-28 19:29:43 -080016
Gilad Arnoldcf175a02014-07-10 16:48:47 -070017#ifndef UPDATE_ENGINE_OMAHA_RESPONSE_H_
18#define UPDATE_ENGINE_OMAHA_RESPONSE_H_
Jay Srinivasan08262882012-12-28 19:29:43 -080019
20#include <fcntl.h>
21#include <sys/stat.h>
22#include <sys/types.h>
23
24#include <string>
25#include <vector>
26
27namespace chromeos_update_engine {
28
29// This struct encapsulates the data Omaha's response for the request.
30// The strings in this struct are not XML escaped.
31struct OmahaResponse {
Jay Srinivasan08262882012-12-28 19:29:43 -080032 // True iff there is an update to be downloaded.
Alex Deymo8e18f932015-03-27 16:16:59 -070033 bool update_exists = false;
Jay Srinivasan08262882012-12-28 19:29:43 -080034
35 // If non-zero, server-dictated poll interval in seconds.
Alex Deymo8e18f932015-03-27 16:16:59 -070036 int poll_interval = 0;
Jay Srinivasan08262882012-12-28 19:29:43 -080037
38 // These are only valid if update_exists is true:
Chris Sosa3b748432013-06-20 16:42:59 -070039 std::string version;
Jay Srinivasan08262882012-12-28 19:29:43 -080040
41 // The ordered list of URLs in the Omaha response. Each item is a complete
42 // URL (i.e. in terms of Omaha XML, each value is a urlBase + packageName)
43 std::vector<std::string> payload_urls;
44
45 std::string more_info_url;
46 std::string hash;
47 std::string metadata_signature;
48 std::string deadline;
Alex Deymo8e18f932015-03-27 16:16:59 -070049 off_t size = 0;
50 off_t metadata_size = 0;
51 int max_days_to_scatter = 0;
Jay Srinivasan08262882012-12-28 19:29:43 -080052 // The number of URL-related failures to tolerate before moving on to the
53 // next URL in the current pass. This is a configurable value from the
54 // Omaha Response attribute, if ever we need to fine tune the behavior.
Alex Deymo8e18f932015-03-27 16:16:59 -070055 uint32_t max_failure_count_per_url = 0;
56 bool prompt = false;
Jay Srinivasan08262882012-12-28 19:29:43 -080057
58 // True if the payload described in this response is a delta payload.
59 // False if it's a full payload.
Alex Deymo8e18f932015-03-27 16:16:59 -070060 bool is_delta_payload = false;
Jay Srinivasan08262882012-12-28 19:29:43 -080061
Alex Vakulenko072359c2014-07-18 11:41:07 -070062 // True if the Omaha rule instructs us to disable the back-off logic
Jay Srinivasan08262882012-12-28 19:29:43 -080063 // on the client altogether. False otherwise.
Alex Deymo8e18f932015-03-27 16:16:59 -070064 bool disable_payload_backoff = false;
David Zeuthen8f191b22013-08-06 12:27:50 -070065
66 // True if the Omaha rule instructs us to disable p2p for downloading.
Alex Deymo8e18f932015-03-27 16:16:59 -070067 bool disable_p2p_for_downloading = false;
David Zeuthen8f191b22013-08-06 12:27:50 -070068
69 // True if the Omaha rule instructs us to disable p2p for sharing.
Alex Deymo8e18f932015-03-27 16:16:59 -070070 bool disable_p2p_for_sharing = false;
David Zeuthene7f89172013-10-31 10:21:04 -070071
72 // If not blank, a base-64 encoded representation of the PEM-encoded
73 // public key in the response.
74 std::string public_key_rsa;
David Zeuthen639aa362014-02-03 16:23:44 -080075
76 // If not -1, the number of days since the epoch Jan 1, 2007 0:00
77 // PST, according to the Omaha Server's clock and timezone (PST8PDT,
78 // aka "Pacific Time".)
Alex Deymo8e18f932015-03-27 16:16:59 -070079 int install_date_days = -1;
Jay Srinivasan08262882012-12-28 19:29:43 -080080};
Alex Vakulenko0103c362016-01-20 07:56:15 -080081static_assert(sizeof(off_t) == 8, "off_t not 64 bit");
Jay Srinivasan08262882012-12-28 19:29:43 -080082
83} // namespace chromeos_update_engine
84
Gilad Arnoldcf175a02014-07-10 16:48:47 -070085#endif // UPDATE_ENGINE_OMAHA_RESPONSE_H_