blob: c1e8e4d8974463a01d6c765ec96a85e6ed781625 [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 {
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 Srinivasan08262882012-12-28 19:29:43 -080027 prompt(false),
28 is_delta_payload(false),
David Zeuthen8f191b22013-08-06 12:27:50 -070029 disable_payload_backoff(false),
30 disable_p2p_for_downloading(false),
David Zeuthen639aa362014-02-03 16:23:44 -080031 disable_p2p_for_sharing(false),
32 install_date_days(-1) {}
Jay Srinivasan08262882012-12-28 19:29:43 -080033
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 Sosa3b748432013-06-20 16:42:59 -070041 std::string version;
Jay Srinivasan08262882012-12-28 19:29:43 -080042
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 Srinivasan08262882012-12-28 19:29:43 -080058 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 Vakulenko072359c2014-07-18 11:41:07 -070064 // True if the Omaha rule instructs us to disable the back-off logic
Jay Srinivasan08262882012-12-28 19:29:43 -080065 // on the client altogether. False otherwise.
66 bool disable_payload_backoff;
David Zeuthen8f191b22013-08-06 12:27:50 -070067
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 Zeuthene7f89172013-10-31 10:21:04 -070073
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 Zeuthen639aa362014-02-03 16:23:44 -080077
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 Srinivasan08262882012-12-28 19:29:43 -080082};
83COMPILE_ASSERT(sizeof(off_t) == 8, off_t_not_64bit);
84
85} // namespace chromeos_update_engine
86
Gilad Arnoldcf175a02014-07-10 16:48:47 -070087#endif // UPDATE_ENGINE_OMAHA_RESPONSE_H_