Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: common/protocol_definition.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « common/progress_sampler.h ('k') | common/protocol_definition_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2010 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15
16 // Definitions for the request and response data structures that are part of
17 // the xml protocol. Each attribute or element that occurs in the xml protocol
18 // has a definition here. The request and response xml artifacts are defined
19 // inside their corresponding namespaces.
20
21 #ifndef OMAHA_COMMON_PROTOCOL_DEFINITION_H_
22 #define OMAHA_COMMON_PROTOCOL_DEFINITION_H_
23
24 #include <vector>
25 #include "omaha/common/const_goopdate.h"
26 #include "omaha/common/install_manifest.h"
27 #include "omaha/common/ping_event.h"
28
29 namespace omaha {
30
31 namespace xml {
32
33 namespace request {
34
35 // Defines the structure of the Omaha protocol update request.
36 // The structure of the request is:
37 //
38 // Request | --- OS
39 // | -<- App | --- UpdateCheck
40 // | --- Data
41 // | --- Ping
42 // | -<- PingEvent
43 //
44 // The xml parser traverses this data structure in order to serialize it. The
45 // names of the members of structures closely match the names of the elements
46 // and attributes in the xml document.
47 //
48 // TODO(omaha): briefly document the members.
49
50 struct OS {
51 CString platform;
52 CString version;
53 CString service_pack;
54 CString arch;
55 };
56
57 struct UpdateCheck {
58 UpdateCheck() : is_valid(false), is_update_disabled(false) {}
59
60 // TODO(omaha): this member is not serialized. Use pointers to indicate
61 // optional elements instead of is_valid.
62 bool is_valid;
63
64 bool is_update_disabled;
65
66 CString tt_token;
67 };
68
69 // For now, only a single "install" data is supported.
70 struct Data {
71 CString install_data_index;
72 };
73
74 // didrun element. The element is named "ping" for legacy reasons.
75 struct Ping {
76 Ping() : active(ACTIVE_UNKNOWN),
77 days_since_last_active_ping(0),
78 days_since_last_roll_call(0) {}
79
80 ActiveStates active;
81 int days_since_last_active_ping;
82 int days_since_last_roll_call;
83 };
84
85 struct App {
86 App() : install_time_diff_sec(0) {}
87
88 CString app_id;
89
90 CString version;
91
92 CString next_version;
93
94 CString ap;
95
96 CString lang;
97
98 CString iid;
99
100 CString brand_code;
101
102 CString client_id;
103
104 CString experiments;
105
106 int install_time_diff_sec;
107
108 // Optional update check.
109 UpdateCheck update_check;
110
111 // Optional data.
112 Data data;
113
114 // Optional 'did run' ping.
115 Ping ping;
116
117 // Progress/result pings.
118 PingEventVector ping_events;
119 };
120
121 struct Request {
122 Request() : is_machine(false), check_period_sec(-1) {}
123
124 bool is_machine;
125
126 CString uid;
127
128 CString protocol_version;
129
130 CString omaha_version;
131
132 CString install_source;
133
134 CString origin_url;
135
136 // Identifies the source of the request as a test/production prober system.
137 CString test_source;
138
139 // Unique identifier for this request, used to associate the same request
140 // received multiple times on the server.
141 CString request_id;
142
143 // Unique identifier for this session, used to correlate multiple requests
144 // associated with a single operation by the Omaha client.
145 CString session_id;
146
147 // Time between update checks in seconds.
148 // TODO(omaha): see if we can enforce by convention that -1 means it is
149 // using the default value.
150 int check_period_sec;
151
152 OS os;
153
154 std::vector<App> apps;
155 };
156
157 } // namespace request
158
159 namespace response {
160
161 // Defines an Omaha protocol update response. The structure of the response is:
162 //
163 // Response | --- DayStart
164 // | -<- App | --- UpdateCheck | --- Urls
165 // | --- InstallManifest | --- Packages
166 // | --- Actions
167 // | --- Data
168 // | --- Ping
169 // | -<- Event
170 //
171 // The xml parser traverses the xml dom and populates the data members of
172 // the response. The names of the members of structures closely match the names
173 // of the elements and attributes in the xml document.
174 //
175 // TODO(omaha): briefly document the members.
176
177 struct UpdateCheck {
178 CString status;
179
180 CString tt_token;
181
182 CString error_url; // URL describing error.
183
184 std::vector<CString> urls;
185
186 InstallManifest install_manifest;
187 };
188
189 // For now, only a single "install" data is supported.
190 struct Data {
191 CString status;
192
193 CString install_data_index;
194 CString install_data;
195 };
196
197 struct Ping {
198 CString status;
199 };
200
201 struct Event {
202 CString status;
203 };
204
205 struct App {
206 CString status;
207
208 // TODO(omaha): rename to app_id.
209 CString appid;
210
211 CString experiments;
212
213 UpdateCheck update_check;
214
215 std::vector<Data> data;
216
217 Ping ping;
218
219 std::vector<Event> events;
220 };
221
222 struct DayStart {
223 DayStart() : elapsed_seconds(0) {}
224
225 int elapsed_seconds;
226 };
227
228 struct Response {
229 CString protocol;
230 DayStart day_start;
231 std::vector<App> apps;
232 };
233
234 } // namespace response
235
236 } // namespace xml
237
238 } // namespace omaha
239
240 #endif // OMAHA_COMMON_PROTOCOL_DEFINITION_H_
241
OLDNEW
« no previous file with comments | « common/progress_sampler.h ('k') | common/protocol_definition_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698