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_COLLECTOR_DEFINE_H 17 #define SECURITY_COLLECTOR_DEFINE_H 18 #include <string> 19 20 namespace OHOS::Security::SecurityCollector { 21 using ErrorCode = enum { 22 SUCCESS, 23 FAILED, 24 NO_PERMISSION, 25 NO_SYSTEMCALL, 26 STREAM_ERROR, 27 FILE_ERR, 28 BAD_PARAM, 29 JSON_ERR, 30 NULL_OBJECT, 31 TIME_OUT, 32 NOT_FOUND, 33 TASK_ERR, 34 READ_ERR, 35 WRITE_ERR, 36 DB_CHECK_ERR, 37 DB_LOAD_ERR, 38 DB_OPT_ERR, 39 DB_INFO_ERR, 40 RET_DLOPEN_LIB_FAIL = 1001, 41 RET_DLSYM_LIB_FAIL = 1002, 42 RET_LIB_NOT_LOAD = 1003, 43 RET_OUT_OF_MEMORT = 1004 44 }; 45 46 using ModuleCfgSt = struct { 47 std::string moduleId; 48 std::vector<int64_t> eventId; 49 std::string moduleName; 50 std::string modulePath; 51 uint32_t version; 52 int32_t collectorType; 53 }; 54 55 using ScSubscribeEvent = struct { 56 int32_t pid; 57 std::string version; 58 int64_t eventId; 59 int32_t ret; 60 std::string extend; 61 }; 62 63 using ScUnsubscribeEvent = struct { 64 int32_t pid;; 65 int32_t ret; 66 std::string extend; 67 }; 68 69 using CollectorType = enum { 70 COLLECTOR_NOT_CAN_START, 71 COLLECTOR_CAN_START 72 }; 73 74 constexpr const char* MODULES = "modules"; 75 76 // model config key 77 constexpr const char* MODULE_ID = "moduleId"; 78 constexpr const char* EVENT_ID = "eventId"; 79 constexpr const char* MODULE_NAME = "moduleName"; 80 constexpr const char* MODULE_PATH = "modulePath"; 81 constexpr const char* MODULE_VERSION = "version"; 82 constexpr const char* MODULE_COLLECTOR_TYPE = "collectorType"; 83 84 const size_t MAX_QUERY_EVENT_SIZE = 1000; 85 86 } // namespace OHOS::Security::SecurityGuard 87 88 #endif // SECURITY_COLLECTOR_DEFINE_H 89