• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
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 //
16 
17 #ifndef UPDATE_ENGINE_OMAHA_RESPONSE_H_
18 #define UPDATE_ENGINE_OMAHA_RESPONSE_H_
19 
20 #include <fcntl.h>
21 #include <sys/stat.h>
22 #include <sys/types.h>
23 
24 #include <string>
25 #include <vector>
26 
27 namespace 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.
31 struct OmahaResponse {
32   // True iff there is an update to be downloaded.
33   bool update_exists = false;
34 
35   // If non-zero, server-dictated poll interval in seconds.
36   int poll_interval = 0;
37 
38   // These are only valid if update_exists is true:
39   std::string version;
40 
41   struct Package {
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     uint64_t size = 0;
46     uint64_t metadata_size = 0;
47     std::string metadata_signature;
48     std::string hash;
49     // True if the payload described in this response is a delta payload.
50     // False if it's a full payload.
51     bool is_delta = false;
52   };
53   std::vector<Package> packages;
54 
55   std::string more_info_url;
56   std::string deadline;
57   int max_days_to_scatter = 0;
58   // The number of URL-related failures to tolerate before moving on to the
59   // next URL in the current pass. This is a configurable value from the
60   // Omaha Response attribute, if ever we need to fine tune the behavior.
61   uint32_t max_failure_count_per_url = 0;
62   bool prompt = false;
63 
64   // True if the Omaha rule instructs us to disable the back-off logic
65   // on the client altogether. False otherwise.
66   bool disable_payload_backoff = false;
67 
68   // True if the Omaha rule instructs us to disable p2p for downloading.
69   bool disable_p2p_for_downloading = false;
70 
71   // True if the Omaha rule instructs us to disable p2p for sharing.
72   bool disable_p2p_for_sharing = false;
73 
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;
77 
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 = -1;
82 };
83 static_assert(sizeof(off_t) == 8, "off_t not 64 bit");
84 
85 }  // namespace chromeos_update_engine
86 
87 #endif  // UPDATE_ENGINE_OMAHA_RESPONSE_H_
88