• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <cstdint>
18 
19 #include "src/trace_redaction/trace_redaction_framework.h"
20 
21 #ifndef SRC_TRACE_REDACTION_FILTERING_H_
22 #define SRC_TRACE_REDACTION_FILTERING_H_
23 
24 namespace perfetto::trace_redaction {
25 
26 class PidFilter {
27  public:
28   virtual ~PidFilter();
29 
30   virtual bool Includes(const Context& context,
31                         uint64_t ts,
32                         int32_t pid) const = 0;
33 };
34 
35 class FtraceEventFilter {
36  public:
37   virtual ~FtraceEventFilter();
38   virtual bool Includes(const Context& context,
39                         protozero::Field event) const = 0;
40 };
41 
42 class ConnectedToPackage : public PidFilter {
43  public:
44   bool Includes(const Context& context,
45                 uint64_t ts,
46                 int32_t pid) const override;
47 };
48 
49 class AllowAll : public PidFilter, public FtraceEventFilter {
50  public:
51   bool Includes(const Context&, uint64_t, int32_t) const override;
52 
53   bool Includes(const Context& context, protozero::Field event) const override;
54 };
55 
56 }  // namespace perfetto::trace_redaction
57 
58 #endif  // SRC_TRACE_REDACTION_FILTERING_H_
59