omaha_response.h revision 082628869ed3ee3e173c08354d3fc40cdb7df2c0
1// 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), 27 needs_admin(false), 28 prompt(false), 29 is_delta_payload(false), 30 disable_payload_backoff(false) {} 31 32 // True iff there is an update to be downloaded. 33 bool update_exists; 34 35 // If non-zero, server-dictated poll interval in seconds. 36 int poll_interval; 37 38 // These are only valid if update_exists is true: 39 std::string display_version; 40 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; 49 off_t size; 50 off_t metadata_size; 51 int max_days_to_scatter; 52 // 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. 55 uint32_t max_failure_count_per_url; 56 bool needs_admin; 57 bool prompt; 58 59 // True if the payload described in this response is a delta payload. 60 // False if it's a full payload. 61 bool is_delta_payload; 62 63 // True if the Omaha rule instructs us to disable the backoff logic 64 // on the client altogether. False otherwise. 65 bool disable_payload_backoff; 66}; 67COMPILE_ASSERT(sizeof(off_t) == 8, off_t_not_64bit); 68 69} // namespace chromeos_update_engine 70 71#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_H 72