1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef TelemetryEventInfo_h__
7 #define TelemetryEventInfo_h__
8 
9 #include "TelemetryCommon.h"
10 
11 // This module is internal to Telemetry. The structures here hold data that
12 // describe events.
13 // It should only be used by TelemetryEventData.h and TelemetryEvent.cpp.
14 //
15 // For the public interface to Telemetry functionality, see Telemetry.h.
16 
17 namespace {
18 
19 struct CommonEventInfo {
20   // Indices for the category and expiration strings.
21   uint32_t category_offset;
22   uint32_t expiration_version_offset;
23 
24   // The index and count for the extra key offsets in the extra table.
25   uint32_t extra_index;
26   uint32_t extra_count;
27 
28   // The dataset this event is recorded in.
29   uint32_t dataset;
30 
31   // Which processes to record this event in.
32   mozilla::Telemetry::Common::RecordedProcessType record_in_processes;
33 
34   // Which products to record this event on.
35   mozilla::Telemetry::Common::SupportedProduct products;
36 
37   // Convenience functions for accessing event strings.
38   const nsDependentCString expiration_version() const;
39   const nsDependentCString category() const;
40   const nsDependentCString extra_key(uint32_t index) const;
41 };
42 
43 struct EventInfo {
44   // The corresponding CommonEventInfo.
45   const CommonEventInfo& common_info;
46 
47   // Indices for the method & object strings.
48   uint32_t method_offset;
49   uint32_t object_offset;
50 
51   const nsDependentCString method() const;
52   const nsDependentCString object() const;
53 };
54 
55 }  // namespace
56 
57 #endif  // TelemetryEventInfo_h__
58