blob: 85cec5add1ea20d7983559928b680fb7acf998d5 [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
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
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),
29 disable_payload_backoff(false) {}
30
31 // True iff there is an update to be downloaded.
32 bool update_exists;
33
34 // If non-zero, server-dictated poll interval in seconds.
35 int poll_interval;
36
37 // These are only valid if update_exists is true:
Chris Sosa3b748432013-06-20 16:42:59 -070038 std::string version;
Jay Srinivasan08262882012-12-28 19:29:43 -080039
40 // The ordered list of URLs in the Omaha response. Each item is a complete
41 // URL (i.e. in terms of Omaha XML, each value is a urlBase + packageName)
42 std::vector<std::string> payload_urls;
43
44 std::string more_info_url;
45 std::string hash;
46 std::string metadata_signature;
47 std::string deadline;
48 off_t size;
49 off_t metadata_size;
50 int max_days_to_scatter;
51 // The number of URL-related failures to tolerate before moving on to the
52 // next URL in the current pass. This is a configurable value from the
53 // Omaha Response attribute, if ever we need to fine tune the behavior.
54 uint32_t max_failure_count_per_url;
Jay Srinivasan08262882012-12-28 19:29:43 -080055 bool prompt;
56
57 // True if the payload described in this response is a delta payload.
58 // False if it's a full payload.
59 bool is_delta_payload;
60
61 // True if the Omaha rule instructs us to disable the backoff logic
62 // on the client altogether. False otherwise.
63 bool disable_payload_backoff;
64};
65COMPILE_ASSERT(sizeof(off_t) == 8, off_t_not_64bit);
66
67} // namespace chromeos_update_engine
68
69#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_H