1 /* 2 * Copyright (C) 2022 Huawei Technologies Co., Ltd. 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12 13 #ifndef CA_DAEMON_INTERFACE_H 14 #define CA_DAEMON_INTERFACE_H 15 16 #include <cstdint> 17 #include <cstdio> 18 #include "ipc_types.h" 19 #include "iremote_broker.h" 20 #include "tee_client_type.h" 21 #include "cadaemon_ipc_interface_code.h" 22 23 namespace OHOS { 24 namespace CaDaemon { 25 class CaDaemon : public OHOS::IRemoteBroker { 26 public: 27 virtual TEEC_Result InitializeContext(const char *name, MessageParcel &reply) = 0; 28 virtual TEEC_Result FinalizeContext(TEEC_Context *context) = 0; 29 virtual TEEC_Result OpenSession(TEEC_Context *context, const char *taPath, int32_t fd, 30 const TEEC_UUID *destination, uint32_t connectionMethod, 31 TEEC_Operation *operation, uint32_t optMemSize, sptr<Ashmem> &optMem, MessageParcel &reply) = 0; 32 virtual TEEC_Result CloseSession(TEEC_Session *session, TEEC_Context *context) = 0; 33 virtual TEEC_Result InvokeCommand(TEEC_Context *context, TEEC_Session *session, uint32_t commandID, 34 TEEC_Operation *operation, uint32_t optMemSize, sptr<Ashmem> &optMem, MessageParcel &reply) = 0; 35 virtual TEEC_Result RegisterSharedMemory(TEEC_Context *context, 36 TEEC_SharedMemory *sharedMem, MessageParcel &reply) = 0; 37 virtual TEEC_Result AllocateSharedMemory(TEEC_Context *context, 38 TEEC_SharedMemory *sharedMem, MessageParcel &reply) = 0; 39 virtual TEEC_Result ReleaseSharedMemory(TEEC_Context *context, 40 TEEC_SharedMemory *sharedMem, uint32_t shmOffset, MessageParcel &reply) = 0; 41 virtual int32_t SetCallBack(const sptr<IRemoteObject> ¬ify) = 0; 42 virtual TEEC_Result SendSecfile(const char *path, int fd, FILE *fp, MessageParcel &reply) = 0; 43 virtual TEEC_Result GetTeeVersion(MessageParcel &reply) = 0; 44 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.CaDaemon.CaDaemon"); 45 }; 46 } // namespace CaDaemon 47 } // namespace OHOS 48 #endif 49