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
3// found in the LICENSE file.
4//
5// Functions exported by the RLZ DLL.
6
7#include "rlz/win/lib/rlz_lib.h"
8
9#define RLZ_DLL_EXPORT extern "C" __declspec(dllexport)
10
11RLZ_DLL_EXPORT bool RecordProductEvent(rlz_lib::Product product,
12                                       rlz_lib::AccessPoint point,
13                                       rlz_lib::Event event_id) {
14  return rlz_lib::RecordProductEvent(product, point, event_id);
15}
16
17RLZ_DLL_EXPORT bool GetProductEventsAsCgi(rlz_lib::Product product,
18                                          char* unescaped_cgi,
19                                          size_t unescaped_cgi_size) {
20  return rlz_lib::GetProductEventsAsCgi(product, unescaped_cgi,
21                                        unescaped_cgi_size);
22}
23RLZ_DLL_EXPORT bool ClearAllProductEvents(rlz_lib::Product product) {
24  return rlz_lib::ClearAllProductEvents(product);
25}
26
27RLZ_DLL_EXPORT bool ClearProductEvent(rlz_lib::Product product,
28                                      rlz_lib::AccessPoint point,
29                                      rlz_lib::Event event_id) {
30  return rlz_lib::ClearProductEvent(product, point, event_id);
31}
32
33RLZ_DLL_EXPORT bool GetAccessPointRlz(rlz_lib::AccessPoint point,
34                                      char* rlz,
35                                      size_t rlz_size) {
36  return rlz_lib::GetAccessPointRlz(point, rlz, rlz_size);
37}
38
39RLZ_DLL_EXPORT bool SetAccessPointRlz(rlz_lib::AccessPoint point,
40                                      const char* new_rlz) {
41  return rlz_lib::SetAccessPointRlz(point, new_rlz);
42}
43
44RLZ_DLL_EXPORT bool CreateMachineState() {
45  return rlz_lib::CreateMachineState();
46}
47
48RLZ_DLL_EXPORT bool SetMachineDealCode(const char* dcc) {
49  return rlz_lib::SetMachineDealCode(dcc);
50}
51
52RLZ_DLL_EXPORT bool GetMachineDealCodeAsCgi(char* cgi, size_t cgi_size) {
53  return rlz_lib::GetMachineDealCodeAsCgi(cgi, cgi_size);
54}
55
56RLZ_DLL_EXPORT bool GetMachineDealCode2(char* dcc, size_t dcc_size) {
57  return rlz_lib::GetMachineDealCode(dcc, dcc_size);
58}
59
60RLZ_DLL_EXPORT bool GetPingParams(rlz_lib::Product product,
61                                  const rlz_lib::AccessPoint* access_points,
62                                  char* unescaped_cgi,
63                                  size_t unescaped_cgi_size) {
64  return rlz_lib::GetPingParams(product, access_points, unescaped_cgi,
65                                unescaped_cgi_size);
66}
67
68RLZ_DLL_EXPORT bool ParsePingResponse(rlz_lib::Product product,
69                                      const char* response) {
70  return rlz_lib::ParsePingResponse(product, response);
71}
72
73RLZ_DLL_EXPORT bool IsPingResponseValid(const char* response,
74                                        int* checksum_idx) {
75  return rlz_lib::IsPingResponseValid(response, checksum_idx);
76}
77
78RLZ_DLL_EXPORT bool SetMachineDealCodeFromPingResponse(const char* response) {
79  return rlz_lib::SetMachineDealCodeFromPingResponse(response);
80}
81
82RLZ_DLL_EXPORT bool SendFinancialPing(rlz_lib::Product product,
83                                      const rlz_lib::AccessPoint* access_points,
84                                      const char* product_signature,
85                                      const char* product_brand,
86                                      const char* product_id,
87                                      const char* product_lang,
88                                      bool exclude_machine_id) {
89  return rlz_lib::SendFinancialPing(product, access_points, product_signature,
90      product_brand, product_id, product_lang, exclude_machine_id);
91}
92
93RLZ_DLL_EXPORT bool SendFinancialPingNoDelay(
94    rlz_lib::Product product,
95    const rlz_lib::AccessPoint* access_points,
96    const char* product_signature,
97    const char* product_brand,
98    const char* product_id,
99    const char* product_lang,
100    bool exclude_machine_id) {
101  return rlz_lib::SendFinancialPing(product, access_points, product_signature,
102      product_brand, product_id, product_lang, exclude_machine_id, true);
103}
104
105RLZ_DLL_EXPORT void ClearProductState(
106    rlz_lib::Product product, const rlz_lib::AccessPoint* access_points) {
107  return rlz_lib::ClearProductState(product, access_points);
108}
109