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_IRISK_ANALYSIS_MANAGER_H 17 #define SECURITY_GUARD_IRISK_ANALYSIS_MANAGER_H 18 19 #include <cstdint> 20 #include <cstring> 21 22 #include "iremote_broker.h" 23 #include "message_parcel.h" 24 25 #include "risk_analysis_manager_service_ipc_interface_code.h" 26 27 namespace OHOS::Security::SecurityGuard { 28 constexpr int32_t RISK_ANALYSIS_MANAGER_SA_ID = 3523; 29 30 class IRiskAnalysisManager : public IRemoteBroker { 31 public: 32 using InterfaceCode = RiskAnalysisManagerInterfaceCode; 33 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Security.RiskAnalysisManager"); 34 enum { 35 CMD_GET_SECURITY_MODEL_RESULT = static_cast<uint32_t>(InterfaceCode::CMD_GET_SECURITY_MODEL_RESULT), 36 CMD_SET_MODEL_STATE = static_cast<uint32_t>(InterfaceCode::CMD_SET_MODEL_STATE), 37 CMD_START_MODEL = static_cast<uint32_t>(InterfaceCode::CMD_START_MODEL), 38 }; 39 40 virtual int32_t RequestSecurityModelResult(const std::string &devId, uint32_t modelId, 41 const std::string ¶m, const sptr<IRemoteObject> &callback) = 0; 42 virtual int32_t SetModelState(uint32_t modelId, bool enable) = 0; 43 virtual int32_t StartSecurityModel(uint32_t modelId, const std::string ¶m) = 0; 44 }; 45 46 class IRiskAnalysisManagerCallback : public IRemoteBroker { 47 public: 48 using InterfaceCode = RiskAnalysisManagerCallbackInterfaceCode; 49 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Security.RiskAnalysisManager.Callback"); 50 enum { 51 CMD_SET_SECURITY_MODEL_RESULT = static_cast<uint32_t>(InterfaceCode::CMD_SET_SECURITY_MODEL_RESULT), 52 }; 53 54 virtual int32_t ResponseSecurityModelResult(const std::string &devId, uint32_t modelId, std::string &result) = 0; 55 }; 56 } // namespace OHOS::Security::SecurityGuard 57 58 #endif // SECURITY_GUARD_IRISK_ANALYSIS_MANAGER_H 59