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

Side by Side Diff: rlz/lib/rlz_lib.h

Issue 2857343004: Add rlz_utils as a new build target to rlz/ (Closed)
Patch Set: build.gn fix Created 3 years, 7 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 | « rlz/lib/rlz_api.h ('k') | rlz/lib/rlz_lib.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 11
12 #ifndef RLZ_LIB_RLZ_LIB_H_ 12 #ifndef RLZ_LIB_RLZ_LIB_H_
13 #define RLZ_LIB_RLZ_LIB_H_ 13 #define RLZ_LIB_RLZ_LIB_H_
14 14
15 #include <stddef.h> 15 #include <stddef.h>
16 #include <stdio.h> 16 #include <stdio.h>
17 #include <string> 17 #include <string>
18 18
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 20
21 #include "rlz/lib/rlz_api.h"
21 #include "rlz/lib/rlz_enums.h" 22 #include "rlz/lib/rlz_enums.h"
22 23
23 #if defined(OS_WIN)
24 #define RLZ_LIB_API __cdecl
25 #else
26 #define RLZ_LIB_API
27 #endif
28
29 // Define one of 24 // Define one of
30 // + RLZ_NETWORK_IMPLEMENTATION_WIN_INET: Uses win inet to send financial pings. 25 // + RLZ_NETWORK_IMPLEMENTATION_WIN_INET: Uses win inet to send financial pings.
31 // + RLZ_NETWORK_IMPLEMENTATION_CHROME_NET: Uses chrome's network stack to send 26 // + RLZ_NETWORK_IMPLEMENTATION_CHROME_NET: Uses chrome's network stack to send
32 // financial pings. rlz_lib::SetURLRequestContext() must be called before 27 // financial pings. rlz_lib::SetURLRequestContext() must be called before
33 // any calls to SendFinancialPing(). 28 // any calls to SendFinancialPing().
34 #if defined(RLZ_NETWORK_IMPLEMENTATION_WIN_INET) && \ 29 #if defined(RLZ_NETWORK_IMPLEMENTATION_WIN_INET) && \
35 defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) 30 defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET)
36 #error Exactly one of RLZ_NETWORK_IMPLEMENTATION_WIN_INET and \ 31 #error Exactly one of RLZ_NETWORK_IMPLEMENTATION_WIN_INET and \
37 RLZ_NETWORK_IMPLEMENTATION_CHROME_NET should be defined. 32 RLZ_NETWORK_IMPLEMENTATION_CHROME_NET should be defined.
38 #endif 33 #endif
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Functions which do not access registry will be marked with "no restrictions". 65 // Functions which do not access registry will be marked with "no restrictions".
71 66
72 class ScopedRlzValueStoreLock; 67 class ScopedRlzValueStoreLock;
73 68
74 // The maximum length of an access points RLZ in bytes. 69 // The maximum length of an access points RLZ in bytes.
75 const size_t kMaxRlzLength = 64; 70 const size_t kMaxRlzLength = 64;
76 // The maximum length of an access points RLZ in bytes. 71 // The maximum length of an access points RLZ in bytes.
77 const size_t kMaxDccLength = 128; 72 const size_t kMaxDccLength = 128;
78 // The maximum length of a CGI string in bytes. 73 // The maximum length of a CGI string in bytes.
79 const size_t kMaxCgiLength = 2048; 74 const size_t kMaxCgiLength = 2048;
80 // The maximum length of a ping response we will parse in bytes. If the response
81 // is bigger, please break it up into separate calls.
82 const size_t kMaxPingResponseLength = 0x4000; // 16K
83 75
84 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET) 76 #if defined(RLZ_NETWORK_IMPLEMENTATION_CHROME_NET)
85 // Set the URLRequestContextGetter used by SendFinancialPing(). The IO message 77 // Set the URLRequestContextGetter used by SendFinancialPing(). The IO message
86 // loop returned by this context will be used for the IO done by 78 // loop returned by this context will be used for the IO done by
87 // SendFinancialPing(). 79 // SendFinancialPing().
88 bool RLZ_LIB_API SetURLRequestContext(net::URLRequestContextGetter* context); 80 bool RLZ_LIB_API SetURLRequestContext(net::URLRequestContextGetter* context);
89 #endif 81 #endif
90 82
91 // RLZ storage functions. 83 // RLZ storage functions.
92 84
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 bool RLZ_LIB_API FormFinancialPingRequest(Product product, 162 bool RLZ_LIB_API FormFinancialPingRequest(Product product,
171 const AccessPoint* access_points, 163 const AccessPoint* access_points,
172 const char* product_signature, 164 const char* product_signature,
173 const char* product_brand, 165 const char* product_brand,
174 const char* product_id, 166 const char* product_id,
175 const char* product_lang, 167 const char* product_lang,
176 bool exclude_machine_id, 168 bool exclude_machine_id,
177 char* request, 169 char* request,
178 size_t request_buffer_size); 170 size_t request_buffer_size);
179 171
180 // Checks if a ping response is valid - ie. it has a checksum line which
181 // is the CRC-32 checksum of the message uptil the checksum. If
182 // checksum_idx is not NULL, it will get the index of the checksum, i.e. -
183 // the effective end of the message.
184 // Access: No restrictions.
185 bool RLZ_LIB_API IsPingResponseValid(const char* response,
186 int* checksum_idx);
187
188
189 // Complex helpers built on top of other functions. 172 // Complex helpers built on top of other functions.
190 173
191 // Parses the responses from the financial server and updates product state 174 // Parses the responses from the financial server and updates product state
192 // and access point RLZ's in registry. Like ParsePingResponse(), but also 175 // and access point RLZ's in registry. Like ParsePingResponse(), but also
193 // updates the last ping time. 176 // updates the last ping time.
194 // Access: HKCU write. 177 // Access: HKCU write.
195 bool RLZ_LIB_API ParseFinancialPingResponse(Product product, 178 bool RLZ_LIB_API ParseFinancialPingResponse(Product product,
196 const char* response); 179 const char* response);
197 180
198 // Send the ping with RLZs and events to the PSO server. 181 // Send the ping with RLZs and events to the PSO server.
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 304
322 static const std::string& GetBrand(); 305 static const std::string& GetBrand();
323 306
324 private: 307 private:
325 ScopedRlzValueStoreLock* lock_; 308 ScopedRlzValueStoreLock* lock_;
326 }; 309 };
327 310
328 } // namespace rlz_lib 311 } // namespace rlz_lib
329 312
330 #endif // RLZ_LIB_RLZ_LIB_H_ 313 #endif // RLZ_LIB_RLZ_LIB_H_
OLDNEW
« no previous file with comments | « rlz/lib/rlz_api.h ('k') | rlz/lib/rlz_lib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698