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_REPORTER_H_
16 : #define SYZYGY_KASKO_API_REPORTER_H_
17 :
18 : #include "base/process/process_handle.h"
19 : #include "base/strings/string16.h"
20 : #include "syzygy/kasko/api/kasko_export.h"
21 : #include "syzygy/kasko/api/minidump_type.h"
22 :
23 m : namespace kasko {
24 m : namespace api {
25 :
26 : // The extension given to crash keys files in the permanent failure directory.
27 m : KASKO_EXPORT extern const base::char16* const
28 m : kPermanentFailureCrashKeysExtension;
29 : // The extension given to minidump files in the permanent failure directory.
30 m : KASKO_EXPORT extern const base::char16* const
31 m : kPermanentFailureMinidumpExtension;
32 :
33 : // Initializes the Kasko reporter process, including the reporter RPC service
34 : // and background report uploading. Must be matched by a call to
35 : // ShutdownReporter.
36 : //
37 : // Reports that exceed upload retry limits will be moved to the configured
38 : // permanent failure directory. The reports consist of two files: a minidump
39 : // file (extension kPermanentFailureMinidumpExtension, which is '.dmp') and a
40 : // crash keys file (extension kPermanentFailureCrashKeysExtension, which is
41 : // '.kys'). The two file names will be identical apart from the extension. The
42 : // crash keys file will contain a JSON dictionary mapping crash key names to
43 : // string values.
44 : //
45 : // @param endpoint_name The endpoint name that will be used by the Kasko RPC
46 : // service.
47 : // @param url The URL that will be used for uploading crash reports.
48 : // @param data_directory The directory where crash reports will be queued until
49 : // uploaded.
50 : // @param permanent_failure_directory The location where reports will be stored
51 : // once the maximum number of upload attempts has been exceeded.
52 : // @returns true if successful.
53 m : KASKO_EXPORT bool InitializeReporter(
54 m : const base::char16* endpoint_name,
55 m : const base::char16* url,
56 m : const base::char16* data_directory,
57 m : const base::char16* permanent_failure_directory);
58 :
59 : // Sends a diagnostic report for a specified process with the specified crash
60 : // keys. May only be invoked after a successful call to InitializeReporter.
61 : // @param process_handle A handle to the process to report on.
62 : // @param minidump_type The type of minidump to be included in the report.
63 : // @param keys An optional null-terminated array of crash key names
64 : // @param values An optional null-terminated array of crash key values. Must be
65 : // of equal length to |keys|.
66 m : KASKO_EXPORT void SendReportForProcess(base::ProcessHandle process_handle,
67 m : MinidumpType minidump_type,
68 m : const base::char16* const* keys,
69 m : const base::char16* const* values);
70 :
71 : // Shuts down the Kasko reporter process. Must only be called after a successful
72 : // invocation of InitializeReporter.
73 m : KASKO_EXPORT void ShutdownReporter();
74 :
75 m : } // namespace api
76 m : } // namespace kasko
77 :
78 : #endif // SYZYGY_KASKO_API_REPORTER_H_
|