OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 // A library to manage RLZ information for access-points shared | 5 // A library to manage RLZ information for access-points shared |
6 // across different client applications. | 6 // across different client applications. |
7 // | 7 // |
8 // All functions return true on success and false on error. | 8 // All functions return true on success and false on error. |
9 // This implemenation is thread safe. | 9 // This implemenation is thread safe. |
10 | 10 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 bool RLZ_LIB_API FormFinancialPingRequest(Product product, | 170 bool RLZ_LIB_API FormFinancialPingRequest(Product product, |
171 const AccessPoint* access_points, | 171 const AccessPoint* access_points, |
172 const char* product_signature, | 172 const char* product_signature, |
173 const char* product_brand, | 173 const char* product_brand, |
174 const char* product_id, | 174 const char* product_id, |
175 const char* product_lang, | 175 const char* product_lang, |
176 bool exclude_machine_id, | 176 bool exclude_machine_id, |
177 char* request, | 177 char* request, |
178 size_t request_buffer_size); | 178 size_t request_buffer_size); |
179 | 179 |
180 // Pings the financial server and returns the HTTP response. This will fail | |
181 // if it is too early to ping the server since the last ping. | |
182 // | |
183 // If RLZ_NETWORK_IMPLEMENTATION_CHROME_NET is set, SetURLRequestContext() needs | |
184 // to be called before calling this function. | |
185 // | |
186 // product : The product to ping for. | |
187 // request : The HTTP request (for example, returned by | |
188 // FormFinancialPingRequest). | |
189 // response : The buffer in which the HTTP response is returned. | |
190 // response_buffer_size : The size of the response buffer in bytes. The buffer | |
191 // size (kMaxPingResponseLength+1) is enough for all | |
192 // legitimate server responses (any response that is | |
193 // bigger should be considered the same way as a general | |
194 // network problem). | |
195 // | |
196 // Access: HKCU read. | |
197 bool RLZ_LIB_API PingFinancialServer(Product product, | |
198 const char* request, | |
199 char* response, | |
200 size_t response_buffer_size); | |
201 | |
202 // Checks if a ping response is valid - ie. it has a checksum line which | 180 // Checks if a ping response is valid - ie. it has a checksum line which |
203 // is the CRC-32 checksum of the message uptil the checksum. If | 181 // is the CRC-32 checksum of the message uptil the checksum. If |
204 // checksum_idx is not NULL, it will get the index of the checksum, i.e. - | 182 // checksum_idx is not NULL, it will get the index of the checksum, i.e. - |
205 // the effective end of the message. | 183 // the effective end of the message. |
206 // Access: No restrictions. | 184 // Access: No restrictions. |
207 bool RLZ_LIB_API IsPingResponseValid(const char* response, | 185 bool RLZ_LIB_API IsPingResponseValid(const char* response, |
208 int* checksum_idx); | 186 int* checksum_idx); |
209 | 187 |
210 | 188 |
211 // Complex helpers built on top of other functions. | 189 // Complex helpers built on top of other functions. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 321 |
344 static const std::string& GetBrand(); | 322 static const std::string& GetBrand(); |
345 | 323 |
346 private: | 324 private: |
347 ScopedRlzValueStoreLock* lock_; | 325 ScopedRlzValueStoreLock* lock_; |
348 }; | 326 }; |
349 | 327 |
350 } // namespace rlz_lib | 328 } // namespace rlz_lib |
351 | 329 |
352 #endif // RLZ_LIB_RLZ_LIB_H_ | 330 #endif // RLZ_LIB_RLZ_LIB_H_ |
OLD | NEW |