• 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_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 *TIMESTAMP = "timestamp";
33 constexpr const char *EVENT_TYPE = "event_type";
34 constexpr const char *DATA_SENSITIVITY_LEVEL = "data_sensitivity_level";
35 constexpr const char *OWNER = "owner";
36 constexpr const char *AUDIT_TABLE = "audit_event";
37 constexpr const char *FILE_SYSTEM = "file_system";
38 constexpr const char *RISK_TABLE = "risk_event";
39 constexpr const char *APP_INFO_TABLE = "app_info";
40 
41 constexpr const char *APP_NAME = "app_name";
42 constexpr const char *APP_FINGERPRINT = "app_fingerprint";
43 constexpr const char *APP_ATTRIBUTES = "app_attributes";
44 constexpr const char *IS_GLOBAL_APP = "is_global_app";
45 constexpr size_t SINGLE_FILE_SIZE = 1024 * 1024 * 8;
46 constexpr size_t BUF_LEN = 2048;
47 constexpr int32_t MAX_ON_QUERY_SIZE = 100;
48 constexpr size_t MAX_QUERY_EVENTS_SIZE = 100000;
49 constexpr size_t MAX_STORE_FILE_COUNT = 128;
50 
51 const std::string FOLDER_PATH = "/data/service/el1/public/database/security_guard_service/";
52 const std::string STORE_FILE_FOLDER_PATH = "/data/service/el1/public/database/security_guard_service/file_store/";
53 const std::string STORE_FILE_NAME = "sgevent.gz";
54 const std::string STORE_FILE_NAME_PREFIX = "sgevent_";
55 const std::string STORE_FILE_NAME_SUFFIX = ".gz";
56 const std::string STORE_FILE_EVENT_FIRST_DELIMITER = "|";
57 const std::string STORE_FILE_EVENT_SECOND_DELIMITER = "||";
58 const std::string STORE_FILE_EVENT_THRID_DELIMITER = "|||";
59 const std::string MIN_START_TIME = "19700101000000";
60 
61 using SecEventTableInfo = struct {
62     int32_t rowCount;
63     int32_t columnCount;
64     int32_t primaryKeyIndex;
65     int32_t eventIdIndex;
66     int32_t versionIndex;
67     int32_t dateIndex;
68     int32_t contentIndex;
69     int32_t eventTypeIndex;
70     int32_t dataSensitivityLevelIndex;
71     int32_t ownerIndex;
72     int32_t userIdIndex;
73     int32_t deviceIdIndex;
74 };
75 } // namespace OHOS::Security::SecurityGuard
76 
77 #endif // SECURITY_GUARD_STORE_DEFINE_H
78