• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
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 
16 #ifndef SECURITY_GUARD_MODEL_INFO_H
17 #define SECURITY_GUARD_MODEL_INFO_H
18 
19 #include <string>
20 #include <vector>
21 
22 namespace OHOS::Security::SecurityGuard {
23 using Field = struct {
24     std::string fieldName;
25     std::string fieldType;
26     std::string value;
27 };
28 
29 using Rule = struct {
30     int64_t eventId;
31     std::vector<Field> fields;
32     std::string fieldsRelation;
33 };
34 
35 using BuildInDetectionCfg = struct {
36     std::vector<Rule> rules;
37     std::string rulesRelation;
38     std::string trueResult;
39     std::string falseResult;
40 };
41 
42 using AppDetectionCfg = struct {
43     std::string detectionCategory;
44     std::string configFileName;
45     std::string trueResult;
46     std::string falseResult;
47 };
48 
49 using AppAttribute = enum {
50     NORMAL,
51     PAYMENT,
52     MALICIOUS,
53     MONITORING,
54     ATTRMAX
55 };
56 
57 using AppInfo = struct {
58     std::string appName;
59     std::string appHash;
60     std::vector<std::string> attrs;
61     int isGlobalApp;
62     int isUpdate;
63 };
64 
65 using ModelCfg = struct {
66     uint32_t modelId;
67     std::string path;
68     std::string format;
69     uint32_t startMode;
70     std::vector<int64_t> preload;
71     std::vector<int64_t> eventList;
72     std::string permissions;
73     std::string dbTable;
74     uint32_t runningCntl;
75     std::vector<std::string> caller;
76     std::string type;
77     BuildInDetectionCfg config;
78     AppDetectionCfg appDetectionConfig;
79 };
80 
81 enum class EventTypeEnum {
82     NORMALE_COLL = 0,
83     QUERY_COLL = 1,
84     START_STOP_COLL = 2,
85     SUBSCRIBE_COLL = 3
86 };
87 
88 
89 using DataMgrCfgSt = struct {
90     uint32_t deviceRom;
91     uint32_t deviceRam;
92     uint32_t eventMaxRamNum;
93     uint32_t eventMaxRomNum;
94     std::string prog;
95 };
96 
97 using EventContentSt = struct {
98     uint32_t status;
99     uint32_t cred;
100     std::string extra;
101 };
102 
103 using SecEvent = struct {
104     int64_t eventId;
105     std::string version;
106     std::string date;
107     std::string content;
108     int32_t eventType;
109     int32_t dataSensitivityLevel;
110     std::string owner;
111     int32_t userId;
112     std::string deviceId;
113 };
114 
115 using StartMode = enum {
116     NOT_SUPPORT,
117     START_ON_STARTUP,
118     START_ON_DEMAND
119 };
120 
121 using DataSource = enum {
122     USER_SOURCE,
123     KERNEL_SOURCE,
124     MODEL_SOURCE,
125     HIVIEW_SOURCE
126 };
127 
128 } // namespace OHOS::Security::SecurityGuard
129 
130 #endif // SECURITY_GUARD_MODEL_INFO_H
131