• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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_DEFINE_H
17 #define SECURITY_GUARD_DEFINE_H
18 
19 #include <string>
20 
21 namespace OHOS::Security::SecurityGuard {
22 using ErrorCode = enum {
23     SUCCESS,
24     FAILED,
25     NO_PERMISSION,
26     NO_SYSTEMCALL,
27     STREAM_ERROR,
28     FILE_ERR,
29     BAD_PARAM,
30     JSON_ERR,
31     NULL_OBJECT,
32     TIME_OUT,
33     NOT_FOUND,
34     TASK_ERR,
35     READ_ERR,
36     WRITE_ERR,
37     DB_CHECK_ERR,
38     DB_LOAD_ERR,
39     DB_OPT_ERR,
40     DB_INFO_ERR,
41     DUPLICATE,
42     FILTER_UNSUPPORTED = 1005,
43     FILTER_EXCEED_LIMIT = 1006,
44     CLIENT_EXCEED_PROCESS_LIMIT = 1007,
45     CLIENT_EXCEED_GLOBAL_LIMIT = 1008
46 };
47 
48 using SecurityModel = struct {
49     std::string devId;
50     uint32_t modelId;
51     std::string param;
52     std::string result;
53 };
54 
55 using ObtainDataEvent = struct {
56     int32_t pid;
57     std::string time;
58     int32_t size;
59     std::string extend;
60 };
61 
62 using ClassifyEvent = struct {
63     int32_t pid;
64     std::string time;
65     std::string eventInfo;
66     std::string status;
67     std::string extend;
68 };
69 
70 using SgSubscribeEvent = struct {
71     int32_t pid;
72     std::string time;
73     int64_t eventId;
74     int32_t ret;
75     std::string extend;
76 };
77 
78 using SgUnsubscribeEvent = struct {
79     int32_t pid;
80     std::string time;
81     int32_t ret;
82     std::string extend;
83 };
84 
85 using ConfigUpdateEvent = struct {
86     std::string path;
87     std::string time;
88     int32_t ret;
89 };
90 
91 using RequestCondition = struct {
92     std::vector<int64_t> riskEvent;
93     std::vector<int64_t> auditEvent;
94     std::string beginTime;
95     std::string endTime;
96 };
97 
98 using FileSystemStoreErrMesg = struct {
99     std::string operation;
100     std::string fileName;
101     std::string mesg;
102 };
103 
104 using ResultCallback = std::function<int32_t (const std::string &devId, uint32_t modelId, const std::string &result)>;
105 
106 const size_t MAX_QUERY_EVENT_SIZE = 1000;
107 const size_t MAX_API_INSTACNE_SIZE = 1000;
108 } // namespace OHOS::Security::SecurityGuard
109 
110 #endif // SECURITY_GUARD_DEFINE_H
111