]> FriiDump Source - friidump.git/blob - src/native_report.h
Fix MSVC CMake SHA1 header resolution
[friidump.git] / src / native_report.h
1 #ifndef FRIIDUMP_NATIVE_REPORT_H_INCLUDED
2 #define FRIIDUMP_NATIVE_REPORT_H_INCLUDED
3
4 #include <stdbool.h>
5 #include <stddef.h>
6 #include <stdint.h>
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 #define FRIIDUMP_REPORT_PATH_MAX 1024
13 #define FRIIDUMP_REPORT_TEXT_MAX 2000
14 #define FRIIDUMP_REPORT_NOTE_MAX 16
15 #define FRIIDUMP_REPORT_ARTIFACT_MAX 8
16
17 typedef struct friidump_native_artifact_s {
18     char type[81];
19     char path[FRIIDUMP_REPORT_PATH_MAX + 1];
20     bool have_path;
21     uint64_t bytes;
22     bool have_bytes;
23     char sha256[65];
24     bool have_sha256;
25 } friidump_native_artifact;
26
27 typedef struct friidump_native_report_s {
28     bool enabled;
29     bool explicit_path;
30     bool directory_override;
31     char requested_path[FRIIDUMP_REPORT_PATH_MAX];
32     char report_dir[FRIIDUMP_REPORT_PATH_MAX];
33     char name_basis[FRIIDUMP_REPORT_PATH_MAX];
34     char final_path[FRIIDUMP_REPORT_PATH_MAX];
35
36     char generator_version[81];
37     char build_commit[41];
38     bool build_commit_known;
39
40     char run_id[37];
41     char started_utc[32];
42     char completed_utc[32];
43     char generated_utc[32];
44     char test_type[40];
45     char run_result[24];
46
47     char vendor[65];
48     char model[121];
49     char firmware_revision[65];
50     char interface_name[41];
51     char device_path[256];
52     bool have_device_path;
53     bool firmware_modified;
54     char modification_note[1001];
55     bool have_modification_note;
56     bool drive_known;
57
58     char platform[16];
59     char title[256];
60     bool have_title;
61     char region[81];
62     bool have_region;
63     char disc_id[121];
64     bool have_disc_id;
65
66     bool seed_attempted;
67     char seed_result[24];
68     double seed_duration_seconds;
69     bool have_seed_duration;
70
71     bool dump_attempted;
72     char dump_result[24];
73     uint64_t sector_count;
74     bool have_sector_count;
75     uint64_t byte_count;
76     bool have_byte_count;
77     double dump_duration_seconds;
78     bool have_dump_duration;
79     char failure_stage[161];
80     bool have_failure_stage;
81     uint64_t failure_sector;
82     bool have_failure_sector;
83     char output_path[FRIIDUMP_REPORT_PATH_MAX];
84     bool have_output_path;
85
86     char crc32[9];
87     char md5[33];
88     char sha1[41];
89     char sha256[65];
90
91     char reference_provider[81];
92     bool have_reference_provider;
93     char reference_result[24];
94     char reference_id[161];
95     bool have_reference_id;
96
97     char support_tier[121];
98     bool have_support_tier;
99     char cdb_offset[32];
100     bool have_cdb_offset;
101     char gate_address[32];
102     bool have_gate_address;
103
104     char notes[FRIIDUMP_REPORT_NOTE_MAX][FRIIDUMP_REPORT_TEXT_MAX + 1];
105     size_t note_count;
106
107     friidump_native_artifact artifacts[FRIIDUMP_REPORT_ARTIFACT_MAX];
108     size_t artifact_count;
109 } friidump_native_report;
110
111 void friidump_native_report_init(friidump_native_report *report, const char *generator_version);
112 bool friidump_native_report_enable_default(friidump_native_report *report);
113 bool friidump_native_report_enable_path(friidump_native_report *report, const char *path);
114 bool friidump_native_report_enable_dir(friidump_native_report *report, const char *directory);
115 bool friidump_native_report_set_name_basis(friidump_native_report *report, const char *path);
116 bool friidump_native_report_is_enabled(const friidump_native_report *report);
117 void friidump_native_report_set_build_commit(friidump_native_report *report, const char *commit);
118 void friidump_native_report_set_drive(friidump_native_report *report,
119                                       const char *vendor,
120                                       const char *model,
121                                       const char *firmware_revision,
122                                       const char *interface_name,
123                                       const char *device_path);
124 void friidump_native_report_set_firmware_modified(friidump_native_report *report,
125                                                    bool modified,
126                                                    const char *note);
127 void friidump_native_report_set_media(friidump_native_report *report,
128                                       const char *platform,
129                                       const char *title,
130                                       const char *region,
131                                       const char *disc_id);
132 void friidump_native_report_set_profile(friidump_native_report *report,
133                                         const char *support_tier,
134                                         uint32_t cdb_offset,
135                                         uint32_t gate_address);
136 void friidump_native_report_set_seed(friidump_native_report *report,
137                                      bool attempted,
138                                      const char *result,
139                                      bool have_duration,
140                                      double duration_seconds);
141 void friidump_native_report_set_dump(friidump_native_report *report,
142                                      bool attempted,
143                                      const char *result,
144                                      bool have_sector_count,
145                                      uint64_t sector_count,
146                                      bool have_byte_count,
147                                      uint64_t byte_count,
148                                      bool have_duration,
149                                      double duration_seconds,
150                                      const char *failure_stage,
151                                      bool have_failure_sector,
152                                      uint64_t failure_sector,
153                                      const char *output_path);
154 void friidump_native_report_set_hashes(friidump_native_report *report,
155                                        const char *crc32,
156                                        const char *md5,
157                                        const char *sha1,
158                                        const char *sha256);
159 void friidump_native_report_set_reference(friidump_native_report *report,
160                                           const char *provider,
161                                           const char *result,
162                                           const char *reference_id);
163 void friidump_native_report_set_outcome(friidump_native_report *report,
164                                         const char *test_type,
165                                         const char *run_result);
166 bool friidump_native_report_add_note(friidump_native_report *report, const char *note);
167 bool friidump_native_report_add_artifact(friidump_native_report *report,
168                                          const char *type,
169                                          const char *path,
170                                          bool have_bytes,
171                                          uint64_t bytes,
172                                          const char *sha256);
173 bool friidump_native_report_write(friidump_native_report *report,
174                                   char *written_path,
175                                   size_t written_path_size,
176                                   char *error_text,
177                                   size_t error_text_size);
178
179 #ifdef __cplusplus
180 }
181 #endif
182
183 #endif