OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H__ |
7 | 7 |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
| 14 #include <base/scoped_ptr.h> |
14 #include <curl/curl.h> | 15 #include <curl/curl.h> |
15 | 16 |
16 #include "base/scoped_ptr.h" | |
17 #include "update_engine/action.h" | 17 #include "update_engine/action.h" |
18 #include "update_engine/http_fetcher.h" | 18 #include "update_engine/http_fetcher.h" |
19 | 19 |
20 // The Omaha Request action makes a request to Omaha and can output | 20 // The Omaha Request action makes a request to Omaha and can output |
21 // the response on the output ActionPipe. | 21 // the response on the output ActionPipe. |
22 | 22 |
23 namespace chromeos_update_engine { | 23 namespace chromeos_update_engine { |
24 | 24 |
25 // Encodes XML entities in a given string with libxml2. input must be | 25 // Encodes XML entities in a given string with libxml2. input must be |
26 // UTF-8 formatted. Output will be UTF-8 formatted. | 26 // UTF-8 formatted. Output will be UTF-8 formatted. |
27 std::string XmlEncode(const std::string& input); | 27 std::string XmlEncode(const std::string& input); |
28 | 28 |
29 // This struct encapsulates the data Omaha's response for the request. | 29 // This struct encapsulates the data Omaha's response for the request. |
30 // These strings in this struct are not XML escaped. | 30 // These strings in this struct are not XML escaped. |
31 struct OmahaResponse { | 31 struct OmahaResponse { |
32 OmahaResponse() | 32 OmahaResponse() |
33 : update_exists(false), size(0), needs_admin(false), prompt(false) {} | 33 : update_exists(false), |
| 34 poll_interval(0), |
| 35 size(0), |
| 36 needs_admin(false), |
| 37 prompt(false) {} |
34 // True iff there is an update to be downloaded. | 38 // True iff there is an update to be downloaded. |
35 bool update_exists; | 39 bool update_exists; |
36 | 40 |
| 41 // If non-zero, server-dictated poll frequency in seconds. |
| 42 int poll_interval; |
| 43 |
37 // These are only valid if update_exists is true: | 44 // These are only valid if update_exists is true: |
38 std::string display_version; | 45 std::string display_version; |
39 std::string codebase; | 46 std::string codebase; |
40 std::string more_info_url; | 47 std::string more_info_url; |
41 std::string hash; | 48 std::string hash; |
42 off_t size; | 49 off_t size; |
43 bool needs_admin; | 50 bool needs_admin; |
44 bool prompt; | 51 bool prompt; |
45 bool is_delta; | 52 bool is_delta; |
46 }; | 53 }; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // are sent to Omaha. | 178 // are sent to Omaha. |
172 int ping_active_days_; | 179 int ping_active_days_; |
173 int ping_roll_call_days_; | 180 int ping_roll_call_days_; |
174 | 181 |
175 DISALLOW_COPY_AND_ASSIGN(OmahaRequestAction); | 182 DISALLOW_COPY_AND_ASSIGN(OmahaRequestAction); |
176 }; | 183 }; |
177 | 184 |
178 } // namespace chromeos_update_engine | 185 } // namespace chromeos_update_engine |
179 | 186 |
180 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H__ | 187 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H__ |
OLD | NEW |