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 FILE_ACCESS_EXT_STUB_H 17 #define FILE_ACCESS_EXT_STUB_H 18 19 #include <errors.h> 20 21 #include <cstdint> 22 #include <map> 23 24 #include "ifile_access_ext_base.h" 25 #include "iremote_stub.h" 26 #include "message_option.h" 27 #include "message_parcel.h" 28 #include "refbase.h" 29 30 namespace OHOS { 31 namespace FileAccessFwk { 32 class FileAccessExtStub : public IRemoteStub<IFileAccessExtBase> { 33 public: 34 FileAccessExtStub(); 35 virtual ~FileAccessExtStub(); 36 int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; 37 private: 38 ErrCode CmdOpenFile(MessageParcel &data, MessageParcel &reply); 39 ErrCode CmdCreateFile(MessageParcel &data, MessageParcel &reply); 40 ErrCode CmdMkdir(MessageParcel &data, MessageParcel &reply); 41 ErrCode CmdDelete(MessageParcel &data, MessageParcel &reply); 42 ErrCode CmdMove(MessageParcel &data, MessageParcel &reply); 43 ErrCode CmdCopy(MessageParcel &data, MessageParcel &reply); 44 ErrCode CmdCopyFile(MessageParcel &data, MessageParcel &reply); 45 ErrCode CmdRename(MessageParcel &data, MessageParcel &reply); 46 ErrCode CmdListFile(MessageParcel &data, MessageParcel &reply); 47 ErrCode CmdScanFile(MessageParcel &data, MessageParcel &reply); 48 ErrCode CmdQuery(MessageParcel &data, MessageParcel &reply); 49 ErrCode CmdGetFileInfoFromUri(MessageParcel &data, MessageParcel &reply); 50 ErrCode CmdGetFileInfoFromRelativePath(MessageParcel &data, MessageParcel &reply); 51 ErrCode CmdGetRoots(MessageParcel &data, MessageParcel &reply); 52 ErrCode CmdAccess(MessageParcel &data, MessageParcel &reply); 53 ErrCode CmdStartWatcher(MessageParcel &data, MessageParcel &reply); 54 ErrCode CmdStopWatcher(MessageParcel &data, MessageParcel &reply); 55 ErrCode CmdMoveItem(MessageParcel &data, MessageParcel &reply); 56 ErrCode CmdMoveFile(MessageParcel &data, MessageParcel &reply); 57 bool CheckCallingPermission(const std::string &permission); 58 using RequestFuncType = int (FileAccessExtStub::*)(MessageParcel &data, MessageParcel &reply); 59 std::map<uint32_t, RequestFuncType> stubFuncMap_; 60 }; 61 } // namespace FileAccessFwk 62 } // namespace OHOS 63 #endif // FILE_ACCESS_EXT_STUB_H