1 : // Copyright 2014 Google Inc. All Rights Reserved.
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 : #ifndef SYZYGY_KASKO_API_CLIENT_H_
16 : #define SYZYGY_KASKO_API_CLIENT_H_
17 :
18 : #include <Windows.h>
19 :
20 : #include "base/strings/string16.h"
21 : #include "syzygy/kasko/api/kasko_export.h"
22 : #include "syzygy/kasko/api/minidump_type.h"
23 :
24 m : namespace kasko {
25 m : namespace api {
26 :
27 : // Represents a property to include in a diagnostic report. This structure is
28 : // intended to have the same layout as a google_breakpad::CustomInfoEntry to
29 : // facilitate maintenance of a single property store in clients.
30 m : struct CrashKey {
31 : // Maximum name length.
32 m : static const int kNameMaxLength = 64;
33 : // Maximum value length.
34 m : static const int kValueMaxLength = 64;
35 :
36 : // The name of the property.
37 m : base::char16 name[kNameMaxLength];
38 : // The value of the property.
39 m : base::char16 value[kValueMaxLength];
40 m : };
41 :
42 : // Initializes a diagnostic reporting client in the current process.
43 : // @param endpoint_name The RPC endpoint name shared with the reporter process.
44 m : KASKO_EXPORT void InitializeClient(const base::char16* endpoint_name);
45 :
46 : // Shuts down and frees resources associated with the previously initialized
47 : // client.
48 m : KASKO_EXPORT void ShutdownClient();
49 :
50 : // Sends a diagnostic report for the current process.
51 : // @param exception_info_address Optional exception information.
52 : // @param minidump_type The type of minidump to be included in the report.
53 : // @param protobuf An optional protobuf to be included in the report.
54 : // @param protobuf_length The length of the protobuf.
55 : // @param crash_keys An optional array of crash keys. Keys with empty names or
56 : // values will be ignored.
57 : // @param crash_key_count The number of entries in crash_keys.
58 m : KASKO_EXPORT void SendReport(const EXCEPTION_POINTERS* exception_pointers,
59 m : MinidumpType minidump_type,
60 m : const char* protobuf,
61 m : size_t protobuf_length,
62 m : const CrashKey* crash_keys,
63 m : size_t crash_key_count);
64 :
65 m : } // namespace api
66 m : } // namespace kasko
67 :
68 : #endif // SYZYGY_KASKO_API_CLIENT_H_
|