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_STORE_DEFINE_H
17 #define SECURITY_GUARD_STORE_DEFINE_H
18 
19 #include <string>
20 #include <vector>
21 
22 namespace OHOS::Security::SecurityGuard {
23 constexpr int INVALID_INDEX = -1;
24 constexpr int DB_VERSION = 1;
25 constexpr const char *ID = "id";
26 constexpr const char *USER_ID = "user_id";
27 constexpr const char *DEVICE_ID = "device_id";
28 constexpr const char *EVENT_ID = "event_id";
29 constexpr const char *VERSION = "version";
30 constexpr const char *DATE = "date";
31 constexpr const char *CONTENT = "content";
32 constexpr const char *EVENT_TYPE = "event_type";
33 constexpr const char *DATA_SENSITIVITY_LEVEL = "data_sensitivity_level";
34 constexpr const char *OWNER = "owner";
35 constexpr const char *AUDIT_TABLE = "audit_event";
36 constexpr const char *RISK_TABLE = "risk_event";
37 constexpr const char *APP_INFO_TABLE = "app_info";
38 
39 constexpr const char *APP_NAME = "app_name";
40 constexpr const char *APP_FINGERPRINT = "app_fingerprint";
41 constexpr const char *APP_ATTRIBUTES = "app_attributes";
42 constexpr const char *IS_GLOBAL_APP = "is_global_app";
43 
44 const std::string FOLDER_PATH = "/data/service/el1/public/database/security_guard_service/";
45 
46 using SecEventTableInfo = struct {
47     int32_t rowCount;
48     int32_t columnCount;
49     int32_t primaryKeyIndex;
50     int32_t eventIdIndex;
51     int32_t versionIndex;
52     int32_t dateIndex;
53     int32_t contentIndex;
54     int32_t eventTypeIndex;
55     int32_t dataSensitivityLevelIndex;
56     int32_t ownerIndex;
57     int32_t userIdIndex;
58     int32_t deviceIdIndex;
59 };
60 
61 using AppInfoTableInfo = struct {
62     int32_t rowCount;
63     int32_t columnCount;
64     int32_t primaryKeyIndex;
65     int32_t appNameIndex;
66     int32_t appHashIndex;
67     int32_t appAttrIndex;
68     int32_t appIsGlobalAppIndex;
69 };
70 } // namespace OHOS::Security::SecurityGuard
71 
72 #endif // SECURITY_GUARD_STORE_DEFINE_H
73